From 07c687500c2a49b786025bed751400e4b1073d1b Mon Sep 17 00:00:00 2001 From: Karl Cardenas Date: Sat, 3 Feb 2024 16:57:32 -0700 Subject: [PATCH] fix: skip alias flag not catching all instances * test: added test for lambda aliases * chore: added test script * fix: fixed alias pagination error * ci: fixed version issue * test: added more test for codecoverage * ci: updated docker dependencies --- .github/workflows/build.yml | 44 +++--- .github/workflows/pull_request.yml | 9 +- .github/workflows/test.yml | 7 +- Dockerfile | 4 +- cmd/clean.go | 42 +++-- cmd/clean_test.go | 239 +++++++++++++++++++++++++++++ cmd/root_test.go | 86 +++++++++++ cmd/version.go | 2 +- go.mod | 78 +++++----- go.sum | 171 ++++++++++++--------- tests/scale_test.sh | 49 ++++++ 11 files changed, 570 insertions(+), 161 deletions(-) create mode 100755 tests/scale_test.sh diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d21635a..fbce629 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,7 +19,7 @@ jobs: steps: - name: "Check out code into the Go module directory" - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Node.js environment uses: actions/setup-node@v3 @@ -49,7 +49,7 @@ jobs: - name: "Check out code into the Go module directory" - uses: actions/checkout@v3 + uses: actions/checkout@v4 - id: go name: "Set up Go 1.21" @@ -61,10 +61,10 @@ jobs: - name: create run: | aws ec2 describe-regions --all-regions --region us-east-1 --query "Regions[].RegionName" --output text >> cmd/aws-regions.txt - go get && go build -ldflags="-X 'github.com/karl-cardenas-coding/go-lambda-cleanup/cmd.VersionString=${{needs.next-version.outputs.version}}'" -o=glc -v && zip go-lambda-cleanup-v${{needs.next-version.outputs.version}}-${{env.GOOS}}-${{env.GOARCH}}.zip glc + go get && go build -ldflags="-X 'github.com/karl-cardenas-coding/go-lambda-cleanup/v2/cmd.VersionString=${{needs.next-version.outputs.version}}'" -o=glc -v && zip go-lambda-cleanup-v${{needs.next-version.outputs.version}}-${{env.GOOS}}-${{env.GOARCH}}.zip glc - - uses: actions/upload-artifact@v1 + - uses: actions/upload-artifact@v4 with: name: go-lambda-cleanup-v${{ needs.next-version.outputs.version }}-${{env.GOOS}}-${{env.GOARCH}}.zip path: go-lambda-cleanup-v${{ needs.next-version.outputs.version }}-${{env.GOOS}}-${{env.GOARCH}}.zip @@ -93,8 +93,8 @@ jobs: name: create run: | aws ec2 describe-regions --all-regions --region us-east-1 --query "Regions[].RegionName" --output text >> cmd/aws-regions.txt - go get && go build -ldflags="-X 'github.com/karl-cardenas-coding/go-lambda-cleanup/cmd.VersionString=${{needs.next-version.outputs.version}}'" -o=glc -v && zip go-lambda-cleanup-v${{needs.next-version.outputs.version}}-${{env.GOOS}}-${{env.GOARCH}}.zip glc - - uses: actions/upload-artifact@v1 + go get && go build -ldflags="-X 'github.com/karl-cardenas-coding/go-lambda-cleanup/v2/cmd.VersionString=${{needs.next-version.outputs.version}}'" -o=glc -v && zip go-lambda-cleanup-v${{needs.next-version.outputs.version}}-${{env.GOOS}}-${{env.GOARCH}}.zip glc + - uses: actions/upload-artifact@v4 with: name: go-lambda-cleanup-v${{ needs.next-version.outputs.version }}-${{env.GOOS}}-${{env.GOARCH}}.zip path: go-lambda-cleanup-v${{ needs.next-version.outputs.version }}-${{env.GOOS}}-${{env.GOARCH}}.zip @@ -110,7 +110,7 @@ jobs: GOOS: linux steps: - name: "Check out code into the Go module directory" - uses: actions/checkout@v3 + uses: actions/checkout@v4 - id: go @@ -123,8 +123,8 @@ jobs: name: create run: | aws ec2 describe-regions --all-regions --region us-east-1 --query "Regions[].RegionName" --output text >> cmd/aws-regions.txt - go get && go build -ldflags="-X 'github.com/karl-cardenas-coding/go-lambda-cleanup/cmd.VersionString=${{needs.next-version.outputs.version}}'" -o=glc -v && zip go-lambda-cleanup-v${{needs.next-version.outputs.version}}-${{env.GOOS}}-${{env.GOARCH}}.zip glc - - uses: actions/upload-artifact@v1 + go get && go build -ldflags="-X 'github.com/karl-cardenas-coding/go-lambda-cleanup/v2/cmd.VersionString=${{needs.next-version.outputs.version}}'" -o=glc -v && zip go-lambda-cleanup-v${{needs.next-version.outputs.version}}-${{env.GOOS}}-${{env.GOARCH}}.zip glc + - uses: actions/upload-artifact@v4 with: name: go-lambda-cleanup-v${{ needs.next-version.outputs.version }}-${{env.GOOS}}-${{env.GOARCH}}.zip path: go-lambda-cleanup-v${{ needs.next-version.outputs.version }}-${{env.GOOS}}-${{env.GOARCH}}.zip @@ -139,7 +139,7 @@ jobs: GOOS: linux steps: - name: "Check out code into the Go module directory" - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Node.js environment uses: actions/setup-node@v3 @@ -157,8 +157,8 @@ jobs: name: create run: | aws ec2 describe-regions --all-regions --region us-east-1 --query "Regions[].RegionName" --output text >> cmd/aws-regions.txt - go get && go build -ldflags="-X 'github.com/karl-cardenas-coding/go-lambda-cleanup/cmd.VersionString=v${{needs.next-version.outputs.version}}'" -o=glc -v && zip go-lambda-cleanup-v${{needs.next-version.outputs.version}}-${{env.GOOS}}-${{env.GOARCH}}.zip glc - - uses: actions/upload-artifact@v1 + go get && go build -ldflags="-X 'github.com/karl-cardenas-coding/go-lambda-cleanup/v2/cmd.VersionString=v${{needs.next-version.outputs.version}}'" -o=glc -v && zip go-lambda-cleanup-v${{needs.next-version.outputs.version}}-${{env.GOOS}}-${{env.GOARCH}}.zip glc + - uses: actions/upload-artifact@v4 with: name: go-lambda-cleanup-v${{needs.next-version.outputs.version}}-${{env.GOOS}}-${{env.GOARCH}}.zip path: go-lambda-cleanup-v${{needs.next-version.outputs.version}}-${{env.GOOS}}-${{env.GOARCH}}.zip @@ -176,7 +176,7 @@ jobs: GOOS: windows steps: - name: "Check out code into the Go module directory" - uses: actions/checkout@v3 + uses: actions/checkout@v4 - id: go name: "Set up Go 1.21" @@ -187,8 +187,8 @@ jobs: - name: create run: | aws ec2 describe-regions --all-regions --region us-east-1 --query "Regions[].RegionName" --output text >> cmd/aws-regions.txt - go get && go build -ldflags="-X 'github.com/karl-cardenas-coding/go-lambda-cleanup/cmd.VersionString=${{needs.next-version.outputs.version}}'" -o=glc.exe -v && zip go-lambda-cleanup-v${{needs.next-version.outputs.version}}-${{env.GOOS}}-${{env.GOARCH}}.zip glc.exe - - uses: actions/upload-artifact@v1 + go get && go build -ldflags="-X 'github.com/karl-cardenas-coding/go-lambda-cleanup/v2/cmd.VersionString=${{needs.next-version.outputs.version}}'" -o=glc.exe -v && zip go-lambda-cleanup-v${{needs.next-version.outputs.version}}-${{env.GOOS}}-${{env.GOARCH}}.zip glc.exe + - uses: actions/upload-artifact@v4 with: name: go-lambda-cleanup-v${{needs.next-version.outputs.version}}-${{env.GOOS}}-${{env.GOARCH}}.zip path: go-lambda-cleanup-v${{needs.next-version.outputs.version}}-${{env.GOOS}}-${{env.GOARCH}}.zip @@ -211,7 +211,7 @@ jobs: - name: Check out code into the Go module directory - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Generate AWS region file @@ -254,7 +254,7 @@ jobs: VERSION: ${{ needs.next-version.outputs.version != ''}} steps: - name: Check out code into the Go module directory - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Node.js environment @@ -263,29 +263,29 @@ jobs: node-version: '18' cache: 'npm' - - uses: actions/download-artifact@v1 + - uses: actions/download-artifact@v4 with: name: go-lambda-cleanup-v${{ needs.next-version.outputs.version }}-darwin-amd64.zip path: ./ - - uses: actions/download-artifact@v1 + - uses: actions/download-artifact@v4 with: name: go-lambda-cleanup-v${{ needs.next-version.outputs.version }}-linux-386.zip path: ./ - - uses: actions/download-artifact@v1 + - uses: actions/download-artifact@v4 with: name: go-lambda-cleanup-v${{ needs.next-version.outputs.version }}-darwin-arm64.zip path: ./ - - uses: actions/download-artifact@v1 + - uses: actions/download-artifact@v4 with: name: go-lambda-cleanup-v${{ needs.next-version.outputs.version }}-linux-amd64.zip path: ./ - - uses: actions/download-artifact@v1 + - uses: actions/download-artifact@v4 with: name: go-lambda-cleanup-v${{ needs.next-version.outputs.version }}-windows-amd64.zip path: ./ diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 359e13a..a59765a 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -4,9 +4,6 @@ on: pull_request: types: [opened, synchronize, reopened, ready_for_review] branches: [ main ] -env: - GITHUB_TOKEN: ${{ github.token }} - LINT_VERSION: "1.25.1" permissions: contents: read @@ -28,8 +25,6 @@ jobs: test: needs: [run-ci] - outputs: - VERSION: ${{ steps.go.outputs.version }} name: Test runs-on: ubuntu-latest steps: @@ -79,7 +74,7 @@ jobs: AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} run: | echo "--------------------------------------------------" - go build -ldflags="-X 'github.com/karl-cardenas-coding/go-lambda-cleanup/cmd.VersionString=0.0.0'" -o=glc -v + go build -ldflags="-X 'github.com/karl-cardenas-coding/go-lambda-cleanup/v2/cmd.VersionString=0.0.0'" -o=glc -v ./glc clean -r us-west-2 @@ -102,7 +97,7 @@ jobs: uses: docker/build-push-action@v4 with: context: . - build-args: VERSION=${{steps.dependencies.outputs.VERSION}} + build-args: VERSION="99.99.99" platforms: linux/amd64,linux/arm64 push: true tags: ghcr.io/${{ github.repository }}:test \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6cf2b16..85470e1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -3,9 +3,6 @@ name: Branch Tests on: push: branches-ignore: [ main ] -env: - GITHUB_TOKEN: ${{ github.token }} - LINT_VERSION: "1.25.1" jobs: @@ -22,7 +19,7 @@ jobs: id: go - name: Check out code into the Go module directory - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Generate AWS region file env: @@ -53,5 +50,5 @@ jobs: AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} run: | echo "--------------------------------------------------" - go build -ldflags="-X 'github.com/karl-cardenas-coding/go-lambda-cleanup/cmd.VersionString=0.0.0'" -o=glc -v + go build -ldflags="-X 'github.com/karl-cardenas-coding/go-lambda-cleanup/v2/cmd.VersionString=0.0.0'" -o=glc -v ./glc clean -r us-west-2 \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index b26acc1..3145722 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ # Copyright (c) karl-cardenas-coding # SPDX-License-Identifier: MIT -FROM golang:1.21.4-alpine3.18 as builder +FROM golang:1.21.6-alpine3.19 as builder LABEL org.opencontainers.image.source="http://github.com/karl-cardenas-coding/go-lambda-cleanup" LABEL org.opencontainers.image.description "A solution for removing previous versions of AWS Lambdas" @@ -11,7 +11,7 @@ ARG VERSION ADD ./ /source RUN cd /source && \ adduser -H -u 1002 -D appuser appuser && \ -go build -ldflags="-X 'github.com/karl-cardenas-coding/go-lambda-cleanup/cmd.VersionString=${VERSION}'" -o glc -v +go build -ldflags="-X 'github.com/karl-cardenas-coding/go-lambda-cleanup/v2/cmd.VersionString=${VERSION}'" -o glc -v FROM alpine:latest diff --git a/cmd/clean.go b/cmd/clean.go index 80d13c7..dcc37fb 100644 --- a/cmd/clean.go +++ b/cmd/clean.go @@ -263,13 +263,17 @@ func executeClean(ctx context.Context, config *cliConfig, svc *lambda.Client, cu updatedCounter = updatedCounter + v } - log.Info("Total space freed up: ", (calculateFileSize(uint64(counter-updatedCounter), config))) - log.Info("Post clean-up storage size: ", calculateFileSize(uint64(updatedCounter), config)) - log.Info("*********************************************") - } + if len(lambdaList) == 0 { + log.Info("No lambdas found in ", *config.RegionFlag) + } else { + + log.Info("Total versions removed: ", countDeleteVersions(globalLambdaDeleteInputStructs)) + log.Info("Total space freed up: ", (calculateFileSize(uint64(counter-updatedCounter), config))) + log.Info("Post clean-up storage size: ", calculateFileSize(uint64(updatedCounter), config)) + log.Info("*********************************************") + + } - if len(lambdaList) == 0 { - log.Info("No lambdas found in ", *config.RegionFlag) } displayDuration(startTime) @@ -381,7 +385,7 @@ func deleteLambdaVersion(ctx context.Context, svc *lambda.Client, deleteList ... defer wg.Done() _, err := svc.DeleteFunction(ctx, &version) if err != nil { - log.Error(err) + err = errors.New("Failed to delete version " + *version.Qualifier + " of " + *version.FunctionName + ". \n Additional details: " + err.Error()) returnError = err } }() @@ -493,25 +497,31 @@ func getAllLambdaVersion( if *flags.SkipAliases { // fetch the list of aliases for this function - aliasesOut, err := svc.ListAliases(ctx, &lambda.ListAliasesInput{ + + pg := lambda.NewListAliasesPaginator(svc, &lambda.ListAliasesInput{ FunctionName: aws.String(*item.FunctionArn), + MaxItems: aws.Int32(maxItems), }) - if err != nil { - log.Error(err) - return lambdasLisOutput, err + + var aliasesOut []types.AliasConfiguration + for pg.HasMorePages() { + page, err := pg.NextPage(ctx) + if err != nil { + log.Error(err) + return lambdasLisOutput, err + } + aliasesOut = append(aliasesOut, page.Aliases...) } + log.Debug(fmt.Sprintf("Lamba function %s has %d aliases \n", *item.FunctionName, len(aliasesOut))) + // produce a new slice that includes only versions for which there is no alias var result []types.FunctionConfiguration - // iterate over the list of versions and check if there is an alias for each - // if there is no alias, add the version to the result - // if there is an alias, skip the version - // this is done to avoid deleting versions that are in use by an alias for _, funConf := range lambdasLisOutput { isAlias := false - for _, alias := range aliasesOut.Aliases { + for _, alias := range aliasesOut { if alias.FunctionVersion != nil && *alias.FunctionVersion == *funConf.Version { isAlias = true break diff --git a/cmd/clean_test.go b/cmd/clean_test.go index 7891c57..658effa 100644 --- a/cmd/clean_test.go +++ b/cmd/clean_test.go @@ -639,6 +639,120 @@ func TestGetAllLambdas(t *testing.T) { } +func TestGetAllLambdasAlias(t *testing.T) { + + ctx := context.Background() + networkName := "localstack-network-v2" + + localstackContainer, err := localstack.RunContainer(ctx, + localstack.WithNetwork(networkName, "localstack"), + testcontainers.CustomizeRequest(testcontainers.GenericContainerRequest{ + ContainerRequest: testcontainers.ContainerRequest{ + Image: "localstack/localstack:latest", + Env: map[string]string{"SERVICES": "lambda"}, + }, + }), + ) + if err != nil { + panic(err) + } + + // Clean up the container + defer func() { + if err := localstackContainer.Terminate(ctx); err != nil { + panic(err) + } + }() + + svc, err := getAWSCredentials(ctx, localstackContainer) + if err != nil { + panic(err) + } + + GlobalCliConfig = cliConfig{ + RegionFlag: aws.String("us-east-1"), + CredentialsFile: aws.Bool(false), + ProfileFlag: aws.String(""), + DryRun: aws.Bool(true), + Verbose: aws.Bool(true), + LambdaListFile: aws.String(""), + MoreLambdaDetails: aws.Bool(true), + SizeIEC: aws.Bool(false), + SkipAliases: aws.Bool(true), + Retain: aws.Int8(0), + } + + bf, err := getZipPackage("../tests/handler.zip") + if err != nil { + t.Logf("expected no error to be returned but received %v", err) + } + + _, err = addFunctions(ctx, svc, bf) + if err != nil { + panic(err) + } + + bf2, err := getZipPackage("../tests/handler2.zip") + if err != nil { + t.Logf("expected no error to be returned but received %v", err) + } + + _, err = updateFunctions(ctx, svc, *bf2) + if err != nil { + t.Logf("expected no error to be returned but received %v", err) + } + + _, err = publishAlias(ctx, svc, "func1", "DEMO", "2") + if err != nil { + t.Errorf("expected no error to be returned but received %v", err) + } + + count, aliases, err := listFunctionAliases(ctx, svc, "func1", "2") + if err != nil { + t.Errorf("expected no error to be returned but received %v", err) + } + + if count != 1 { + t.Log(aliases) + t.Errorf("expected 1 alias to be returned but received %v", count) + } + + t.Logf("func1 has the following alias: %v", aliases) + + lambdaListResult, err := getAllLambdaVersion(ctx, svc, types.FunctionConfiguration{ + FunctionName: aws.String("func1"), + FunctionArn: aws.String("arn:aws:lambda:us-east-1:000000000000:function:func1"), + }, GlobalCliConfig) + if err != nil { + t.Errorf("expected no error to be returned but received %v", err) + } + + for _, v := range lambdaListResult { + t.Log("Name: ", *v.FunctionName, "Version: ", *v.Version) + } + + if len(lambdaListResult) != 2 { + t.Errorf("expected 2 versions to be returned but received %v", len(lambdaListResult)) + } + + t.Cleanup(func() { + GlobalCliConfig = cliConfig{ + RegionFlag: aws.String(""), + CredentialsFile: aws.Bool(false), + ProfileFlag: aws.String(""), + DryRun: aws.Bool(true), + Verbose: aws.Bool(true), + LambdaListFile: aws.String(""), + MoreLambdaDetails: aws.Bool(true), + SizeIEC: aws.Bool(false), + SkipAliases: aws.Bool(false), + Retain: aws.Int8(0), + } + + }) + +} + func TestGetAllLambdaVersion(t *testing.T) { ctx := context.Background() @@ -730,6 +844,112 @@ func TestGetAllLambdaVersion(t *testing.T) { }) } +func TestGetAllLambdaVersionWithAliasError(t *testing.T) { + + ctx := context.Background() + networkName := "localstack-network-v2" + + localstackContainer, err := localstack.RunContainer(ctx, + localstack.WithNetwork(networkName, "localstack"), + testcontainers.CustomizeRequest(testcontainers.GenericContainerRequest{ + ContainerRequest: testcontainers.ContainerRequest{ + Image: "localstack/localstack:latest", + Env: map[string]string{"SERVICES": "lambda"}, + }, + }), + ) + if err != nil { + panic(err) + } + + // Clean up the container + defer func() { + if err := localstackContainer.Terminate(ctx); err != nil { + panic(err) + } + }() + + svc, err := getAWSCredentials(ctx, localstackContainer) + if err != nil { + panic(err) + } + + GlobalCliConfig = cliConfig{ + RegionFlag: aws.String("us-east-1"), + CredentialsFile: aws.Bool(false), + ProfileFlag: aws.String(""), + DryRun: aws.Bool(true), + Verbose: aws.Bool(true), + LambdaListFile: aws.String(""), + MoreLambdaDetails: aws.Bool(true), + SizeIEC: aws.Bool(false), + SkipAliases: aws.Bool(true), + Retain: aws.Int8(0), + } + + bf, err := getZipPackage("../tests/handler.zip") + if err != nil { + t.Logf("expected no error to be returned but received %v", err) + } + + _, err = addFunctions(ctx, svc, bf) + if err != nil { + panic(err) + } + + bf2, err := getZipPackage("../tests/handler2.zip") + if err != nil { + t.Logf("expected no error to be returned but received %v", err) + } + + _, err = updateFunctions(ctx, svc, *bf2) + if err != nil { + t.Logf("expected no error to be returned but received %v", err) + } + + _, err = publishAlias(ctx, svc, "func1", "DEMO", "2") + if err != nil { + t.Errorf("expected no error to be returned but received %v", err) + } + + versions, err := getAllLambdaVersion(ctx, svc, types.FunctionConfiguration{ + FunctionName: aws.String("func1"), + FunctionArn: aws.String("arn:aws:lambda:us-east-1:000000000000:function:func1"), + }, GlobalCliConfig) + if err != nil { + t.Errorf("expected no error to be returned but received %v", err) + } + + if len(versions) != 2 { + t.Errorf("expected 2 versions to be returned but received %v", len(versions)) + } + + _, err = getAllLambdaVersion(ctx, svc, types.FunctionConfiguration{ + FunctionName: aws.String("func22"), + FunctionArn: aws.String("arn:aws:lambda:us-east-1:000000000000:function:func22"), + }, GlobalCliConfig) + if err == nil { + t.Errorf("expected an error to be returned but received %v", err) + } + + t.Cleanup(func() { + GlobalCliConfig = cliConfig{ + RegionFlag: aws.String(""), + CredentialsFile: aws.Bool(false), + ProfileFlag: aws.String(""), + DryRun: aws.Bool(true), + Verbose: aws.Bool(true), + LambdaListFile: aws.String(""), + MoreLambdaDetails: aws.Bool(true), + SizeIEC: aws.Bool(false), + SkipAliases: aws.Bool(false), + Retain: aws.Int8(0), + } + + }) + +} + func TestGetAllLambdaVersionWithAlias(t *testing.T) { ctx := context.Background() @@ -1809,3 +2029,22 @@ func listFunctionVersions(ctx context.Context, svc *lambda.Client, funcName stri return len(output.Versions), nil } + +func listFunctionAliases(ctx context.Context, svc *lambda.Client, funcName, funcVersion string) (int, []string, error) { + + output, err := svc.ListAliases(ctx, &lambda.ListAliasesInput{ + FunctionName: aws.String(funcName), + FunctionVersion: aws.String(funcVersion), + }) + + if err != nil { + return 0, []string{}, nil + } + + var aliases []string + for _, alias := range output.Aliases { + aliases = append(aliases, *alias.Name) + } + + return len(output.Aliases), aliases, nil +} diff --git a/cmd/root_test.go b/cmd/root_test.go index ed3c168..97306ed 100644 --- a/cmd/root_test.go +++ b/cmd/root_test.go @@ -295,3 +295,89 @@ func TestRootExecute(t *testing.T) { }) } + +func TestNoLambdas(t *testing.T) { + ctx := context.TODO() + networkName := "localstack-network-v2" + + localstackContainer, err := localstack.RunContainer(ctx, + localstack.WithNetwork(networkName, "localstack"), + testcontainers.CustomizeRequest(testcontainers.GenericContainerRequest{ + ContainerRequest: testcontainers.ContainerRequest{ + Image: "localstack/localstack:latest", + Env: map[string]string{"SERVICES": "lambda"}, + }, + }), + ) + if err != nil { + panic(err) + } + + // Clean up the container + defer func() { + if err := localstackContainer.Terminate(ctx); err != nil { + panic(err) + } + }() + + provider, err := testcontainers.NewDockerProvider() + if err != nil { + panic(err) + } + + host, err := provider.DaemonHost(ctx) + if err != nil { + panic(err) + } + + mappedPort, err := localstackContainer.MappedPort(ctx, nat.Port("4566/tcp")) + if err != nil { + panic(err) + } + + // svc, err := getAWSCredentials(ctx, localstackContainer) + // if err != nil { + // panic(err) + // } + + GlobalCliConfig = cliConfig{ + RegionFlag: aws.String("us-east-1"), + CredentialsFile: aws.Bool(false), + ProfileFlag: aws.String(""), + DryRun: aws.Bool(true), + Verbose: aws.Bool(false), + LambdaListFile: aws.String(""), + MoreLambdaDetails: aws.Bool(true), + SizeIEC: aws.Bool(false), + SkipAliases: aws.Bool(false), + Retain: aws.Int8(0), + } + + os.Setenv("AWS_ENDPOINT_URL", fmt.Sprintf("http://%s:%d", host, mappedPort.Int())) + os.Setenv("AWS_EC2_METADATA_DISABLED", "true") + os.Setenv("AWS_ACCESS_KEY_ID", "test") + os.Setenv("AWS_SECRET_ACCESS_KEY", "test") + + Execute() + + t.Cleanup(func() { + GlobalCliConfig = cliConfig{ + RegionFlag: aws.String(""), + CredentialsFile: aws.Bool(false), + ProfileFlag: aws.String(""), + DryRun: aws.Bool(true), + Verbose: aws.Bool(true), + LambdaListFile: aws.String(""), + MoreLambdaDetails: aws.Bool(true), + SizeIEC: aws.Bool(false), + SkipAliases: aws.Bool(false), + Retain: aws.Int8(2), + } + + os.Unsetenv("AWS_ENDPOINT_URL") + os.Unsetenv("AWS_EC2_METADATA_DISABLED") + os.Unsetenv("AWS_ACCESS_KEY_ID") + os.Unsetenv("AWS_SECRET_ACCESS_KEY") + + }) +} diff --git a/cmd/version.go b/cmd/version.go index 7fa741d..178427d 100644 --- a/cmd/version.go +++ b/cmd/version.go @@ -26,7 +26,7 @@ var VersionCmd = &cobra.Command{ Short: "Print the current version number of go-lambda-cleanup", Long: `Prints the current version number of go-lambda-cleanup`, RunE: func(cmd *cobra.Command, args []string) error { - version := fmt.Sprintf("go-lambda-cleanup v%s", VersionString) + version := fmt.Sprintf("go-lambda-cleanup %s", VersionString) log.Info(version) _, message, err := checkForNewRelease(GlobalHTTPClient, VersionString, UserAgent, url) if err != nil { diff --git a/go.mod b/go.mod index 55923a8..b3934eb 100644 --- a/go.mod +++ b/go.mod @@ -3,17 +3,17 @@ module github.com/karl-cardenas-coding/go-lambda-cleanup/v2 go 1.21 require ( - github.com/aws/aws-sdk-go-v2 v1.23.1 - github.com/aws/aws-sdk-go-v2/config v1.25.5 - github.com/aws/aws-sdk-go-v2/credentials v1.16.4 - github.com/aws/aws-sdk-go-v2/service/lambda v1.48.1 - github.com/docker/go-connections v0.4.0 + github.com/aws/aws-sdk-go-v2 v1.24.1 + github.com/aws/aws-sdk-go-v2/config v1.26.6 + github.com/aws/aws-sdk-go-v2/credentials v1.16.16 + github.com/aws/aws-sdk-go-v2/service/lambda v1.49.7 + github.com/docker/go-connections v0.5.0 github.com/dustin/go-humanize v1.0.1 github.com/hashicorp/go-version v1.6.0 github.com/sirupsen/logrus v1.9.3 github.com/spf13/cobra v1.8.0 - github.com/testcontainers/testcontainers-go v0.26.0 - github.com/testcontainers/testcontainers-go/modules/localstack v0.26.0 + github.com/testcontainers/testcontainers-go v0.27.0 + github.com/testcontainers/testcontainers-go/modules/localstack v0.27.0 gopkg.in/yaml.v2 v2.4.0 ) @@ -22,56 +22,62 @@ require ( github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect github.com/Microsoft/go-winio v0.6.1 // indirect github.com/Microsoft/hcsshim v0.11.4 // indirect - github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.5.1 // indirect - github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.14.5 // indirect - github.com/aws/aws-sdk-go-v2/internal/configsources v1.2.4 // indirect - github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.5.4 // indirect - github.com/aws/aws-sdk-go-v2/internal/ini v1.7.1 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.10.1 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.10.4 // indirect - github.com/aws/aws-sdk-go-v2/service/sso v1.17.3 // indirect - github.com/aws/aws-sdk-go-v2/service/ssooidc v1.20.1 // indirect - github.com/aws/aws-sdk-go-v2/service/sts v1.25.4 // indirect - github.com/aws/smithy-go v1.17.0 // indirect + github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.5.4 // indirect + github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.14.11 // indirect + github.com/aws/aws-sdk-go-v2/internal/configsources v1.2.10 // indirect + github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.5.10 // indirect + github.com/aws/aws-sdk-go-v2/internal/ini v1.7.3 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.10.4 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.10.10 // indirect + github.com/aws/aws-sdk-go-v2/service/sso v1.18.7 // indirect + github.com/aws/aws-sdk-go-v2/service/ssooidc v1.21.7 // indirect + github.com/aws/aws-sdk-go-v2/service/sts v1.26.7 // indirect + github.com/aws/smithy-go v1.19.0 // indirect github.com/cenkalti/backoff/v4 v4.2.1 // indirect - github.com/containerd/containerd v1.7.9 // indirect + github.com/containerd/containerd v1.7.13 // indirect github.com/containerd/log v0.1.0 // indirect github.com/cpuguy83/dockercfg v0.3.1 // indirect github.com/distribution/reference v0.5.0 // indirect - github.com/docker/distribution v2.8.3+incompatible // indirect - github.com/docker/docker v24.0.7+incompatible // indirect + github.com/docker/docker v25.0.2+incompatible // indirect github.com/docker/go-units v0.5.0 // indirect + github.com/felixge/httpsnoop v1.0.4 // indirect + github.com/go-logr/logr v1.4.1 // indirect + github.com/go-logr/stdr v1.2.2 // indirect github.com/go-ole/go-ole v1.3.0 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/protobuf v1.5.3 // indirect - github.com/google/uuid v1.4.0 // indirect + github.com/google/uuid v1.6.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect - github.com/klauspost/compress v1.17.3 // indirect + github.com/klauspost/compress v1.17.5 // indirect github.com/kr/text v0.2.0 // indirect github.com/lufia/plan9stats v0.0.0-20231016141302-07b5767bb0ed // indirect github.com/magiconair/properties v1.8.7 // indirect github.com/moby/patternmatcher v0.6.0 // indirect github.com/moby/sys/sequential v0.5.0 // indirect + github.com/moby/sys/user v0.1.0 // indirect github.com/moby/term v0.5.0 // indirect github.com/morikuni/aec v1.0.0 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect - github.com/opencontainers/image-spec v1.1.0-rc5 // indirect - github.com/opencontainers/runc v1.1.10 // indirect + github.com/opencontainers/image-spec v1.1.0-rc6 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/power-devops/perfstat v0.0.0-20221212215047-62379fc7944b // indirect - github.com/shirou/gopsutil/v3 v3.23.10 // indirect + github.com/shirou/gopsutil/v3 v3.24.1 // indirect github.com/shoenig/go-m1cpu v0.1.6 // indirect github.com/spf13/pflag v1.0.5 // indirect - github.com/tklauser/go-sysconf v0.3.12 // indirect - github.com/tklauser/numcpus v0.6.1 // indirect - github.com/yusufpapurcu/wmi v1.2.3 // indirect - golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa // indirect + github.com/tklauser/go-sysconf v0.3.13 // indirect + github.com/tklauser/numcpus v0.7.0 // indirect + github.com/yusufpapurcu/wmi v1.2.4 // indirect + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0 // indirect + go.opentelemetry.io/otel v1.22.0 // indirect + go.opentelemetry.io/otel/metric v1.22.0 // indirect + go.opentelemetry.io/otel/trace v1.22.0 // indirect + golang.org/x/exp v0.0.0-20240119083558-1b970713d09a // indirect golang.org/x/mod v0.14.0 // indirect - golang.org/x/net v0.18.0 // indirect - golang.org/x/sys v0.14.0 // indirect - golang.org/x/tools v0.15.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f // indirect - google.golang.org/grpc v1.59.0 // indirect - google.golang.org/protobuf v1.31.0 // indirect + golang.org/x/sys v0.16.0 // indirect + golang.org/x/tools v0.17.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240125205218-1f4bbc51befe // indirect + google.golang.org/grpc v1.61.0 // indirect + google.golang.org/protobuf v1.32.0 // indirect ) diff --git a/go.sum b/go.sum index 1ed3833..de881fd 100644 --- a/go.sum +++ b/go.sum @@ -8,40 +8,40 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/Microsoft/hcsshim v0.11.4 h1:68vKo2VN8DE9AdN4tnkWnmdhqdbpUFM8OF3Airm7fz8= github.com/Microsoft/hcsshim v0.11.4/go.mod h1:smjE4dvqPX9Zldna+t5FG3rnoHhaB7QYxPRqGcpAD9w= -github.com/aws/aws-sdk-go-v2 v1.23.1 h1:qXaFsOOMA+HsZtX8WoCa+gJnbyW7qyFFBlPqvTSzbaI= -github.com/aws/aws-sdk-go-v2 v1.23.1/go.mod h1:i1XDttT4rnf6vxc9AuskLc6s7XBee8rlLilKlc03uAA= -github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.5.1 h1:ZY3108YtBNq96jNZTICHxN1gSBSbnvIdYwwqnvCV4Mc= -github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.5.1/go.mod h1:t8PYl/6LzdAqsU4/9tz28V/kU+asFePvpOMkdul0gEQ= -github.com/aws/aws-sdk-go-v2/config v1.25.5 h1:UGKm9hpQS2hoK8CEJ1BzAW8NbUpvwDJJ4lyqXSzu8bk= -github.com/aws/aws-sdk-go-v2/config v1.25.5/go.mod h1:Bf4gDvy4ZcFIK0rqDu1wp9wrubNba2DojiPB2rt6nvI= -github.com/aws/aws-sdk-go-v2/credentials v1.16.4 h1:i7UQYYDSJrtc30RSwJwfBKwLFNnBTiICqAJ0pPdum8E= -github.com/aws/aws-sdk-go-v2/credentials v1.16.4/go.mod h1:Kdh/okh+//vQ/AjEt81CjvkTo64+/zIE4OewP7RpfXk= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.14.5 h1:KehRNiVzIfAcj6gw98zotVbb/K67taJE0fkfgM6vzqU= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.14.5/go.mod h1:VhnExhw6uXy9QzetvpXDolo1/hjhx4u9qukBGkuUwjs= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.2.4 h1:LAm3Ycm9HJfbSCd5I+wqC2S9Ej7FPrgr5CQoOljJZcE= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.2.4/go.mod h1:xEhvbJcyUf/31yfGSQBe01fukXwXJ0gxDp7rLfymWE0= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.5.4 h1:4GV0kKZzUxiWxSVpn/9gwR0g21NF1Jsyduzo9rHgC/Q= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.5.4/go.mod h1:dYvTNAggxDZy6y1AF7YDwXsPuHFy/VNEpEI/2dWK9IU= -github.com/aws/aws-sdk-go-v2/internal/ini v1.7.1 h1:uR9lXYjdPX0xY+NhvaJ4dD8rpSRz5VY81ccIIoNG+lw= -github.com/aws/aws-sdk-go-v2/internal/ini v1.7.1/go.mod h1:6fQQgfuGmw8Al/3M2IgIllycxV7ZW7WCdVSqfBeUiCY= -github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.10.1 h1:rpkF4n0CyFcrJUG/rNNohoTmhtWlFTRI4BsZOh9PvLs= -github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.10.1/go.mod h1:l9ymW25HOqymeU2m1gbUQ3rUIsTwKs8gYHXkqDQUhiI= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.10.4 h1:rdovz3rEu0vZKbzoMYPTehp0E8veoE9AyfzqCr5Eeao= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.10.4/go.mod h1:aYCGNjyUCUelhofxlZyj63srdxWUSsBSGg5l6MCuXuE= -github.com/aws/aws-sdk-go-v2/service/lambda v1.48.1 h1:xVOzP4rFi0kMXUQozqInP+Yy6zldr8WTpHeVEqxMtOY= -github.com/aws/aws-sdk-go-v2/service/lambda v1.48.1/go.mod h1:7dj5Kak6A6QOeZxUgIDUWVG5+7upeEBY1ivtFDRLxSQ= -github.com/aws/aws-sdk-go-v2/service/sso v1.17.3 h1:CdsSOGlFF3Pn+koXOIpTtvX7st0IuGsZ8kJqcWMlX54= -github.com/aws/aws-sdk-go-v2/service/sso v1.17.3/go.mod h1:oA6VjNsLll2eVuUoF2D+CMyORgNzPEW/3PyUdq6WQjI= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.20.1 h1:cbRqFTVnJV+KRpwFl76GJdIZJKKCdTPnjUZ7uWh3pIU= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.20.1/go.mod h1:hHL974p5auvXlZPIjJTblXJpbkfK4klBczlsEaMCGVY= -github.com/aws/aws-sdk-go-v2/service/sts v1.25.4 h1:yEvZ4neOQ/KpUqyR+X0ycUTW/kVRNR4nDZ38wStHGAA= -github.com/aws/aws-sdk-go-v2/service/sts v1.25.4/go.mod h1:feTnm2Tk/pJxdX+eooEsxvlvTWBvDm6CasRZ+JOs2IY= -github.com/aws/smithy-go v1.17.0 h1:wWJD7LX6PBV6etBUwO0zElG0nWN9rUhp0WdYeHSHAaI= -github.com/aws/smithy-go v1.17.0/go.mod h1:NukqUGpCZIILqqiV0NIjeFh24kd/FAa4beRb6nbIUPE= +github.com/aws/aws-sdk-go-v2 v1.24.1 h1:xAojnj+ktS95YZlDf0zxWBkbFtymPeDP+rvUQIH3uAU= +github.com/aws/aws-sdk-go-v2 v1.24.1/go.mod h1:LNh45Br1YAkEKaAqvmE1m8FUx6a5b/V0oAKV7of29b4= +github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.5.4 h1:OCs21ST2LrepDfD3lwlQiOqIGp6JiEUqG84GzTDoyJs= +github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.5.4/go.mod h1:usURWEKSNNAcAZuzRn/9ZYPT8aZQkR7xcCtunK/LkJo= +github.com/aws/aws-sdk-go-v2/config v1.26.6 h1:Z/7w9bUqlRI0FFQpetVuFYEsjzE3h7fpU6HuGmfPL/o= +github.com/aws/aws-sdk-go-v2/config v1.26.6/go.mod h1:uKU6cnDmYCvJ+pxO9S4cWDb2yWWIH5hra+32hVh1MI4= +github.com/aws/aws-sdk-go-v2/credentials v1.16.16 h1:8q6Rliyv0aUFAVtzaldUEcS+T5gbadPbWdV1WcAddK8= +github.com/aws/aws-sdk-go-v2/credentials v1.16.16/go.mod h1:UHVZrdUsv63hPXFo1H7c5fEneoVo9UXiz36QG1GEPi0= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.14.11 h1:c5I5iH+DZcH3xOIMlz3/tCKJDaHFwYEmxvlh2fAcFo8= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.14.11/go.mod h1:cRrYDYAMUohBJUtUnOhydaMHtiK/1NZ0Otc9lIb6O0Y= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.2.10 h1:vF+Zgd9s+H4vOXd5BMaPWykta2a6Ih0AKLq/X6NYKn4= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.2.10/go.mod h1:6BkRjejp/GR4411UGqkX8+wFMbFbqsUIimfK4XjOKR4= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.5.10 h1:nYPe006ktcqUji8S2mqXf9c/7NdiKriOwMvWQHgYztw= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.5.10/go.mod h1:6UV4SZkVvmODfXKql4LCbaZUpF7HO2BX38FgBf9ZOLw= +github.com/aws/aws-sdk-go-v2/internal/ini v1.7.3 h1:n3GDfwqF2tzEkXlv5cuy4iy7LpKDtqDMcNLfZDu9rls= +github.com/aws/aws-sdk-go-v2/internal/ini v1.7.3/go.mod h1:6fQQgfuGmw8Al/3M2IgIllycxV7ZW7WCdVSqfBeUiCY= +github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.10.4 h1:/b31bi3YVNlkzkBrm9LfpaKoaYZUxIAj4sHfOTmLfqw= +github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.10.4/go.mod h1:2aGXHFmbInwgP9ZfpmdIfOELL79zhdNYNmReK8qDfdQ= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.10.10 h1:DBYTXwIGQSGs9w4jKm60F5dmCQ3EEruxdc0MFh+3EY4= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.10.10/go.mod h1:wohMUQiFdzo0NtxbBg0mSRGZ4vL3n0dKjLTINdcIino= +github.com/aws/aws-sdk-go-v2/service/lambda v1.49.7 h1:YCvhGwdiZ9tKTjoIOE8jLt+3JBK4quAQyhoMCWtxhQc= +github.com/aws/aws-sdk-go-v2/service/lambda v1.49.7/go.mod h1:xqjYGK1M7YTmyfZBW8LVAx7QnefUb/mE5BglUnxtx6E= +github.com/aws/aws-sdk-go-v2/service/sso v1.18.7 h1:eajuO3nykDPdYicLlP3AGgOyVN3MOlFmZv7WGTuJPow= +github.com/aws/aws-sdk-go-v2/service/sso v1.18.7/go.mod h1:+mJNDdF+qiUlNKNC3fxn74WWNN+sOiGOEImje+3ScPM= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.21.7 h1:QPMJf+Jw8E1l7zqhZmMlFw6w1NmfkfiSK8mS4zOx3BA= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.21.7/go.mod h1:ykf3COxYI0UJmxcfcxcVuz7b6uADi1FkiUz6Eb7AgM8= +github.com/aws/aws-sdk-go-v2/service/sts v1.26.7 h1:NzO4Vrau795RkUdSHKEwiR01FaGzGOH1EETJ+5QHnm0= +github.com/aws/aws-sdk-go-v2/service/sts v1.26.7/go.mod h1:6h2YuIoxaMSCFf5fi1EgZAwdfkGMgDY+DVfa61uLe4U= +github.com/aws/smithy-go v1.19.0 h1:KWFKQV80DpP3vJrrA9sVAHQ5gc2z8i4EzrLhLlWXcBM= +github.com/aws/smithy-go v1.19.0/go.mod h1:NukqUGpCZIILqqiV0NIjeFh24kd/FAa4beRb6nbIUPE= github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM= github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= -github.com/containerd/containerd v1.7.9 h1:KOhK01szQbM80YfW1H6RZKh85PHGqY/9OcEZ35Je8sc= -github.com/containerd/containerd v1.7.9/go.mod h1:0/W44LWEYfSHoxBtsHIiNU/duEkgpMokemafHVCpq9Y= +github.com/containerd/containerd v1.7.13 h1:wPYKIeGMN8vaggSKuV1X0wZulpMz4CrgEsZdaCyB6Is= +github.com/containerd/containerd v1.7.13/go.mod h1:zT3up6yTRfEUa6+GsITYIJNgSVL9NQ4x4h1RPzk0Wu4= github.com/containerd/log v0.1.0 h1:TCJt7ioM2cr/tfR8GPbGf9/VRAX8D2B4PjzCpfX540I= github.com/containerd/log v0.1.0/go.mod h1:VRRf09a7mHDIRezVKTRCrOq78v577GXq3bSa3EhrzVo= github.com/cpuguy83/dockercfg v0.3.1 h1:/FpZ+JaygUR/lZP2NlFI2DVfrOEMAIKP5wWEJdoYe9E= @@ -55,16 +55,21 @@ 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/distribution/reference v0.5.0 h1:/FUIFXtfc/x2gpa5/VGfiGLuOIdYa1t65IKK2OFGvA0= github.com/distribution/reference v0.5.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E= -github.com/docker/distribution v2.8.3+incompatible h1:AtKxIZ36LoNK51+Z6RpzLpddBirtxJnzDrHLEKxTAYk= -github.com/docker/distribution v2.8.3+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= -github.com/docker/docker v24.0.7+incompatible h1:Wo6l37AuwP3JaMnZa226lzVXGA3F9Ig1seQen0cKYlM= -github.com/docker/docker v24.0.7+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= -github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= -github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= +github.com/docker/docker v25.0.2+incompatible h1:/OaKeauroa10K4Nqavw4zlhcDq/WBcPMc5DbjOGgozY= +github.com/docker/docker v25.0.2+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/go-connections v0.5.0 h1:USnMq7hx7gwdVZq1L49hLXaFtUdTADjXGp+uj1Br63c= +github.com/docker/go-connections v0.5.0/go.mod h1:ov60Kzw0kKElRwhNs9UlUHAE/F9Fe6GLaXnqyDdmEXc= github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= +github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= +github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= +github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE= github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78= @@ -78,8 +83,10 @@ github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/uuid v1.4.0 h1:MtMxsa51/r9yyhkyLsVeVt0B+BGQZzpQiTQ4eHZ8bc4= -github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 h1:YBftPWNWd4WwGqtY2yeZL2ef8rHAxPBD8KFhJpmcqms= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0/go.mod h1:YN5jB8ie0yfIUg6VvR9Kz84aCaG7AsGZnLjhHbUqwPg= github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek= github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= @@ -90,8 +97,8 @@ github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGw github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/klauspost/compress v1.17.3 h1:qkRjuerhUU1EmXLYGkSH6EZL+vPSxIrYjLNAK4slzwA= -github.com/klauspost/compress v1.17.3/go.mod h1:/dCuZOvVtNoHsyb+cuJD3itjs3NbnF6KH9zAO4BDxPM= +github.com/klauspost/compress v1.17.5 h1:d4vBd+7CHydUqpFBgUEKkSdtSugf9YFmSkvUYPquI5E= +github.com/klauspost/compress v1.17.5/go.mod h1:/dCuZOvVtNoHsyb+cuJD3itjs3NbnF6KH9zAO4BDxPM= github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= @@ -105,16 +112,16 @@ github.com/moby/patternmatcher v0.6.0 h1:GmP9lR19aU5GqSSFko+5pRqHi+Ohk1O69aFiKkV github.com/moby/patternmatcher v0.6.0/go.mod h1:hDPoyOpDY7OrrMDLaYoY3hf52gNCR/YOUYxkhApJIxc= github.com/moby/sys/sequential v0.5.0 h1:OPvI35Lzn9K04PBbCLW0g4LcFAJgHsvXsRyewg5lXtc= github.com/moby/sys/sequential v0.5.0/go.mod h1:tH2cOOs5V9MlPiXcQzRC+eEyab644PWKGRYaaV5ZZlo= +github.com/moby/sys/user v0.1.0 h1:WmZ93f5Ux6het5iituh9x2zAG7NFY9Aqi49jjE1PaQg= +github.com/moby/sys/user v0.1.0/go.mod h1:fKJhFOnsCN6xZ5gSfbM6zaHGgDJMrqt9/reuj4T7MmU= github.com/moby/term v0.5.0 h1:xt8Q1nalod/v7BqbG21f8mQPqH+xAaC9C3N3wfWbVP0= github.com/moby/term v0.5.0/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y= github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= -github.com/opencontainers/image-spec v1.1.0-rc5 h1:Ygwkfw9bpDvs+c9E34SdgGOj41dX/cbdlwvlWt0pnFI= -github.com/opencontainers/image-spec v1.1.0-rc5/go.mod h1:X4pATf0uXsnn3g5aiGIsVnJBR4mxhKzfwmvK/B2NTm8= -github.com/opencontainers/runc v1.1.10 h1:EaL5WeO9lv9wmS6SASjszOeQdSctvpbu0DdBQBizE40= -github.com/opencontainers/runc v1.1.10/go.mod h1:+/R6+KmDlh+hOO8NkjmgkG9Qzvypzk0yXxAPYYR65+M= +github.com/opencontainers/image-spec v1.1.0-rc6 h1:XDqvyKsJEbRtATzkgItUqBA7QHk58yxX1Ov9HERHNqU= +github.com/opencontainers/image-spec v1.1.0-rc6/go.mod h1:W4s4sFTMaBeK1BQLXbG4AdM2szdn85PY75RI83NrTrM= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= @@ -125,8 +132,8 @@ github.com/power-devops/perfstat v0.0.0-20221212215047-62379fc7944b/go.mod h1:Om github.com/rogpeppe/go-internal v1.8.1 h1:geMPLpDpQOgVyCg5z5GoRwLHepNdb71NXb67XFkP+Eg= github.com/rogpeppe/go-internal v1.8.1/go.mod h1:JeRgkft04UBgHMgCIwADu4Pn6Mtm5d4nPKWu0nJ5d+o= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/shirou/gopsutil/v3 v3.23.10 h1:/N42opWlYzegYaVkWejXWJpbzKv2JDy3mrgGzKsh9hM= -github.com/shirou/gopsutil/v3 v3.23.10/go.mod h1:JIE26kpucQi+innVlAUnIEOSBhBUkirr5b44yr55+WE= +github.com/shirou/gopsutil/v3 v3.24.1 h1:R3t6ondCEvmARp3wxODhXMTLC/klMa87h2PHUw5m7QI= +github.com/shirou/gopsutil/v3 v3.24.1/go.mod h1:UU7a2MSBQa+kW1uuDq8DeEBS8kmrnQwsv2b5O513rwU= github.com/shoenig/go-m1cpu v0.1.6 h1:nxdKQNcEB6vzgA2E2bvzKIYRuNj7XNJ4S/aRSwKzFtM= github.com/shoenig/go-m1cpu v0.1.6/go.mod h1:1JJMcUBvfNwpq05QDQVAnx3gUHr9IYF7GNg9SUEw2VQ= github.com/shoenig/test v0.6.4 h1:kVTaSd7WLz5WZ2IaoM0RSzRsUD+m8wRR+5qvntpn4LU= @@ -145,23 +152,42 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/testcontainers/testcontainers-go v0.26.0 h1:uqcYdoOHBy1ca7gKODfBd9uTHVK3a7UL848z09MVZ0c= -github.com/testcontainers/testcontainers-go v0.26.0/go.mod h1:ICriE9bLX5CLxL9OFQ2N+2N+f+803LNJ1utJb1+Inx0= -github.com/testcontainers/testcontainers-go/modules/localstack v0.26.0 h1:lpL04dHA9mGFBQLFcV+aEEh1Tf4ohXdIGgoj3J0bacM= -github.com/testcontainers/testcontainers-go/modules/localstack v0.26.0/go.mod h1:1xkZPpkBu6coI7CyVn3DXUBnsVrZ+fd/Cc8lx6zk2mk= -github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU= +github.com/testcontainers/testcontainers-go v0.27.0 h1:IeIrJN4twonTDuMuBNQdKZ+K97yd7VrmNGu+lDpYcDk= +github.com/testcontainers/testcontainers-go v0.27.0/go.mod h1:+HgYZcd17GshBUZv9b+jKFJ198heWPQq3KQIp2+N+7U= +github.com/testcontainers/testcontainers-go/modules/localstack v0.27.0 h1:WXwTQYYVh3j865yRkElFKCX6WYwFYNhE+NSCTT2Werk= +github.com/testcontainers/testcontainers-go/modules/localstack v0.27.0/go.mod h1:XjzTgPyIaJ5Lg5A+9AjdIjqYeUzgEjn+ZEnwWqvpj04= github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI= -github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk= +github.com/tklauser/go-sysconf v0.3.13 h1:GBUpcahXSpR2xN01jhkNAbTLRk2Yzgggk8IM08lq3r4= +github.com/tklauser/go-sysconf v0.3.13/go.mod h1:zwleP4Q4OehZHGn4CYZDipCgg9usW5IJePewFCGVEa0= github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY= +github.com/tklauser/numcpus v0.7.0 h1:yjuerZP127QG9m5Zh/mSO4wqurYil27tHrqwRoRjpr4= +github.com/tklauser/numcpus v0.7.0/go.mod h1:bb6dMVcj8A42tSE7i32fsIUCbQNllK5iDguyOZRUzAY= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yusufpapurcu/wmi v1.2.3 h1:E1ctvB7uKFMOJw3fdOW32DwGE9I7t++CRUEMKvFoFiw= github.com/yusufpapurcu/wmi v1.2.3/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= +github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0= +github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0 h1:sv9kVfal0MK0wBMCOGr+HeJm9v803BkJxGrk2au7j08= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0/go.mod h1:SK2UL73Zy1quvRPonmOmRDiWk1KBV3LyIeeIxcEApWw= +go.opentelemetry.io/otel v1.22.0 h1:xS7Ku+7yTFvDfDraDIJVpw7XPyuHlB9MCiqqX5mcJ6Y= +go.opentelemetry.io/otel v1.22.0/go.mod h1:eoV4iAi3Ea8LkAEI9+GFT44O6T/D0GWAVFyZVCC6pMI= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0 h1:Mne5On7VWdx7omSrSSZvM4Kw7cS7NQkOOmLcgscI51U= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0/go.mod h1:IPtUMKL4O3tH5y+iXVyAXqpAwMuzC1IrxVS81rummfE= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.19.0 h1:IeMeyr1aBvBiPVYihXIaeIZba6b8E1bYp7lbdxK8CQg= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.19.0/go.mod h1:oVdCUtjq9MK9BlS7TtucsQwUcXcymNiEDjgDD2jMtZU= +go.opentelemetry.io/otel/metric v1.22.0 h1:lypMQnGyJYeuYPhOM/bgjbFM6WE44W1/T45er4d8Hhg= +go.opentelemetry.io/otel/metric v1.22.0/go.mod h1:evJGjVpZv0mQ5QBRJoBF64yMuOf4xCWdXjK8pzFvliY= +go.opentelemetry.io/otel/sdk v1.19.0 h1:6USY6zH+L8uMH8L3t1enZPR3WFEmSTADlqldyHtJi3o= +go.opentelemetry.io/otel/sdk v1.19.0/go.mod h1:NedEbbS4w3C6zElbLdPJKOpJQOrGUJ+GfzpjUvI0v1A= +go.opentelemetry.io/otel/trace v1.22.0 h1:Hg6pPujv0XG9QaVbGOBVHunyuLcCC3jN7WEhPx83XD0= +go.opentelemetry.io/otel/trace v1.22.0/go.mod h1:RbbHXVqKES9QhzZq/fE5UnOSILqRt40a21sPw2He1xo= +go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lIVU/I= +go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa h1:FRnLl4eNAQl8hwxVVC17teOw8kdjVDVAiFMtgUdTSRQ= -golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa/go.mod h1:zk2irFbV9DP96SEBUUAy67IdHUaZuSnrz1n472HUCLE= +golang.org/x/exp v0.0.0-20240119083558-1b970713d09a h1:Q8/wZp0KX97QFTc2ywcOE0YRjZPVIx+MXInMzdvQqcA= +golang.org/x/exp v0.0.0-20240119083558-1b970713d09a/go.mod h1:idGWGoKP1toJGkd5/ig9ZLuPcZBC3ewk7SzmH0uou08= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0= @@ -170,13 +196,13 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.18.0 h1:mIYleuAkSbHh0tCv7RvjL3F6ZVbLjq4+R7zbOn3Kokg= -golang.org/x/net v0.18.0/go.mod h1:/czyP5RqHAH4odGYxBJ1qz0+CE5WZ+2j1YgoEo8F2jQ= +golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo= +golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE= -golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= +golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -187,9 +213,8 @@ golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= -golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= @@ -200,20 +225,22 @@ golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGm golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.15.0 h1:zdAyfUGbYmuVokhzVmghFl2ZJh5QhcfebBgmVPFYA+8= -golang.org/x/tools v0.15.0/go.mod h1:hpksKq4dtpQWS1uQ61JkdqWM3LscIS6Slf+VVkm+wQk= +golang.org/x/tools v0.17.0 h1:FvmRgNOcs3kOa+T20R1uhfP9F6HgG2mfxDv1vrx1Htc= +golang.org/x/tools v0.17.0/go.mod h1:xsh6VxdV005rRVaS6SSAf9oiAqljS7UZUacMZ8Bnsps= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f h1:ultW7fxlIvee4HYrtnaRPon9HpEgFk5zYpmfMgtKB5I= -google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f/go.mod h1:L9KNLi232K1/xB6f7AlSX692koaRnKaWSR0stBki0Yc= -google.golang.org/grpc v1.59.0 h1:Z5Iec2pjwb+LEOqzpB2MR12/eKFhDPhuqW91O+4bwUk= -google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98= +google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917 h1:rcS6EyEaoCO52hQDupoSfrxI3R6C2Tq741is7X8OvnM= +google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917/go.mod h1:CmlNWB9lSezaYELKS5Ym1r44VrrbPUa7JTvw+6MbpJ0= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240125205218-1f4bbc51befe h1:bQnxqljG/wqi4NTXu2+DJ3n7APcEA882QZ1JvhQAq9o= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240125205218-1f4bbc51befe/go.mod h1:PAREbraiVEVGVdTZsVWjSbbTtSyGbAgIIvni8a8CD5s= +google.golang.org/grpc v1.61.0 h1:TOvOcuXn30kRao+gfcvsebNEa5iZIiLkisYEkf7R7o0= +google.golang.org/grpc v1.61.0/go.mod h1:VUbo7IFqmF1QtCAstipjG0GIoq49KvMe9+h1jFLBNJs= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= -google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= +google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= diff --git a/tests/scale_test.sh b/tests/scale_test.sh new file mode 100755 index 0000000..84bb159 --- /dev/null +++ b/tests/scale_test.sh @@ -0,0 +1,49 @@ +#!/bin/bash + +# Replace these variables with your own values +BASE_FUNCTION_NAME=$1 +AWS_REGION=$2 +PROFILE=$3 + +export AWS_PAGER="" + +# Loop to update, publish new versions, and create aliases +for ((i=1; i<=2000; i++)); do + # Create a new temporary directory + TEMP_DIR=$(mktemp -d) + ZIP_FILE_PATH="${TEMP_DIR}/handler.zip" + + # Add a dummy comment to the ZIP file + echo "# Dummy comment for update" > "${TEMP_DIR}/handler.js" + + # Zip the contents of the temporary directory + zip -j $ZIP_FILE_PATH "${TEMP_DIR}"/* + + # Update Lambda function code + FUNCTION_NAME="${BASE_FUNCTION_NAME}" + aws lambda update-function-code --function-name $FUNCTION_NAME --zip-file fileb://$ZIP_FILE_PATH --region $AWS_REGION --profile $PROFILE + + # Wait for the update to complete + aws lambda wait function-updated --function-name $FUNCTION_NAME --region $AWS_REGION --profile $PROFILE + + # Publish a new version + NEW_VERSION=$(aws lambda publish-version --function-name $FUNCTION_NAME --region $AWS_REGION --profile $PROFILE --query 'Version' --output text) + + echo "Updated and published version $NEW_VERSION" + + # Create an alias for the new version + ALIAS_NAME="alias_$i" + aws lambda create-alias --function-name $FUNCTION_NAME --name $ALIAS_NAME --function-version $NEW_VERSION --region $AWS_REGION --profile $PROFILE + + # Check if the alias is created successfully + if [ $? -ne 0 ]; then + echo "Failed to create alias $ALIAS_NAME." + else + echo "Created alias $ALIAS_NAME for version $NEW_VERSION." + fi + + # Remove the temporary directory + rm -r $TEMP_DIR +done + +echo "Script completed!"