Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Package updates #33

Merged
merged 8 commits into from
Sep 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-22.04]
go: ["1.21.9", "1.22.2"]
go: ["1.22.7", "1.23.1"]
goos: [linux]
goarch: [amd64, arm64]

Expand Down Expand Up @@ -62,14 +62,14 @@ jobs:

- name: Upload Release Artifact
uses: actions/upload-artifact@v4
if: ${{ (github.ref == 'refs/heads/main' || github.event_name == 'pull_request') && matrix.go == '1.21.9' }}
if: ${{ (github.ref == 'refs/heads/main' || github.event_name == 'pull_request') && matrix.go == '1.22.7' }}
with:
name: wings_linux_${{ matrix.goarch }}
path: dist/wings

- name: Upload Debug Artifact
uses: actions/upload-artifact@v4
if: ${{ (github.ref == 'refs/heads/main' || github.event_name == 'pull_request') && matrix.go == '1.21.9' }}
if: ${{ (github.ref == 'refs/heads/main' || github.event_name == 'pull_request') && matrix.go == '1.22.7' }}
with:
name: wings_linux_${{ matrix.goarch }}_debug
path: dist/wings_debug
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.21.9"
go-version: "1.22.7"

- name: Build release binaries
env:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Stage 1 (Build)
FROM golang:1.21.9-alpine AS builder
FROM golang:1.22.7-alpine AS builder

ARG VERSION
RUN apk add --update --no-cache git make
Expand Down
9 changes: 5 additions & 4 deletions cmd/diagnostics.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"github.com/docker/docker/pkg/parsers/operatingsystem"
"github.com/goccy/go-json"
"github.com/spf13/cobra"
dockerSystem "github.com/docker/docker/api/types/system" // Alias the correct system package

"github.com/pelican-dev/wings/config"
"github.com/pelican-dev/wings/environment"
Expand Down Expand Up @@ -208,18 +209,18 @@ func diagnosticsCmdRun(*cobra.Command, []string) {
}
}

