From 4e81599ef62544a894da67173fbdceb055806fce Mon Sep 17 00:00:00 2001 From: Rico Hermans Date: Wed, 1 Mar 2023 19:20:10 +0100 Subject: [PATCH] chore: reduce amount of throttling to CodeArtifact (#24402) Our new mechanism of testing candidate packages in our pipeline is by uploading them to CodeArtifact, instead of using hacky local tools that fake being NPM, NuGet, Maven, etc. For the regression tests, we need access to versions `X` and `X+1` for packages, so we set all packages to `upstream: ALLOW` (individually, because there is no other way). This giant call volume is causing throttling which is alarming to the CodeArtifact team. Only enable configuring upstreams for the regression test jobs, which is a lot less than for all tests. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- .../cli-integ/bin/stage-distribution.ts | 13 +++++++++++-- .../test-cli-regression-against-current-code.sh | 2 +- .../test-cli-regression-against-latest-release.sh | 2 +- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/packages/@aws-cdk-testing/cli-integ/bin/stage-distribution.ts b/packages/@aws-cdk-testing/cli-integ/bin/stage-distribution.ts index a5cfd6b496e5c..0c8f5e11eac53 100644 --- a/packages/@aws-cdk-testing/cli-integ/bin/stage-distribution.ts +++ b/packages/@aws-cdk-testing/cli-integ/bin/stage-distribution.ts @@ -34,6 +34,12 @@ async function main() { type: 'boolean', requiresArg: false, }) + .option('regression', { + description: 'Enable access to previous versions of the staged packages (this is expensive for CodeArtifact so we only do it when necessary)', + type: 'boolean', + requiresArg: false, + default: false, + }) .command('publish ', 'Publish a given directory', cmd => cmd .positional('DIRECTORY', { descripton: 'Directory distribution', @@ -190,6 +196,7 @@ async function publish(repo: TestRepository, usageDir: UsageDir, args: { python?: boolean; java?: boolean; dotnet?: boolean; + regression?: boolean; }) { const directory = `${args.DIRECTORY}`; const login = await repo.loginInformation(); @@ -221,8 +228,10 @@ async function publish(repo: TestRepository, usageDir: UsageDir, args: { await uploadDotnetPackages(glob.sync(path.join(directory, 'dotnet', '**', '*.nupkg')), usageDir); }); - console.log('🛍 Configuring packages for upstream versions'); - await repo.markAllUpstreamAllow(); + if (args.regression) { + console.log('🛍 Configuring packages for upstream versions'); + await repo.markAllUpstreamAllow(); + } } function whichRepos(args: { diff --git a/packages/aws-cdk/test/integ/test-cli-regression-against-current-code.sh b/packages/aws-cdk/test/integ/test-cli-regression-against-current-code.sh index c735580c9fd58..b8d3684c70ba6 100755 --- a/packages/aws-cdk/test/integ/test-cli-regression-against-current-code.sh +++ b/packages/aws-cdk/test/integ/test-cli-regression-against-current-code.sh @@ -9,4 +9,4 @@ previous=$(${INTEG_TOOLS}/bin/query-github last-release --token $GITHUB_TOKEN -- echo "Previous version is: $previous" # Old tests, new CLI, new framework -exec $INTEG_TOOLS/bin/download-and-run-old-tests "$previous" --use-cli-release=$VERSION cli-integ-tests +exec $INTEG_TOOLS/bin/download-and-run-old-tests "$previous" --regression --use-cli-release=$VERSION cli-integ-tests diff --git a/packages/aws-cdk/test/integ/test-cli-regression-against-latest-release.sh b/packages/aws-cdk/test/integ/test-cli-regression-against-latest-release.sh index 8c828fb2138ce..854eb047c06b9 100755 --- a/packages/aws-cdk/test/integ/test-cli-regression-against-latest-release.sh +++ b/packages/aws-cdk/test/integ/test-cli-regression-against-latest-release.sh @@ -8,4 +8,4 @@ previous=$(${INTEG_TOOLS}/bin/query-github last-release --token $GITHUB_TOKEN -- echo "Previous version is: $previous" # Old tests, new CLI, old framework -exec $INTEG_TOOLS/bin/download-and-run-old-tests "$previous" --use-cli-release=$VERSION --framework-version=$previous cli-integ-tests +exec $INTEG_TOOLS/bin/download-and-run-old-tests "$previous" --regression --use-cli-release=$VERSION --framework-version=$previous cli-integ-tests