From 94bc8b319c8557ac992f8cf436d7953c4ebb62e5 Mon Sep 17 00:00:00 2001 From: Casey Lee <cplee@nektos.com> Date: Mon, 10 Jul 2023 21:55:53 -0700 Subject: [PATCH] Bump dockercli (#1905) * updates to support newer version of docker sdk Bumps [github.com/docker/cli](https://github.com/docker/cli) from 24.0.2+incompatible to 24.0.4+incompatible. - [Commits](https://github.com/docker/cli/compare/v24.0.2...v24.0.4) --- updated-dependencies: - dependency-name: github.com/docker/cli dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * feat: upgrade to go 1.20 * feat: upgrade to go 1.20 * chore: use go version from go.mod --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/checks.yml | 9 ++++----- .github/workflows/promote.yml | 5 +---- .github/workflows/release.yml | 5 +---- README.md | 2 +- go.mod | 6 +++--- go.sum | 10 +++++----- pkg/container/docker_auth.go | 16 ++++++++-------- pkg/container/docker_pull.go | 3 ++- pkg/container/docker_volume.go | 9 +++++---- 9 files changed, 30 insertions(+), 35 deletions(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 40f060f..0ba0ad5 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -8,7 +8,6 @@ concurrency: env: ACT_OWNER: ${{ github.repository_owner }} ACT_REPOSITORY: ${{ github.repository }} - GO_VERSION: 1.18 CGO_ENABLED: 0 jobs: @@ -21,7 +20,7 @@ jobs: fetch-depth: 0 - uses: actions/setup-go@v4 with: - go-version: ${{ env.GO_VERSION }} + go-version-file: go.mod check-latest: true - uses: golangci/golangci-lint-action@v3.6.0 with: @@ -46,7 +45,7 @@ jobs: uses: docker/setup-qemu-action@v2 - uses: actions/setup-go@v4 with: - go-version: ${{ env.GO_VERSION }} + go-version-file: go.mod check-latest: true - uses: actions/cache@v3 if: ${{ !env.ACT }} @@ -81,7 +80,7 @@ jobs: fetch-depth: 2 - uses: actions/setup-go@v4 with: - go-version: ${{ env.GO_VERSION }} + go-version-file: go.mod check-latest: true - name: Run Tests uses: ./.github/actions/run-tests @@ -96,7 +95,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-go@v4 with: - go-version: ${{ env.GO_VERSION }} + go-version-file: go.mod check-latest: true - uses: actions/cache@v3 if: ${{ !env.ACT }} diff --git a/.github/workflows/promote.yml b/.github/workflows/promote.yml index 7ea6c2a..d6cd1ea 100644 --- a/.github/workflows/promote.yml +++ b/.github/workflows/promote.yml @@ -4,9 +4,6 @@ on: - cron: '0 2 1 * *' workflow_dispatch: {} -env: - GO_VERSION: 1.18 - jobs: release: name: promote @@ -20,7 +17,7 @@ jobs: - uses: fregante/setup-git-user@v2 - uses: actions/setup-go@v4 with: - go-version: ${{ env.GO_VERSION }} + go-version-file: go.mod check-latest: true - uses: actions/cache@v3 if: ${{ !env.ACT }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index dd053ca..9d4a45a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,9 +4,6 @@ on: tags: - v* -env: - GO_VERSION: 1.18 - jobs: release: name: release @@ -17,7 +14,7 @@ jobs: fetch-depth: 0 - uses: actions/setup-go@v4 with: - go-version: ${{ env.GO_VERSION }} + go-version-file: go.mod check-latest: true - uses: actions/cache@v3 if: ${{ !env.ACT }} diff --git a/README.md b/README.md index 8661348..7e4608e 100644 --- a/README.md +++ b/README.md @@ -460,7 +460,7 @@ Want to contribute to act? Awesome! Check out the [contributing guidelines](CONT ## Manually building from source -- Install Go tools 1.18+ - (<https://golang.org/doc/install>) +- Install Go tools 1.20+ - (<https://golang.org/doc/install>) - Clone this repo `git clone git@github.com:nektos/act.git` - Run unit tests with `make test` - Build and install: `make install` diff --git a/go.mod b/go.mod index e03a01d..2a0df7c 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/nektos/act -go 1.18 +go 1.20 require ( github.com/AlecAivazis/survey/v2 v2.3.7 @@ -8,9 +8,9 @@ require ( github.com/adrg/xdg v0.4.0 github.com/andreaskoch/go-fswatch v1.0.0 github.com/creack/pty v1.1.18 - github.com/docker/cli v24.0.2+incompatible + github.com/docker/cli v24.0.4+incompatible github.com/docker/distribution v2.8.2+incompatible - github.com/docker/docker v23.0.6+incompatible + github.com/docker/docker v24.0.4+incompatible github.com/docker/go-connections v0.4.0 github.com/go-git/go-billy/v5 v5.4.1 github.com/go-git/go-git/v5 v5.7.0 diff --git a/go.sum b/go.sum index d65baa0..5a28d54 100644 --- a/go.sum +++ b/go.sum @@ -1,3 +1,4 @@ +github.com/AdaLogics/go-fuzz-headers v0.0.0-20210715213245-6c3934b029d8 h1:V8krnnfGj4pV65YLUm3C0/8bl7V5Nry2Pwvy3ru/wLc= github.com/AlecAivazis/survey/v2 v2.3.7 h1:6I/u8FvytdGsgonrYsVn2t8t4QiRnh6QSTqkkhIiSjQ= github.com/AlecAivazis/survey/v2 v2.3.7/go.mod h1:xUTIdE4KCOIjsBAE1JYsUPoCqYdZ1reCfTwbto0Fduo= github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 h1:w+iIsaOQNcT7OZ575w+acHgRric5iCyQh+xv+KJ4HB8= @@ -29,7 +30,6 @@ github.com/cloudflare/circl v1.3.3/go.mod h1:5XYMA4rFBvNIrhs50XuiBJ15vF2pZn4nnUK github.com/containerd/console v1.0.3/go.mod h1:7LqA/THxQ86k76b8c/EMSiaJ3h1eZkMkXar0TQ1gf3U= github.com/containerd/containerd v1.6.20 h1:+itjwpdqXpzHB/QAiWc/BZCjjVfcNgw69w/oIeF4Oy0= github.com/containerd/containerd v1.6.20/go.mod h1:apei1/i5Ux2FzrK6+DM/suEsGuK/MeVOfy8tR2q7Wnw= -github.com/containerd/continuity v0.3.0 h1:nisirsYROK15TAMVukJOUyGJjz4BNQJBVsNvAXZJ/eg= github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= @@ -41,12 +41,12 @@ github.com/cyphar/filepath-securejoin v0.2.3/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxG github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/docker/cli v24.0.2+incompatible h1:QdqR7znue1mtkXIJ+ruQMGQhpw2JzMJLRXp6zpzF6tM= -github.com/docker/cli v24.0.2+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= +github.com/docker/cli v24.0.4+incompatible h1:Y3bYF9ekNTm2VFz5U/0BlMdJy73D+Y1iAAZ8l63Ydzw= +github.com/docker/cli v24.0.4+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m322EBzniBPB6ZIzuh8= github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= -github.com/docker/docker v23.0.6+incompatible h1:aBD4np894vatVX99UTx/GyOUOK4uEcROwA3+bQhEcoU= -github.com/docker/docker v23.0.6+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker v24.0.4+incompatible h1:s/LVDftw9hjblvqIeTiGYXBCD95nOEEl7qRsRrIOuQI= +github.com/docker/docker v24.0.4+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/docker-credential-helpers v0.7.0 h1:xtCHsjxogADNZcdv1pKUHXryefjlVRqWqIhk/uXJp0A= github.com/docker/docker-credential-helpers v0.7.0/go.mod h1:rETQfLdHNT3foU5kuNkFR1R1V12OJRRO5lzt2D1b5X0= github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= diff --git a/pkg/container/docker_auth.go b/pkg/container/docker_auth.go index e47fe64..9c263f5 100644 --- a/pkg/container/docker_auth.go +++ b/pkg/container/docker_auth.go @@ -8,16 +8,16 @@ import ( "github.com/docker/cli/cli/config" "github.com/docker/cli/cli/config/credentials" - "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/registry" "github.com/nektos/act/pkg/common" ) -func LoadDockerAuthConfig(ctx context.Context, image string) (types.AuthConfig, error) { +func LoadDockerAuthConfig(ctx context.Context, image string) (registry.AuthConfig, error) { logger := common.Logger(ctx) config, err := config.Load(config.Dir()) if err != nil { logger.Warnf("Could not load docker config: %v", err) - return types.AuthConfig{}, err + return registry.AuthConfig{}, err } if !config.ContainsAuth() { @@ -33,13 +33,13 @@ func LoadDockerAuthConfig(ctx context.Context, image string) (types.AuthConfig, authConfig, err := config.GetAuthConfig(hostName) if err != nil { logger.Warnf("Could not get auth config from docker config: %v", err) - return types.AuthConfig{}, err + return registry.AuthConfig{}, err } - return types.AuthConfig(authConfig), nil + return registry.AuthConfig(authConfig), nil } -func LoadDockerAuthConfigs(ctx context.Context) map[string]types.AuthConfig { +func LoadDockerAuthConfigs(ctx context.Context) map[string]registry.AuthConfig { logger := common.Logger(ctx) config, err := config.Load(config.Dir()) if err != nil { @@ -52,9 +52,9 @@ func LoadDockerAuthConfigs(ctx context.Context) map[string]types.AuthConfig { } creds, _ := config.GetAllCredentials() - authConfigs := make(map[string]types.AuthConfig, len(creds)) + authConfigs := make(map[string]registry.AuthConfig, len(creds)) for k, v := range creds { - authConfigs[k] = types.AuthConfig(v) + authConfigs[k] = registry.AuthConfig(v) } return authConfigs diff --git a/pkg/container/docker_pull.go b/pkg/container/docker_pull.go index 6fb2961..ad75958 100644 --- a/pkg/container/docker_pull.go +++ b/pkg/container/docker_pull.go @@ -11,6 +11,7 @@ import ( "github.com/docker/distribution/reference" "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/registry" "github.com/nektos/act/pkg/common" ) @@ -82,7 +83,7 @@ func getImagePullOptions(ctx context.Context, input NewDockerPullExecutorInput) if input.Username != "" && input.Password != "" { logger.Debugf("using authentication for docker pull") - authConfig := types.AuthConfig{ + authConfig := registry.AuthConfig{ Username: input.Username, Password: input.Password, } diff --git a/pkg/container/docker_volume.go b/pkg/container/docker_volume.go index 6eafd33..0bb2cd7 100644 --- a/pkg/container/docker_volume.go +++ b/pkg/container/docker_volume.go @@ -6,10 +6,11 @@ import ( "context" "github.com/docker/docker/api/types/filters" + "github.com/docker/docker/api/types/volume" "github.com/nektos/act/pkg/common" ) -func NewDockerVolumeRemoveExecutor(volume string, force bool) common.Executor { +func NewDockerVolumeRemoveExecutor(volumeName string, force bool) common.Executor { return func(ctx context.Context) error { cli, err := GetDockerClient(ctx) if err != nil { @@ -17,14 +18,14 @@ func NewDockerVolumeRemoveExecutor(volume string, force bool) common.Executor { } defer cli.Close() - list, err := cli.VolumeList(ctx, filters.NewArgs()) + list, err := cli.VolumeList(ctx, volume.ListOptions{Filters: filters.NewArgs()}) if err != nil { return err } for _, vol := range list.Volumes { - if vol.Name == volume { - return removeExecutor(volume, force)(ctx) + if vol.Name == volumeName { + return removeExecutor(volumeName, force)(ctx) } }