Merge branch 'main' into copilot/fix-cf78f461-bc58-422f-9d1b-8486919324f5

This commit is contained in:
yxxhero 2025-09-30 09:59:39 +08:00 committed by GitHub
commit 25b6cf0d4f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 46 additions and 41 deletions

View File

@ -30,6 +30,17 @@ jobs:
go-version-file: go.mod go-version-file: go.mod
- name: check disk usage - name: check disk usage
run: df -h 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 - uses: goreleaser/goreleaser-action@v6
with: with:
version: latest version: latest

7
go.mod
View File

@ -6,6 +6,8 @@ require (
dario.cat/mergo v1.0.2 dario.cat/mergo v1.0.2
github.com/Masterminds/semver/v3 v3.4.0 github.com/Masterminds/semver/v3 v3.4.0
github.com/Masterminds/sprig/v3 v3.3.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/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc
github.com/go-test/deep v1.1.1 github.com/go-test/deep v1.1.1
github.com/golang/mock v1.6.0 github.com/golang/mock v1.6.0
@ -46,7 +48,7 @@ require (
github.com/Azure/go-autorest/tracing v0.6.0 // indirect github.com/Azure/go-autorest/tracing v0.6.0 // indirect
github.com/Masterminds/goutils v1.1.1 // indirect github.com/Masterminds/goutils v1.1.1 // indirect
github.com/a8m/envsubst v1.4.3 // 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/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect
github.com/blang/semver v3.5.1+incompatible // indirect github.com/blang/semver v3.5.1+incompatible // indirect
github.com/dimchansky/utfbom v1.1.1 // indirect github.com/dimchansky/utfbom v1.1.1 // indirect
@ -73,7 +75,6 @@ require (
github.com/huandu/xstrings v1.5.0 // indirect github.com/huandu/xstrings v1.5.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/itchyny/gojq v0.12.16 // 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/klauspost/compress v1.18.0 // indirect
github.com/lib/pq v1.10.9 // indirect github.com/lib/pq v1.10.9 // indirect
github.com/mattn/go-colorable v0.1.14 // 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/atotto/clipboard v0.1.4 // indirect
github.com/aws/aws-sdk-go-v2 v1.38.3 // 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/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/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/ec2/imds v1.16.30 // indirect
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.17.72 // 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/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/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/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/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/ssm v1.64.2 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.25.3 // indirect github.com/aws/aws-sdk-go-v2/service/sso v1.25.3 // indirect

3
go.sum
View File

@ -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/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 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg=
github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= 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 h1:1PLqN7S1UYp5t4SrVVnt4nUVNemrDAtxlulVe+Qgm3o=
github.com/jmoiron/sqlx v1.4.0/go.mod h1:ZrZ7UsYB/weZdl2Bxg6jCRO9c3YHl8r3ahlKmRT4JLY= github.com/jmoiron/sqlx v1.4.0/go.mod h1:ZrZ7UsYB/weZdl2Bxg6jCRO9c3YHl8r3ahlKmRT4JLY=
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= 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/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 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA=
gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= 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 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= 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= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

View File

@ -199,7 +199,7 @@ func (a *App) Diff(c DiffConfigProvider) error {
} }
if c.DetailedExitcode() && (len(allDiffDetectedErrs) > 0 || affectedAny) { 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 // to just let helmfile itself to exit with 2
// See https://github.com/roboll/helmfile/issues/749 // See https://github.com/roboll/helmfile/issues/749
code := 2 code := 2
@ -680,7 +680,7 @@ func (a *App) within(dir string, do func() error) error {
prev, err := a.fs.Getwd() prev, err := a.fs.Getwd()
if err != nil { 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) absDir, err := a.fs.Abs(dir)

View File

@ -15,9 +15,8 @@ import (
"strconv" "strconv"
"strings" "strings"
"github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go-v2/config"
"github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go-v2/service/s3"
"github.com/aws/aws-sdk-go/service/s3"
"github.com/hashicorp/go-getter" "github.com/hashicorp/go-getter"
"github.com/hashicorp/go-getter/helper/url" "github.com/hashicorp/go-getter/helper/url"
"go.uber.org/zap" "go.uber.org/zap"
@ -368,22 +367,22 @@ func (g *S3Getter) Get(wd, src, dst string) error {
return err return err
} }
// Create a new AWS session using the default AWS configuration // Create a new AWS config and S3 client using AWS SDK v2
sess := session.Must(session.NewSessionWithOptions(session.Options{ cfg, err := config.LoadDefaultConfig(context.TODO(),
SharedConfigState: session.SharedConfigEnable, config.WithRegion(region),
Config: aws.Config{ )
Region: aws.String(region), if err != nil {
}, return err
})) }
// Create an S3 client using the session // Create an S3 client using the config
s3Client := s3.New(sess) s3Client := s3.NewFromConfig(cfg)
getObjectInput := &s3.GetObjectInput{ getObjectInput := &s3.GetObjectInput{
Bucket: &bucket, Bucket: &bucket,
Key: &key, Key: &key,
} }
resp, err := s3Client.GetObject(getObjectInput) resp, err := s3Client.GetObject(context.TODO(), getObjectInput)
defer func(Body io.ReadCloser) { defer func(Body io.ReadCloser) {
err := Body.Close() err := Body.Close()
if err != nil { if err != nil {
@ -467,48 +466,47 @@ func (g *S3Getter) S3FileExists(path string) (string, error) {
} }
// Region // Region
g.Logger.Debugf("Creating session for determining S3 region %s", path) g.Logger.Debugf("Creating config for determining S3 region %s", path)
sess := session.Must(session.NewSessionWithOptions(session.Options{ cfg, err := config.LoadDefaultConfig(context.TODO())
SharedConfigState: session.SharedConfigEnable, if err != nil {
})) return "", err
}
g.Logger.Debugf("Getting bucket %s location %s", bucket, path) g.Logger.Debugf("Getting bucket %s location %s", bucket, path)
s3Client := s3.New(sess) s3Client := s3.NewFromConfig(cfg)
bucketRegion := "us-east-1" bucketRegion := "us-east-1"
getBucketLocationInput := &s3.GetBucketLocationInput{ getBucketLocationInput := &s3.GetBucketLocationInput{
Bucket: aws.String(bucket), Bucket: &bucket,
} }
resp, err := s3Client.GetBucketLocation(getBucketLocationInput) resp, err := s3Client.GetBucketLocation(context.TODO(), getBucketLocationInput)
if err != nil { 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") g.Logger.Debugf("Bucket has no location Assuming us-east-1")
} else { } else {
bucketRegion = *resp.LocationConstraint bucketRegion = string(resp.LocationConstraint)
} }
g.Logger.Debugf("Got bucket location %s", bucketRegion) g.Logger.Debugf("Got bucket location %s", bucketRegion)
// File existence // File existence
g.Logger.Debugf("Creating new session with region to see if file exists") g.Logger.Debugf("Creating new config with region to see if file exists")
regionSession, err := session.NewSessionWithOptions(session.Options{ regionCfg, err := config.LoadDefaultConfig(context.TODO(),
SharedConfigState: session.SharedConfigEnable, config.WithRegion(bucketRegion),
Config: aws.Config{ )
Region: aws.String(bucketRegion),
},
})
if err != nil { if err != nil {
g.Logger.Error(err) g.Logger.Error(err)
return bucketRegion, err
} }
g.Logger.Debugf("Creating new s3 client to check if object exists") g.Logger.Debugf("Creating new s3 client to check if object exists")
s3Client = s3.New(regionSession) s3Client = s3.NewFromConfig(regionCfg)
headObjectInput := &s3.HeadObjectInput{ headObjectInput := &s3.HeadObjectInput{
Bucket: &bucket, Bucket: &bucket,
Key: &key, Key: &key,
} }
g.Logger.Debugf("Fethcing head %s", path) g.Logger.Debugf("Fethcing head %s", path)
_, err = s3Client.HeadObject(headObjectInput) _, err = s3Client.HeadObject(context.TODO(), headObjectInput)
return bucketRegion, err return bucketRegion, err
} }