func getDockerInfo() (types.Version, types.Info, error) {
func getDockerInfo() (types.Version, dockerSystem.Info, error) {
client, err := environment.Docker()
if err != nil {
return types.Version{}, types.Info{}, err
return types.Version{}, dockerSystem.Info{}, err
}
dockerVersion, err := client.ServerVersion(context.Background())
if err != nil {
return types.Version{}, types.Info{}, err
return types.Version{}, dockerSystem.Info{}, err
}
dockerInfo, err := client.Info(context.Background())
if err != nil {
return types.Version{}, types.Info{}, err
return types.Version{}, dockerSystem.Info{}, err
}
return dockerVersion, dockerInfo, nil
}
Expand Down
1 change: 1 addition & 0 deletions config/config_docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ type DockerNetworkConfiguration struct {
// defined.
Name string `default:"pelican_nw"`
ISPN bool `default:"false" yaml:"ispn"`
IPv6 bool `default:"true" yaml:"IPv6"`
Driver string `default:"bridge"`
Mode string `default:"pelican_nw" yaml:"network_mode"`
IsInternal bool `default:"false" yaml:"is_internal"`
Expand Down
5 changes: 3 additions & 2 deletions environment/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,10 @@ func ConfigureDocker(ctx context.Context) error {
// Creates a new network on the machine if one does not exist already.
func createDockerNetwork(ctx context.Context, cli *client.Client) error {
nw := config.Get().Docker.Network
_, err := cli.NetworkCreate(ctx, nw.Name, types.NetworkCreate{
enableIPv6 := nw.IPv6 // get the value from the config file, todo add some logic to the IPAM interaface for that.
_, err := cli.NetworkCreate(ctx, nw.Name, network.CreateOptions{
Driver: nw.Driver,
EnableIPv6: true,
EnableIPv6: &enableIPv6,
Internal: nw.IsInternal,
IPAM: &network.IPAM{
Config: []network.IPAMConfig{{
Expand Down
14 changes: 8 additions & 6 deletions environment/docker/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/mount"
"github.com/docker/docker/client"
dockerImage "github.com/docker/docker/api/types/image" // Alias the correct images package

"github.com/pelican-dev/wings/config"
"github.com/pelican-dev/wings/environment"
Expand Down Expand Up @@ -49,7 +50,7 @@ func (e *Environment) Attach(ctx context.Context) error {
return nil
}

opts := types.ContainerAttachOptions{
opts := container.AttachOptions{
Stdin: true,
Stdout: true,
Stderr: true,
Expand Down Expand Up @@ -195,6 +196,7 @@ func (e *Environment) Create() error {

networkMode := container.NetworkMode(cfg.Docker.Network.Mode)
if a.ForceOutgoingIP {
enableIPv6 := false // define a bool variable
e.log().Debug("environment/docker: forcing outgoing IP address")
networkName := "ip-" + strings.ReplaceAll(strings.ReplaceAll(a.DefaultMapping.Ip, ".", "-"), ":", "-")
networkMode = container.NetworkMode(networkName)
Expand All @@ -206,7 +208,7 @@ func (e *Environment) Create() error {

if _, err := e.client.NetworkCreate(ctx, networkName, types.NetworkCreate{
Driver: "bridge",
EnableIPv6: false,
EnableIPv6: &enableIPv6,
Internal: false,
Attachable: false,
Ingress: false,
Expand Down Expand Up @@ -271,7 +273,7 @@ func (e *Environment) Destroy() error {
// We set it to stopping than offline to prevent crash detection from being triggered.
e.SetState(environment.ProcessStoppingState)

err := e.client.ContainerRemove(context.Background(), e.Id, types.ContainerRemoveOptions{
err := e.client.ContainerRemove(context.Background(), e.Id, container.RemoveOptions{
RemoveVolumes: true,
RemoveLinks: false,
Force: true,
Expand Down Expand Up @@ -317,7 +319,7 @@ func (e *Environment) SendCommand(c string) error {
// is running or not, it will simply try to read the last X bytes of the file
// and return them.
func (e *Environment) Readlog(lines int) ([]string, error) {
r, err := e.client.ContainerLogs(context.Background(), e.Id, types.ContainerLogsOptions{
r, err := e.client.ContainerLogs(context.Background(), e.Id, container.LogsOptions{
ShowStdout: true,
ShowStderr: true,
Tail: strconv.Itoa(lines),
Expand Down Expand Up @@ -372,7 +374,7 @@ func (e *Environment) ensureImageExists(image string) error {
}

// Get the ImagePullOptions.
imagePullOptions := types.ImagePullOptions{All: false}
imagePullOptions := dockerImage.PullOptions{All: false}
if registryAuth != nil {
b64, err := registryAuth.Base64()
if err != nil {
Expand All @@ -385,7 +387,7 @@ func (e *Environment) ensureImageExists(image string) error {

out, err := e.client.ImagePull(ctx, image, imagePullOptions)
if err != nil {
images, ierr := e.client.ImageList(ctx, types.ImageListOptions{})
images, ierr := e.client.ImageList(ctx, dockerImage.ListOptions{})
if ierr != nil {
// Well damn, something has gone really wrong here, just go ahead and abort there
// isn't much anything we can do to try and self-recover from this.
Expand Down
5 changes: 2 additions & 3 deletions environment/docker/power.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (

"emperror.dev/errors"
"github.com/apex/log"
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/client"

Expand All @@ -27,7 +26,7 @@ import (
// is running does not result in the server becoming un-bootable.
func (e *Environment) OnBeforeStart(ctx context.Context) error {
// Always destroy and re-create the server container to ensure that synced data from the Panel is used.
if err := e.client.ContainerRemove(ctx, e.Id, types.ContainerRemoveOptions{RemoveVolumes: true}); err != nil {
if err := e.client.ContainerRemove(ctx, e.Id, container.RemoveOptions{RemoveVolumes: true}); err != nil {
if !client.IsErrNotFound(err) {
return errors.WrapIf(err, "environment/docker: failed to remove container during pre-boot")
}
Expand Down Expand Up @@ -120,7 +119,7 @@ func (e *Environment) Start(ctx context.Context) error {
return errors.WrapIf(err, "environment/docker: failed to attach to container")
}

if err := e.client.ContainerStart(actx, e.Id, types.ContainerStartOptions{}); err != nil {
if err := e.client.ContainerStart(actx, e.Id, container.StartOptions{}); err != nil {
return errors.WrapIf(err, "environment/docker: failed to start container")
}

Expand Down
56 changes: 29 additions & 27 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/pelican-dev/wings

go 1.21
go 1.22.7

require (
emperror.dev/errors v0.8.1
Expand All @@ -10,27 +10,27 @@ require (
github.com/acobaugh/osrelease v0.1.0
github.com/apex/log v1.9.0
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2
github.com/beevik/etree v1.3.0
github.com/beevik/etree v1.4.1
github.com/buger/jsonparser v1.1.1
github.com/cenkalti/backoff/v4 v4.3.0
github.com/creasty/defaults v1.7.0
github.com/docker/docker v25.0.4+incompatible
github.com/creasty/defaults v1.8.0
github.com/docker/docker v27.2.0+incompatible
github.com/docker/go-connections v0.5.0
github.com/fatih/color v1.16.0
github.com/fatih/color v1.17.0
github.com/franela/goblin v0.0.0-20211003143422-0a4f594942bf
github.com/gabriel-vasile/mimetype v1.4.3
github.com/gabriel-vasile/mimetype v1.4.5
github.com/gammazero/workerpool v1.1.3
github.com/gbrlsnchs/jwt/v3 v3.0.1
github.com/gin-gonic/gin v1.9.1
github.com/gin-gonic/gin v1.10.0
github.com/glebarez/sqlite v1.11.0
github.com/go-co-op/gocron v1.37.0
github.com/goccy/go-json v0.10.2
github.com/goccy/go-json v0.10.3
github.com/google/uuid v1.6.0
github.com/gorilla/websocket v1.5.1
github.com/gorilla/websocket v1.5.3
github.com/iancoleman/strcase v0.3.0
github.com/icza/dyno v0.0.0-20230330125955-09f820a8d9c0
github.com/juju/ratelimit v1.0.2
github.com/klauspost/compress v1.17.8
github.com/klauspost/compress v1.17.9
github.com/klauspost/pgzip v1.2.6
github.com/magiconair/properties v1.8.7
github.com/mattn/go-colorable v0.1.13
Expand All @@ -39,16 +39,16 @@ require (
github.com/patrickmn/go-cache v2.1.0+incompatible
github.com/pkg/sftp v1.13.6
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06
github.com/shirou/gopsutil/v3 v3.24.3
github.com/spf13/cobra v1.8.0
github.com/shirou/gopsutil/v3 v3.24.5
github.com/spf13/cobra v1.8.1
github.com/stretchr/testify v1.9.0
golang.org/x/crypto v0.22.0
golang.org/x/sync v0.7.0
golang.org/x/sys v0.19.0
golang.org/x/crypto v0.27.0
golang.org/x/sync v0.8.0
golang.org/x/sys v0.25.0
gopkg.in/ini.v1 v1.67.0
gopkg.in/yaml.v2 v2.4.0
gopkg.in/yaml.v3 v3.0.1
gorm.io/gorm v1.25.9
gorm.io/gorm v1.25.11
)

require (
Expand All @@ -58,9 +58,10 @@ require (
github.com/bodgit/plumbing v1.3.0 // indirect
github.com/bodgit/sevenzip v1.5.1 // indirect
github.com/bodgit/windows v1.0.1 // indirect
github.com/bytedance/sonic v1.11.3 // indirect
github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d // indirect
github.com/chenzhuoyu/iasm v0.9.1 // indirect
github.com/bytedance/sonic v1.11.6 // indirect
github.com/bytedance/sonic/loader v0.1.1 // indirect
github.com/cloudwego/base64x v0.1.4 // indirect
github.com/cloudwego/iasm v0.2.0 // indirect
github.com/containerd/log v0.1.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/distribution/reference v0.6.0 // indirect
Expand All @@ -76,7 +77,7 @@ require (
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.19.0 // indirect
github.com/go-playground/validator/v10 v10.20.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
Expand All @@ -94,6 +95,7 @@ require (
github.com/magefile/mage v1.15.0 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect
github.com/moby/docker-image-spec v1.3.1 // indirect
github.com/moby/term v0.0.0-20220808134915-39b0c02b01ae // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
Expand All @@ -102,7 +104,7 @@ require (
github.com/nwaples/rardecode/v2 v2.0.0-beta.2 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.1.0 // indirect
github.com/pelletier/go-toml/v2 v2.2.0 // indirect
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
github.com/pierrec/lz4/v4 v4.1.21 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
Expand All @@ -128,15 +130,15 @@ require (
go.uber.org/atomic v1.11.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go4.org v0.0.0-20230225012048-214862532bf5 // indirect
golang.org/x/arch v0.7.0 // indirect
golang.org/x/arch v0.8.0 // indirect
golang.org/x/mod v0.17.0 // indirect
golang.org/x/net v0.24.0 // indirect
golang.org/x/term v0.19.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/net v0.29.0 // indirect
golang.org/x/term v0.24.0 // indirect
golang.org/x/text v0.18.0 // indirect
golang.org/x/time v0.0.0-20220922220347-f3bd1da661af // indirect
golang.org/x/tools v0.20.0 // indirect
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect
google.golang.org/protobuf v1.33.0 // indirect
google.golang.org/protobuf v1.34.1 // indirect
gotest.tools/v3 v3.0.2 // indirect
modernc.org/libc v1.49.3 // indirect
modernc.org/mathutil v1.6.0 // indirect
Expand Down
Loading
Loading