From a30957409d299e62096c13aa8300ea0288f1e4bc Mon Sep 17 00:00:00 2001 From: Davood Date: Fri, 26 Sep 2025 21:46:53 +0200 Subject: [PATCH 1/3] fix typos in both comment and error message (#2199) Signed-off-by: davood --- pkg/app/app.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/app/app.go b/pkg/app/app.go index badf2ecd..aa73fbb2 100644 --- a/pkg/app/app.go +++ b/pkg/app/app.go @@ -199,7 +199,7 @@ func (a *App) Diff(c DiffConfigProvider) error { } if c.DetailedExitcode() && (len(allDiffDetectedErrs) > 0 || affectedAny) { - // We take the first release error w/ exit status 2 (although all the defered errs should have exit status 2) + // We take the first release error w/ exit status 2 (although all the deferred errs should have exit status 2) // to just let helmfile itself to exit with 2 // See https://github.com/roboll/helmfile/issues/749 code := 2 @@ -680,7 +680,7 @@ func (a *App) within(dir string, do func() error) error { prev, err := a.fs.Getwd() if err != nil { - return fmt.Errorf("failed getting current working direcotyr: %v", err) + return fmt.Errorf("failed getting current working directory: %v", err) } absDir, err := a.fs.Abs(dir) From c31ecf5061e392ca43eb5a2c18379c8fe73a18bf Mon Sep 17 00:00:00 2001 From: yxxhero <11087727+yxxhero@users.noreply.github.com> Date: Tue, 30 Sep 2025 09:01:42 +0800 Subject: [PATCH 2/3] cleanup disk in release ci (#2203) * cleanup disk in release ci Signed-off-by: yxxhero * cleanup disk in release ci Signed-off-by: yxxhero * cleanup disk in release ci Signed-off-by: yxxhero * cleanup disk in release ci Signed-off-by: yxxhero --------- Signed-off-by: yxxhero --- .github/workflows/releaser.yaml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/releaser.yaml b/.github/workflows/releaser.yaml index 7d57f4a9..5f7246ba 100644 --- a/.github/workflows/releaser.yaml +++ b/.github/workflows/releaser.yaml @@ -30,6 +30,17 @@ jobs: go-version-file: go.mod - name: check disk usage run: df -h + - name: cleanup disk + run: | + sudo rm -rf /usr/share/dotnet + sudo rm -rf /opt/ghc + sudo rm -rf /usr/local/share/boost + sudo rm -fr /usr/local/lib/android + sudo rm -fr /opt/hostedtoolcache/CodeQL + sudo docker image prune --all --force + sudo docker builder prune -a + - name: check disk usage + run: df -h - uses: goreleaser/goreleaser-action@v6 with: version: latest From d94a7ada2b50e39e79909ca1ec632f290f9fde8f Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Tue, 30 Sep 2025 09:59:00 +0800 Subject: [PATCH 3/3] Migrate AWS SDK from v1 to v2 to resolve deprecation warnings (#2202) * Migrate AWS SDK from v1 to v2 to resolve deprecation warnings Co-authored-by: yxxhero <11087727+yxxhero@users.noreply.github.com> * Fix error message style issue for staticcheck Co-authored-by: yxxhero <11087727+yxxhero@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: yxxhero <11087727+yxxhero@users.noreply.github.com> --- go.mod | 7 +++-- go.sum | 3 --- pkg/remote/remote.go | 62 +++++++++++++++++++++----------------------- 3 files changed, 33 insertions(+), 39 deletions(-) diff --git a/go.mod b/go.mod index 7e9f0716..444b8cfb 100644 --- a/go.mod +++ b/go.mod @@ -6,6 +6,8 @@ require ( dario.cat/mergo v1.0.2 github.com/Masterminds/semver/v3 v3.4.0 github.com/Masterminds/sprig/v3 v3.3.0 + github.com/aws/aws-sdk-go-v2/config v1.29.15 + github.com/aws/aws-sdk-go-v2/service/s3 v1.80.1 github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc github.com/go-test/deep v1.1.1 github.com/golang/mock v1.6.0 @@ -46,7 +48,7 @@ require ( github.com/Azure/go-autorest/tracing v0.6.0 // indirect github.com/Masterminds/goutils v1.1.1 // indirect github.com/a8m/envsubst v1.4.3 // indirect - github.com/aws/aws-sdk-go v1.55.7 + github.com/aws/aws-sdk-go v1.55.7 // indirect github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect github.com/blang/semver v3.5.1+incompatible // indirect github.com/dimchansky/utfbom v1.1.1 // indirect @@ -73,7 +75,6 @@ require ( github.com/huandu/xstrings v1.5.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/itchyny/gojq v0.12.16 // indirect - github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/klauspost/compress v1.18.0 // indirect github.com/lib/pq v1.10.9 // indirect github.com/mattn/go-colorable v0.1.14 // indirect @@ -146,7 +147,6 @@ require ( github.com/atotto/clipboard v0.1.4 // indirect github.com/aws/aws-sdk-go-v2 v1.38.3 // indirect github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.10 // indirect - github.com/aws/aws-sdk-go-v2/config v1.29.15 // indirect github.com/aws/aws-sdk-go-v2/credentials v1.17.68 // indirect github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.30 // indirect github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.17.72 // indirect @@ -159,7 +159,6 @@ require ( github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.15 // indirect github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.18.15 // indirect github.com/aws/aws-sdk-go-v2/service/kms v1.38.3 // indirect - github.com/aws/aws-sdk-go-v2/service/s3 v1.80.1 // indirect github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.39.2 // indirect github.com/aws/aws-sdk-go-v2/service/ssm v1.64.2 // indirect github.com/aws/aws-sdk-go-v2/service/sso v1.25.3 // indirect diff --git a/go.sum b/go.sum index 6a53bc7b..fc46d9f9 100644 --- a/go.sum +++ b/go.sum @@ -461,8 +461,6 @@ github.com/itchyny/timefmt-go v0.1.6 h1:ia3s54iciXDdzWzwaVKXZPbiXzxxnv1SPGFfM/my github.com/itchyny/timefmt-go v0.1.6/go.mod h1:RRDZYC5s9ErkjQvTvvU7keJjxUYzIISJGxm9/mAERQg= github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= -github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8= -github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= github.com/jmoiron/sqlx v1.4.0 h1:1PLqN7S1UYp5t4SrVVnt4nUVNemrDAtxlulVe+Qgm3o= github.com/jmoiron/sqlx v1.4.0/go.mod h1:ZrZ7UsYB/weZdl2Bxg6jCRO9c3YHl8r3ahlKmRT4JLY= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= @@ -863,7 +861,6 @@ gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/pkg/remote/remote.go b/pkg/remote/remote.go index 8b6006f6..7b870617 100644 --- a/pkg/remote/remote.go +++ b/pkg/remote/remote.go @@ -15,9 +15,8 @@ import ( "strconv" "strings" - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" - "github.com/aws/aws-sdk-go/service/s3" + "github.com/aws/aws-sdk-go-v2/config" + "github.com/aws/aws-sdk-go-v2/service/s3" "github.com/hashicorp/go-getter" "github.com/hashicorp/go-getter/helper/url" "go.uber.org/zap" @@ -368,22 +367,22 @@ func (g *S3Getter) Get(wd, src, dst string) error { return err } - // Create a new AWS session using the default AWS configuration - sess := session.Must(session.NewSessionWithOptions(session.Options{ - SharedConfigState: session.SharedConfigEnable, - Config: aws.Config{ - Region: aws.String(region), - }, - })) + // Create a new AWS config and S3 client using AWS SDK v2 + cfg, err := config.LoadDefaultConfig(context.TODO(), + config.WithRegion(region), + ) + if err != nil { + return err + } - // Create an S3 client using the session - s3Client := s3.New(sess) + // Create an S3 client using the config + s3Client := s3.NewFromConfig(cfg) getObjectInput := &s3.GetObjectInput{ Bucket: &bucket, Key: &key, } - resp, err := s3Client.GetObject(getObjectInput) + resp, err := s3Client.GetObject(context.TODO(), getObjectInput) defer func(Body io.ReadCloser) { err := Body.Close() if err != nil { @@ -467,48 +466,47 @@ func (g *S3Getter) S3FileExists(path string) (string, error) { } // Region - g.Logger.Debugf("Creating session for determining S3 region %s", path) - sess := session.Must(session.NewSessionWithOptions(session.Options{ - SharedConfigState: session.SharedConfigEnable, - })) + g.Logger.Debugf("Creating config for determining S3 region %s", path) + cfg, err := config.LoadDefaultConfig(context.TODO()) + if err != nil { + return "", err + } g.Logger.Debugf("Getting bucket %s location %s", bucket, path) - s3Client := s3.New(sess) + s3Client := s3.NewFromConfig(cfg) bucketRegion := "us-east-1" getBucketLocationInput := &s3.GetBucketLocationInput{ - Bucket: aws.String(bucket), + Bucket: &bucket, } - resp, err := s3Client.GetBucketLocation(getBucketLocationInput) + resp, err := s3Client.GetBucketLocation(context.TODO(), getBucketLocationInput) if err != nil { - return "", fmt.Errorf("Error: Failed to retrieve bucket location: %v\n", err) + return "", fmt.Errorf("failed to retrieve bucket location: %v", err) } - if resp == nil || resp.LocationConstraint == nil { + if resp == nil || string(resp.LocationConstraint) == "" { g.Logger.Debugf("Bucket has no location Assuming us-east-1") } else { - bucketRegion = *resp.LocationConstraint + bucketRegion = string(resp.LocationConstraint) } g.Logger.Debugf("Got bucket location %s", bucketRegion) // File existence - g.Logger.Debugf("Creating new session with region to see if file exists") - regionSession, err := session.NewSessionWithOptions(session.Options{ - SharedConfigState: session.SharedConfigEnable, - Config: aws.Config{ - Region: aws.String(bucketRegion), - }, - }) + g.Logger.Debugf("Creating new config with region to see if file exists") + regionCfg, err := config.LoadDefaultConfig(context.TODO(), + config.WithRegion(bucketRegion), + ) if err != nil { g.Logger.Error(err) + return bucketRegion, err } g.Logger.Debugf("Creating new s3 client to check if object exists") - s3Client = s3.New(regionSession) + s3Client = s3.NewFromConfig(regionCfg) headObjectInput := &s3.HeadObjectInput{ Bucket: &bucket, Key: &key, } g.Logger.Debugf("Fethcing head %s", path) - _, err = s3Client.HeadObject(headObjectInput) + _, err = s3Client.HeadObject(context.TODO(), headObjectInput) return bucketRegion, err }