@aws-cdk-testing/cli-integ 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +9 -0
- package/LICENSE +202 -0
- package/NOTICE +16 -0
- package/README.md +205 -0
- package/bin/apply-patches +22 -0
- package/bin/download-and-run-old-tests +52 -0
- package/bin/query-github +2 -0
- package/bin/query-github.d.ts +1 -0
- package/bin/query-github.js +54 -0
- package/bin/query-github.ts +56 -0
- package/bin/run-suite +2 -0
- package/bin/run-suite.d.ts +1 -0
- package/bin/run-suite.js +131 -0
- package/bin/run-suite.ts +140 -0
- package/bin/stage-distribution +2 -0
- package/bin/stage-distribution.d.ts +1 -0
- package/bin/stage-distribution.js +217 -0
- package/bin/stage-distribution.ts +267 -0
- package/bin/test-root +2 -0
- package/bin/test-root.d.ts +1 -0
- package/bin/test-root.js +6 -0
- package/bin/test-root.ts +3 -0
- package/entrypoints/test-cli-regression-against-current-code.sh +11 -0
- package/entrypoints/test-cli-regression-against-latest-release.sh +11 -0
- package/entrypoints/test-cli-regression.bash +83 -0
- package/entrypoints/test.sh +12 -0
- package/lib/aws.d.ts +51 -0
- package/lib/aws.js +206 -0
- package/lib/aws.ts +263 -0
- package/lib/corking.d.ts +12 -0
- package/lib/corking.js +35 -0
- package/lib/corking.ts +33 -0
- package/lib/eventually.d.ts +20 -0
- package/lib/eventually.js +34 -0
- package/lib/eventually.ts +42 -0
- package/lib/files.d.ts +15 -0
- package/lib/files.js +80 -0
- package/lib/files.ts +80 -0
- package/lib/github.d.ts +4 -0
- package/lib/github.js +43 -0
- package/lib/github.ts +43 -0
- package/lib/index.d.ts +13 -0
- package/lib/index.js +30 -0
- package/lib/index.ts +13 -0
- package/lib/integ-test.d.ts +10 -0
- package/lib/integ-test.js +70 -0
- package/lib/integ-test.ts +81 -0
- package/lib/lists.d.ts +1 -0
- package/lib/lists.js +11 -0
- package/lib/lists.ts +9 -0
- package/lib/memoize.d.ts +6 -0
- package/lib/memoize.js +18 -0
- package/lib/memoize.ts +14 -0
- package/lib/npm.d.ts +8 -0
- package/lib/npm.js +38 -0
- package/lib/npm.ts +41 -0
- package/lib/package-sources/release-source.d.ts +23 -0
- package/lib/package-sources/release-source.js +71 -0
- package/lib/package-sources/release-source.ts +81 -0
- package/lib/package-sources/repo-source.d.ts +30 -0
- package/lib/package-sources/repo-source.js +97 -0
- package/lib/package-sources/repo-source.ts +111 -0
- package/lib/package-sources/repo-tools/npm +2 -0
- package/lib/package-sources/repo-tools/npm.d.ts +1 -0
- package/lib/package-sources/repo-tools/npm.js +43 -0
- package/lib/package-sources/repo-tools/npm.ts +48 -0
- package/lib/package-sources/source.d.ts +28 -0
- package/lib/package-sources/source.js +3 -0
- package/lib/package-sources/source.ts +35 -0
- package/lib/package-sources/subprocess.d.ts +3 -0
- package/lib/package-sources/subprocess.js +17 -0
- package/lib/package-sources/subprocess.ts +15 -0
- package/lib/resource-pool.d.ts +50 -0
- package/lib/resource-pool.js +117 -0
- package/lib/resource-pool.ts +140 -0
- package/lib/resources.d.ts +1 -0
- package/lib/resources.js +6 -0
- package/lib/resources.ts +4 -0
- package/lib/shell.d.ts +56 -0
- package/lib/shell.js +123 -0
- package/lib/shell.ts +168 -0
- package/lib/staging/codeartifact.d.ts +44 -0
- package/lib/staging/codeartifact.js +281 -0
- package/lib/staging/codeartifact.ts +387 -0
- package/lib/staging/maven.d.ts +5 -0
- package/lib/staging/maven.js +91 -0
- package/lib/staging/maven.ts +95 -0
- package/lib/staging/npm.d.ts +4 -0
- package/lib/staging/npm.js +55 -0
- package/lib/staging/npm.ts +62 -0
- package/lib/staging/nuget.d.ts +4 -0
- package/lib/staging/nuget.js +69 -0
- package/lib/staging/nuget.ts +75 -0
- package/lib/staging/parallel-shell.d.ts +5 -0
- package/lib/staging/parallel-shell.js +45 -0
- package/lib/staging/parallel-shell.ts +51 -0
- package/lib/staging/pypi.d.ts +4 -0
- package/lib/staging/pypi.js +48 -0
- package/lib/staging/pypi.ts +50 -0
- package/lib/staging/usage-dir.d.ts +31 -0
- package/lib/staging/usage-dir.js +87 -0
- package/lib/staging/usage-dir.ts +99 -0
- package/lib/with-aws.d.ts +14 -0
- package/lib/with-aws.js +60 -0
- package/lib/with-aws.ts +67 -0
- package/lib/with-cdk-app.d.ts +210 -0
- package/lib/with-cdk-app.js +539 -0
- package/lib/with-cdk-app.ts +742 -0
- package/lib/with-cli-lib.d.ts +17 -0
- package/lib/with-cli-lib.js +123 -0
- package/lib/with-cli-lib.ts +134 -0
- package/lib/with-packages.d.ts +5 -0
- package/lib/with-packages.js +13 -0
- package/lib/with-packages.ts +15 -0
- package/lib/with-sam.d.ts +33 -0
- package/lib/with-sam.js +258 -0
- package/lib/with-sam.ts +288 -0
- package/lib/with-temporary-directory.d.ts +5 -0
- package/lib/with-temporary-directory.js +31 -0
- package/lib/with-temporary-directory.ts +35 -0
- package/lib/with-timeout.d.ts +19 -0
- package/lib/with-timeout.js +34 -0
- package/lib/with-timeout.ts +33 -0
- package/lib/xpmutex.d.ts +43 -0
- package/lib/xpmutex.js +207 -0
- package/lib/xpmutex.ts +218 -0
- package/package.json +111 -0
- package/resources/bootstrap-templates/session-tags.all-roles-deny-all.yaml +703 -0
- package/resources/bootstrap-templates/session-tags.deploy-role-deny-sqs.yaml +700 -0
- package/resources/cdk-apps/app/app.js +926 -0
- package/resources/cdk-apps/app/appsync.hotswap.graphql +3 -0
- package/resources/cdk-apps/app/cdk.json +7 -0
- package/resources/cdk-apps/app/docker/Dockerfile +2 -0
- package/resources/cdk-apps/app/docker/Dockerfile.Custom +2 -0
- package/resources/cdk-apps/app/lambda/index.js +4 -0
- package/resources/cdk-apps/app/lambda/response.json +3 -0
- package/resources/cdk-apps/app/nested-stack.js +65 -0
- package/resources/cdk-apps/cfn-include-app/cdk.json +4 -0
- package/resources/cdk-apps/cfn-include-app/cfn-include-app.js +21 -0
- package/resources/cdk-apps/cfn-include-app/example-template.json +13 -0
- package/resources/cdk-apps/rollback-test-app/app.js +110 -0
- package/resources/cdk-apps/rollback-test-app/cdk.json +7 -0
- package/resources/cdk-apps/sam_cdk_integ_app/bin/test-app.js +11 -0
- package/resources/cdk-apps/sam_cdk_integ_app/cdk.json +6 -0
- package/resources/cdk-apps/sam_cdk_integ_app/lib/nested-stack.js +19 -0
- package/resources/cdk-apps/sam_cdk_integ_app/lib/test-stack.js +134 -0
- package/resources/cdk-apps/sam_cdk_integ_app/src/docker/DockerImageFunctionConstruct/.no-packagejson-validator +0 -0
- package/resources/cdk-apps/sam_cdk_integ_app/src/docker/DockerImageFunctionConstruct/Dockerfile +9 -0
- package/resources/cdk-apps/sam_cdk_integ_app/src/docker/DockerImageFunctionConstruct/app.js +22 -0
- package/resources/cdk-apps/sam_cdk_integ_app/src/docker/DockerImageFunctionConstruct/package.json +18 -0
- package/resources/cdk-apps/sam_cdk_integ_app/src/go/GoFunctionConstruct/go.mod +5 -0
- package/resources/cdk-apps/sam_cdk_integ_app/src/go/GoFunctionConstruct/go.sum +17 -0
- package/resources/cdk-apps/sam_cdk_integ_app/src/go/GoFunctionConstruct/main.go +17 -0
- package/resources/cdk-apps/sam_cdk_integ_app/src/nodejs/NodeJsFunctionConstruct/.no-packagejson-validator +0 -0
- package/resources/cdk-apps/sam_cdk_integ_app/src/nodejs/NodeJsFunctionConstruct/app.ts +16 -0
- package/resources/cdk-apps/sam_cdk_integ_app/src/nodejs/NodeJsFunctionConstruct/package-lock.json +12 -0
- package/resources/cdk-apps/sam_cdk_integ_app/src/nodejs/NodeJsFunctionConstruct/package.json +5 -0
- package/resources/cdk-apps/sam_cdk_integ_app/src/python/Function/app.py +15 -0
- package/resources/cdk-apps/sam_cdk_integ_app/src/python/Function/requirements.txt +1 -0
- package/resources/cdk-apps/sam_cdk_integ_app/src/python/Layer/layer_version_dependency.py +5 -0
- package/resources/cdk-apps/sam_cdk_integ_app/src/python/Layer/requirements.txt +1 -0
- package/resources/cdk-apps/sam_cdk_integ_app/src/rest-api-definition.yaml +12 -0
- package/resources/cdk-apps/simple-app/app.js +26 -0
- package/resources/cdk-apps/simple-app/cdk.json +7 -0
- package/resources/cli-regression-patches/v1.119.0/NOTES.md +5 -0
- package/resources/cli-regression-patches/v1.119.0/cli.integtest.js +659 -0
- package/resources/cli-regression-patches/v1.130.0/NOTES.md +12 -0
- package/resources/cli-regression-patches/v1.130.0/app/app.js +378 -0
- package/resources/cli-regression-patches/v1.130.0/bootstrapping.integtest.js +220 -0
- package/resources/cli-regression-patches/v1.44.0/NOTES.md +18 -0
- package/resources/cli-regression-patches/v1.44.0/bootstrapping.integtest.js +126 -0
- package/resources/cli-regression-patches/v1.44.0/test.sh +26 -0
- package/resources/cli-regression-patches/v1.61.1/NOTES.md +2 -0
- package/resources/cli-regression-patches/v1.61.1/skip-tests.txt +16 -0
- package/resources/cli-regression-patches/v1.62.0/NOTES.md +2 -0
- package/resources/cli-regression-patches/v1.62.0/aws-helpers.js +245 -0
- package/resources/cli-regression-patches/v1.63.0/NOTES.md +1 -0
- package/resources/cli-regression-patches/v1.63.0/skip-tests.txt +7 -0
- package/resources/cli-regression-patches/v1.64.0/NOTES.md +3 -0
- package/resources/cli-regression-patches/v1.64.0/cdk-helpers.js +325 -0
- package/resources/cli-regression-patches/v1.64.0/cli.integtest.js +599 -0
- package/resources/cli-regression-patches/v1.64.1/NOTES.md +3 -0
- package/resources/cli-regression-patches/v1.64.1/cdk-helpers.js +324 -0
- package/resources/cli-regression-patches/v1.64.1/cli.integtest.js +599 -0
- package/resources/cli-regression-patches/v1.67.0/NOTES.md +2 -0
- package/resources/cli-regression-patches/v1.67.0/cdk-helpers.js +331 -0
- package/resources/cli-regression-patches/v2.130.0/NOTES.md +1 -0
- package/resources/cli-regression-patches/v2.130.0/node_modules/@aws-cdk-testing/cli-integ/resources/cdk-apps/sam_cdk_integ_app/lib/nested-stack.js +19 -0
- package/resources/cli-regression-patches/v2.130.0/node_modules/@aws-cdk-testing/cli-integ/resources/cdk-apps/sam_cdk_integ_app/lib/test-stack.js +134 -0
- package/resources/cli-regression-patches/v2.130.0/skip-tests.txt +5 -0
- package/resources/cli-regression-patches/v2.132.0/NOTES.md +1 -0
- package/resources/cli-regression-patches/v2.132.0/skip-tests.txt +4 -0
- package/resources/cli-regression-patches/v2.142.0/NOTES.md +1 -0
- package/resources/cli-regression-patches/v2.142.0/skip-tests.txt +4 -0
- package/resources/cli-regression-patches/v2.160.0/skip-tests.txt +2 -0
- package/resources/cli-regression-patches/v2.161.0/NOTES.md +1 -0
- package/resources/cli-regression-patches/v2.161.0/skip-tests.txt +5 -0
- package/resources/cli-regression-patches/v2.166.0/NOTES.md +1 -0
- package/resources/cli-regression-patches/v2.166.0/skip-tests.txt +2 -0
- package/resources/cloud-assemblies/0.36.0/InitStack.template.json +1 -0
- package/resources/cloud-assemblies/0.36.0/cdk.out +1 -0
- package/resources/cloud-assemblies/0.36.0/manifest.json +19 -0
- package/resources/cloud-assemblies/1.10.0-lookup-default-vpc/InitStack.template.json +2 -0
- package/resources/cloud-assemblies/1.10.0-lookup-default-vpc/cdk.out +1 -0
- package/resources/cloud-assemblies/1.10.0-lookup-default-vpc/manifest.json.js +37 -0
- package/resources/cloud-assemblies/1.10.0-request-azs/InitStack.template.json +2 -0
- package/resources/cloud-assemblies/1.10.0-request-azs/cdk.out +1 -0
- package/resources/cloud-assemblies/1.10.0-request-azs/manifest.json.js +34 -0
- package/resources/integ.jest.config.js +25 -0
- package/resources/templates/sqs-template.json +36 -0
- package/skip-tests.txt +8 -0
- package/tests/cli-integ-tests/README.md +47 -0
- package/tests/cli-integ-tests/bootstrapping.integtest.d.ts +1 -0
- package/tests/cli-integ-tests/bootstrapping.integtest.js +412 -0
- package/tests/cli-integ-tests/bootstrapping.integtest.ts +493 -0
- package/tests/cli-integ-tests/cli-lib.integtest.d.ts +1 -0
- package/tests/cli-integ-tests/cli-lib.integtest.js +62 -0
- package/tests/cli-integ-tests/cli-lib.integtest.ts +90 -0
- package/tests/cli-integ-tests/cli.integtest.d.ts +1 -0
- package/tests/cli-integ-tests/cli.integtest.js +2104 -0
- package/tests/cli-integ-tests/cli.integtest.ts +2874 -0
- package/tests/cli-integ-tests/garbage-collection.integtest.d.ts +1 -0
- package/tests/cli-integ-tests/garbage-collection.integtest.js +314 -0
- package/tests/cli-integ-tests/garbage-collection.integtest.ts +392 -0
- package/tests/init-csharp/init-csharp.integtest.d.ts +1 -0
- package/tests/init-csharp/init-csharp.integtest.js +14 -0
- package/tests/init-csharp/init-csharp.integtest.ts +15 -0
- package/tests/init-fsharp/init-fsharp.integtest.d.ts +1 -0
- package/tests/init-fsharp/init-fsharp.integtest.js +14 -0
- package/tests/init-fsharp/init-fsharp.integtest.ts +15 -0
- package/tests/init-go/init-go.integtest.d.ts +1 -0
- package/tests/init-go/init-go.integtest.js +21 -0
- package/tests/init-go/init-go.integtest.ts +23 -0
- package/tests/init-java/init-java.integtest.d.ts +1 -0
- package/tests/init-java/init-java.integtest.js +14 -0
- package/tests/init-java/init-java.integtest.ts +14 -0
- package/tests/init-javascript/init-javascript.integtest.d.ts +1 -0
- package/tests/init-javascript/init-javascript.integtest.js +53 -0
- package/tests/init-javascript/init-javascript.integtest.ts +59 -0
- package/tests/init-python/init-python.integtest.d.ts +1 -0
- package/tests/init-python/init-python.integtest.js +19 -0
- package/tests/init-python/init-python.integtest.ts +20 -0
- package/tests/init-typescript-app/init-typescript-app.integtest.d.ts +1 -0
- package/tests/init-typescript-app/init-typescript-app.integtest.js +54 -0
- package/tests/init-typescript-app/init-typescript-app.integtest.ts +66 -0
- package/tests/init-typescript-lib/init-typescript-lib.integtest.d.ts +1 -0
- package/tests/init-typescript-lib/init-typescript-lib.integtest.js +13 -0
- package/tests/init-typescript-lib/init-typescript-lib.integtest.ts +13 -0
- package/tests/tool-integrations/amplify.integtest.d.ts +1 -0
- package/tests/tool-integrations/amplify.integtest.js +39 -0
- package/tests/tool-integrations/amplify.integtest.ts +43 -0
- package/tests/tool-integrations/with-tool-context.d.ts +9 -0
- package/tests/tool-integrations/with-tool-context.js +13 -0
- package/tests/tool-integrations/with-tool-context.ts +14 -0
- package/tests/uberpackage/uberpackage.integtest.d.ts +1 -0
- package/tests/uberpackage/uberpackage.integtest.js +11 -0
- package/tests/uberpackage/uberpackage.integtest.ts +11 -0
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
/* eslint-disable no-console */
|
|
2
|
+
import * as path from 'path';
|
|
3
|
+
import * as fs from 'fs-extra';
|
|
4
|
+
import * as glob from 'glob';
|
|
5
|
+
import * as yargs from 'yargs';
|
|
6
|
+
import { shell } from '../lib';
|
|
7
|
+
import { TestRepository } from '../lib/staging/codeartifact';
|
|
8
|
+
import { uploadJavaPackages, mavenLogin } from '../lib/staging/maven';
|
|
9
|
+
import { uploadNpmPackages, npmLogin } from '../lib/staging/npm';
|
|
10
|
+
import { uploadDotnetPackages, nugetLogin } from '../lib/staging/nuget';
|
|
11
|
+
import { uploadPythonPackages, pypiLogin } from '../lib/staging/pypi';
|
|
12
|
+
import { UsageDir } from '../lib/staging/usage-dir';
|
|
13
|
+
|
|
14
|
+
async function main() {
|
|
15
|
+
await yargs
|
|
16
|
+
.usage('$0 <command>')
|
|
17
|
+
.option('npm', {
|
|
18
|
+
description: 'Upload NPM packages only',
|
|
19
|
+
type: 'boolean',
|
|
20
|
+
requiresArg: false,
|
|
21
|
+
})
|
|
22
|
+
.option('python', {
|
|
23
|
+
description: 'Upload Python packages only',
|
|
24
|
+
type: 'boolean',
|
|
25
|
+
requiresArg: false,
|
|
26
|
+
})
|
|
27
|
+
.option('java', {
|
|
28
|
+
description: 'Upload Java packages only',
|
|
29
|
+
type: 'boolean',
|
|
30
|
+
requiresArg: false,
|
|
31
|
+
})
|
|
32
|
+
.option('dotnet', {
|
|
33
|
+
description: 'Upload Dotnet packages only',
|
|
34
|
+
type: 'boolean',
|
|
35
|
+
requiresArg: false,
|
|
36
|
+
})
|
|
37
|
+
.option('regression', {
|
|
38
|
+
description: 'Enable access to previous versions of the staged packages (this is expensive for CodeArtifact so we only do it when necessary)',
|
|
39
|
+
type: 'boolean',
|
|
40
|
+
requiresArg: false,
|
|
41
|
+
default: false,
|
|
42
|
+
})
|
|
43
|
+
.command('publish <DIRECTORY>', 'Publish a given directory', cmd => cmd
|
|
44
|
+
.positional('DIRECTORY', {
|
|
45
|
+
descripton: 'Directory distribution',
|
|
46
|
+
type: 'string',
|
|
47
|
+
demandOption: true,
|
|
48
|
+
})
|
|
49
|
+
.option('name', {
|
|
50
|
+
alias: 'n',
|
|
51
|
+
description: 'Name of the repository to create (default: generate unique name)',
|
|
52
|
+
type: 'string',
|
|
53
|
+
requiresArg: true,
|
|
54
|
+
}), async (args) => {
|
|
55
|
+
|
|
56
|
+
await validateDirectory(args);
|
|
57
|
+
const repo = await (args.name ? TestRepository.newWithName(args.name) : TestRepository.newRandom());
|
|
58
|
+
const usageDir = UsageDir.default();
|
|
59
|
+
|
|
60
|
+
await doLogin(repo, usageDir, args);
|
|
61
|
+
await publish(repo, usageDir, args);
|
|
62
|
+
|
|
63
|
+
header('Done');
|
|
64
|
+
usageDir.advertise();
|
|
65
|
+
})
|
|
66
|
+
.command('login', 'Login to a given repository', cmd => cmd
|
|
67
|
+
.option('name', {
|
|
68
|
+
alias: 'n',
|
|
69
|
+
description: 'Name of the repository to log in to',
|
|
70
|
+
type: 'string',
|
|
71
|
+
requiresArg: true,
|
|
72
|
+
demandOption: true,
|
|
73
|
+
}), async (args) => {
|
|
74
|
+
|
|
75
|
+
const repo = TestRepository.existing(args.name);
|
|
76
|
+
const usageDir = UsageDir.default();
|
|
77
|
+
|
|
78
|
+
await doLogin(repo, usageDir, args);
|
|
79
|
+
|
|
80
|
+
usageDir.advertise();
|
|
81
|
+
})
|
|
82
|
+
.command('run <DIRECTORY> <COMMAND..>', 'Publish and run a command', cmd => cmd
|
|
83
|
+
.positional('DIRECTORY', {
|
|
84
|
+
descripton: 'Directory distribution',
|
|
85
|
+
type: 'string',
|
|
86
|
+
demandOption: true,
|
|
87
|
+
})
|
|
88
|
+
.positional('COMMAND', {
|
|
89
|
+
alias: 'c',
|
|
90
|
+
description: 'Run the given command with the packages staged',
|
|
91
|
+
type: 'string',
|
|
92
|
+
array: true,
|
|
93
|
+
demandOption: true,
|
|
94
|
+
})
|
|
95
|
+
.option('cleanup', {
|
|
96
|
+
alias: 'C',
|
|
97
|
+
description: 'Cleanup the repository afterwards',
|
|
98
|
+
type: 'boolean',
|
|
99
|
+
default: true,
|
|
100
|
+
requiresArg: false,
|
|
101
|
+
}), async (args) => {
|
|
102
|
+
|
|
103
|
+
await validateDirectory(args);
|
|
104
|
+
const repo = await TestRepository.newRandom();
|
|
105
|
+
const usageDir = UsageDir.default();
|
|
106
|
+
|
|
107
|
+
await doLogin(repo, usageDir, args);
|
|
108
|
+
await publish(repo, usageDir, args);
|
|
109
|
+
|
|
110
|
+
try {
|
|
111
|
+
await usageDir.activateInCurrentProcess();
|
|
112
|
+
|
|
113
|
+
await shell(args.COMMAND ?? [], {
|
|
114
|
+
shell: true,
|
|
115
|
+
show: 'always',
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
} finally {
|
|
119
|
+
if (args.cleanup) {
|
|
120
|
+
await repo.delete();
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
})
|
|
124
|
+
.command('cleanup', 'Clean up testing repository', cmd => cmd
|
|
125
|
+
.option('name', {
|
|
126
|
+
alias: 'n',
|
|
127
|
+
description: 'Name of the repository to cleanup (default: most recent)',
|
|
128
|
+
type: 'string',
|
|
129
|
+
requiresArg: true,
|
|
130
|
+
}), async (args) => {
|
|
131
|
+
|
|
132
|
+
const usageDir = UsageDir.default();
|
|
133
|
+
|
|
134
|
+
let repositoryName = args.name;
|
|
135
|
+
if (!repositoryName) {
|
|
136
|
+
repositoryName = (await usageDir.currentEnv()).CODEARTIFACT_REPO;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (!repositoryName) {
|
|
140
|
+
console.log(`No --name given and no $CODEARTIFACT_REPO found in ${usageDir.directory}, nothing cleaned up`);
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
const repo = TestRepository.existing(repositoryName);
|
|
145
|
+
await repo.delete();
|
|
146
|
+
})
|
|
147
|
+
.command('gc', 'Clean up day-old testing repositories', cmd => cmd, async () => {
|
|
148
|
+
await TestRepository.gc();
|
|
149
|
+
})
|
|
150
|
+
.demandCommand(1, 'You must supply a command')
|
|
151
|
+
.help()
|
|
152
|
+
.showHelpOnFail(false)
|
|
153
|
+
.parse();
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
async function validateDirectory(args: {
|
|
157
|
+
DIRECTORY: string;
|
|
158
|
+
}) {
|
|
159
|
+
if (!await fs.pathExists(path.join(args.DIRECTORY, 'build.json'))) {
|
|
160
|
+
throw new Error(`${args.DIRECTORY} does not look like a CDK dist directory (build.json missing)`);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
async function doLogin(repo: TestRepository, usageDir: UsageDir, args: {
|
|
165
|
+
npm?: boolean;
|
|
166
|
+
python?: boolean;
|
|
167
|
+
java?: boolean;
|
|
168
|
+
dotnet?: boolean;
|
|
169
|
+
}) {
|
|
170
|
+
const login = await repo.loginInformation();
|
|
171
|
+
|
|
172
|
+
const oldEnv = await usageDir.currentEnv();
|
|
173
|
+
|
|
174
|
+
await usageDir.clean();
|
|
175
|
+
await usageDir.addToEnv({
|
|
176
|
+
CODEARTIFACT_REPO: login.repositoryName,
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
if (oldEnv.BUILD_VERSION) {
|
|
180
|
+
await usageDir.addToEnv({
|
|
181
|
+
BUILD_VERSION: oldEnv.BUILD_VERSION,
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
const doRepo = whichRepos(args);
|
|
186
|
+
|
|
187
|
+
await doRepo.npm(() => npmLogin(login, usageDir));
|
|
188
|
+
await doRepo.python(() => pypiLogin(login, usageDir));
|
|
189
|
+
await doRepo.java(() => mavenLogin(login, usageDir));
|
|
190
|
+
await doRepo.dotnet(() => nugetLogin(login, usageDir));
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
async function publish(repo: TestRepository, usageDir: UsageDir, args: {
|
|
194
|
+
DIRECTORY: string;
|
|
195
|
+
npm?: boolean;
|
|
196
|
+
python?: boolean;
|
|
197
|
+
java?: boolean;
|
|
198
|
+
dotnet?: boolean;
|
|
199
|
+
regression?: boolean;
|
|
200
|
+
}) {
|
|
201
|
+
const directory = `${args.DIRECTORY}`;
|
|
202
|
+
const login = await repo.loginInformation();
|
|
203
|
+
|
|
204
|
+
const doRepo = whichRepos(args);
|
|
205
|
+
|
|
206
|
+
const buildJson = await fs.readJson(path.join(directory, 'build.json'));
|
|
207
|
+
await usageDir.addToEnv({
|
|
208
|
+
BUILD_VERSION: buildJson.version,
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
await doRepo.npm(async () => {
|
|
212
|
+
header('NPM');
|
|
213
|
+
await uploadNpmPackages(glob.sync(path.join(directory, 'js', '*.tgz')), login, usageDir);
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
await doRepo.python(async () => {
|
|
217
|
+
header('Python');
|
|
218
|
+
await uploadPythonPackages(glob.sync(path.join(directory, 'python', '*')), login);
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
await doRepo.java(async () => {
|
|
222
|
+
header('Java');
|
|
223
|
+
await uploadJavaPackages(glob.sync(path.join(directory, 'java', '**', '*.pom')), login, usageDir);
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
await doRepo.dotnet(async () => {
|
|
227
|
+
header('.NET');
|
|
228
|
+
await uploadDotnetPackages(glob.sync(path.join(directory, 'dotnet', '**', '*.nupkg')), usageDir);
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
if (args.regression) {
|
|
232
|
+
console.log('🛍 Configuring packages for upstream versions');
|
|
233
|
+
await repo.markAllUpstreamAllow();
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
function whichRepos(args: {
|
|
238
|
+
npm?: boolean;
|
|
239
|
+
python?: boolean;
|
|
240
|
+
java?: boolean;
|
|
241
|
+
dotnet?: boolean;
|
|
242
|
+
}) {
|
|
243
|
+
const all = args.npm === undefined && args.python === undefined && args.java === undefined && args.dotnet === undefined;
|
|
244
|
+
|
|
245
|
+
const invoke = (block: () => Promise<void>) => block();
|
|
246
|
+
const skip = () => { };
|
|
247
|
+
|
|
248
|
+
return {
|
|
249
|
+
npm: args.npm || all ? invoke : skip,
|
|
250
|
+
python: args.python || all ? invoke : skip,
|
|
251
|
+
java: args.java || all ? invoke : skip,
|
|
252
|
+
dotnet: args.dotnet || all ? invoke : skip,
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
function header(caption: string) {
|
|
257
|
+
console.log('');
|
|
258
|
+
console.log('/'.repeat(70));
|
|
259
|
+
console.log(`// ${caption}`);
|
|
260
|
+
console.log('');
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
main().catch(e => {
|
|
264
|
+
// eslint-disable-next-line no-console
|
|
265
|
+
console.error(e);
|
|
266
|
+
process.exitCode = 1;
|
|
267
|
+
});
|
package/bin/test-root
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/bin/test-root.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const path = require("path");
|
|
4
|
+
// eslint-disable-next-line no-console
|
|
5
|
+
console.log(path.resolve(__dirname, '..'));
|
|
6
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdC1yb290LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsidGVzdC1yb290LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsNkJBQTZCO0FBQzdCLHNDQUFzQztBQUN0QyxPQUFPLENBQUMsR0FBRyxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUMsU0FBUyxFQUFFLElBQUksQ0FBQyxDQUFDLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgKiBhcyBwYXRoIGZyb20gJ3BhdGgnO1xuLy8gZXNsaW50LWRpc2FibGUtbmV4dC1saW5lIG5vLWNvbnNvbGVcbmNvbnNvbGUubG9nKHBhdGgucmVzb2x2ZShfX2Rpcm5hbWUsICcuLicpKTtcbiJdfQ==
|
package/bin/test-root.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
#
|
|
3
|
+
# Run our integration tests in regression mode against the
|
|
4
|
+
# candidate version of the framework, which is the one we just packed.
|
|
5
|
+
#
|
|
6
|
+
set -euo pipefail
|
|
7
|
+
integdir=$(cd $(dirname $0) && pwd)
|
|
8
|
+
|
|
9
|
+
source ${integdir}/test-cli-regression.bash
|
|
10
|
+
|
|
11
|
+
run_regression_against_framework_version CANDIDATE_VERSION
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
#
|
|
3
|
+
# Run our integration tests in regression mode against the
|
|
4
|
+
# previous version of the framework, relative to the version being packed now.
|
|
5
|
+
#
|
|
6
|
+
set -euo pipefail
|
|
7
|
+
integdir=$(cd $(dirname $0) && pwd)
|
|
8
|
+
|
|
9
|
+
source ${integdir}/test-cli-regression.bash
|
|
10
|
+
|
|
11
|
+
run_regression_against_framework_version PREVIOUS_VERSION
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
#
|
|
3
|
+
# Helper functions for CLI regression tests.
|
|
4
|
+
#
|
|
5
|
+
set -euo pipefail
|
|
6
|
+
integdir=$(cd $(dirname $0) && pwd)
|
|
7
|
+
|
|
8
|
+
# Run our integration tests in regression mode.
|
|
9
|
+
#
|
|
10
|
+
# 1. Figure out what was the previous (relative to the current candidate) version we published.
|
|
11
|
+
# 2. Download the integration tests artifact from that version.
|
|
12
|
+
# 2. Copy its integration tests directory ((test/integ/cli)) here.
|
|
13
|
+
# 3. Run the integration tests from the copied directory.
|
|
14
|
+
#
|
|
15
|
+
# Positional Arugments:
|
|
16
|
+
#
|
|
17
|
+
# 1) Framework version identifier. Which version of the framework should the tests run against. Options are:
|
|
18
|
+
#
|
|
19
|
+
# - CANDIDATE_VERSION: Use the candidate code, i.e the one being built right now.
|
|
20
|
+
# - PREVIOUS_VERSION: Use the previous version code, i.e the published version prior to CANDIDATE_VERSION.
|
|
21
|
+
#
|
|
22
|
+
function run_regression_against_framework_version() {
|
|
23
|
+
|
|
24
|
+
TEST_RUNNER=${TEST_RUNNER:-""}
|
|
25
|
+
CANDIDATE_VERSION=${CANDIDATE_VERSION:-""}
|
|
26
|
+
|
|
27
|
+
if [ "${TEST_RUNNER}" != "dist" ]; then
|
|
28
|
+
echo "Unsupported runner: ${TEST_RUNNER}. Regression tests can only run with the 'dist' runner"
|
|
29
|
+
exit 1
|
|
30
|
+
fi
|
|
31
|
+
|
|
32
|
+
SUPPORTED_FRAMEWORK_VERSION_IDENTIFIERS=("CANDIDATE_VERSION PREVIOUS_VERSION")
|
|
33
|
+
FRAMEWORK_VERSION_IDENTIFIER=$1
|
|
34
|
+
if [[ ! " ${SUPPORTED_FRAMEWORK_VERSION_IDENTIFIERS[@]} " =~ " ${FRAMEWORK_VERSION_IDENTIFIER} " ]]; then
|
|
35
|
+
echo "Unsupported framework version identifier. Should be one of ${SUPPORTED_FRAMEWORK_VERSION_IDENTIFIERS}"
|
|
36
|
+
exit 1
|
|
37
|
+
fi
|
|
38
|
+
|
|
39
|
+
echo "Fetching previous version for candidate: ${CANDIDATE_VERSION}"
|
|
40
|
+
|
|
41
|
+
# we need to explicitly install these deps because this script is executed
|
|
42
|
+
# int the test phase, which means the cwd is the packaged dist directory,
|
|
43
|
+
# so it doesn't have the dependencies installed from the installation of the package.json
|
|
44
|
+
# in the build phase. maybe we should just run npm install on the package.json again?
|
|
45
|
+
npm install @octokit/rest@^18.0.6 semver@^7.3.2 make-runnable@^1.3.8
|
|
46
|
+
PREVIOUS_VERSION=$(node ${integdir}/github-helpers.js fetchPreviousVersion ${CANDIDATE_VERSION})
|
|
47
|
+
|
|
48
|
+
echo "Previous version is: ${PREVIOUS_VERSION}"
|
|
49
|
+
|
|
50
|
+
temp_dir=$(mktemp -d)
|
|
51
|
+
integ_under_test=${integdir}/cli-backwards-tests-${PREVIOUS_VERSION}
|
|
52
|
+
|
|
53
|
+
pushd ${temp_dir}
|
|
54
|
+
|
|
55
|
+
echo "Downloading aws-cdk ${PREVIOUS_VERSION} tarball from npm"
|
|
56
|
+
npm pack aws-cdk@${PREVIOUS_VERSION}
|
|
57
|
+
tar -zxf aws-cdk-${PREVIOUS_VERSION}.tgz
|
|
58
|
+
|
|
59
|
+
rm -rf ${integ_under_test}
|
|
60
|
+
|
|
61
|
+
echo "Copying integration tests of version ${PREVIOUS_VERSION} to ${integ_under_test} (dont worry, its gitignored)"
|
|
62
|
+
cp -r ${temp_dir}/package/test/integ/cli "${integ_under_test}"
|
|
63
|
+
cp -r ${temp_dir}/package/test/integ/helpers "${integ_under_test}"
|
|
64
|
+
|
|
65
|
+
patch_dir="${integdir}/cli-regression-patches/v${PREVIOUS_VERSION}"
|
|
66
|
+
# delete possibly stale junit.xml file
|
|
67
|
+
rm -f ${integ_under_test}/junit.xml
|
|
68
|
+
if [[ -d "$patch_dir" ]]; then
|
|
69
|
+
echo "Hotpatching the tests with files from $patch_dir" >&2
|
|
70
|
+
cp -r "$patch_dir"/* ${integ_under_test}
|
|
71
|
+
fi
|
|
72
|
+
|
|
73
|
+
popd
|
|
74
|
+
|
|
75
|
+
# the framework version to use is determined by the caller as the first argument.
|
|
76
|
+
# its a variable name indirection.
|
|
77
|
+
export FRAMEWORK_VERSION=${!FRAMEWORK_VERSION_IDENTIFIER}
|
|
78
|
+
|
|
79
|
+
# Show the versions we settled on
|
|
80
|
+
echo "♈️ Regression testing [cli $(cdk --version)] against [framework ${FRAMEWORK_VERSION}] using [tests ${PREVIOUS_VERSION}}]"
|
|
81
|
+
|
|
82
|
+
${integ_under_test}/test.sh
|
|
83
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
scriptdir=$(cd $(dirname $0) && pwd)
|
|
4
|
+
|
|
5
|
+
echo '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
|
|
6
|
+
echo 'CLI Integration Tests'
|
|
7
|
+
echo '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
|
|
8
|
+
|
|
9
|
+
cd $scriptdir
|
|
10
|
+
|
|
11
|
+
source ../common/jest-test.bash
|
|
12
|
+
invokeJest "$@"
|
package/lib/aws.d.ts
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { CloudFormationClient, type Stack } from '@aws-sdk/client-cloudformation';
|
|
2
|
+
import { ECRClient } from '@aws-sdk/client-ecr';
|
|
3
|
+
import { ECSClient } from '@aws-sdk/client-ecs';
|
|
4
|
+
import { IAMClient } from '@aws-sdk/client-iam';
|
|
5
|
+
import { LambdaClient } from '@aws-sdk/client-lambda';
|
|
6
|
+
import { S3Client } from '@aws-sdk/client-s3';
|
|
7
|
+
import { SNSClient } from '@aws-sdk/client-sns';
|
|
8
|
+
import { SSOClient } from '@aws-sdk/client-sso';
|
|
9
|
+
import { STSClient } from '@aws-sdk/client-sts';
|
|
10
|
+
export declare class AwsClients {
|
|
11
|
+
readonly region: string;
|
|
12
|
+
private readonly output;
|
|
13
|
+
static default(output: NodeJS.WritableStream): Promise<AwsClients>;
|
|
14
|
+
static forRegion(region: string, output: NodeJS.WritableStream): Promise<AwsClients>;
|
|
15
|
+
private readonly config;
|
|
16
|
+
readonly cloudFormation: CloudFormationClient;
|
|
17
|
+
readonly s3: S3Client;
|
|
18
|
+
readonly ecr: ECRClient;
|
|
19
|
+
readonly ecs: ECSClient;
|
|
20
|
+
readonly sso: SSOClient;
|
|
21
|
+
readonly sns: SNSClient;
|
|
22
|
+
readonly iam: IAMClient;
|
|
23
|
+
readonly lambda: LambdaClient;
|
|
24
|
+
readonly sts: STSClient;
|
|
25
|
+
constructor(region: string, output: NodeJS.WritableStream);
|
|
26
|
+
account(): Promise<string>;
|
|
27
|
+
deleteStacks(...stackNames: string[]): Promise<void>;
|
|
28
|
+
stackStatus(stackName: string): Promise<string | undefined>;
|
|
29
|
+
emptyBucket(bucketName: string, options?: {
|
|
30
|
+
bypassGovernance?: boolean;
|
|
31
|
+
}): Promise<void | import("@aws-sdk/client-s3").DeleteObjectsCommandOutput>;
|
|
32
|
+
deleteImageRepository(repositoryName: string): Promise<void>;
|
|
33
|
+
deleteBucket(bucketName: string): Promise<void>;
|
|
34
|
+
}
|
|
35
|
+
export declare function isStackMissingError(e: Error): boolean;
|
|
36
|
+
export declare function isBucketMissingError(e: Error): boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Retry an async operation until a deadline is hit.
|
|
39
|
+
*
|
|
40
|
+
* Use `retry.forSeconds()` to construct a deadline relative to right now.
|
|
41
|
+
*
|
|
42
|
+
* Exceptions will cause the operation to retry. Use `retry.abort` to annotate an exception
|
|
43
|
+
* to stop the retry and end in a failure.
|
|
44
|
+
*/
|
|
45
|
+
export declare function retry<A>(output: NodeJS.WritableStream, operation: string, deadline: Date, block: () => Promise<A>): Promise<A>;
|
|
46
|
+
export declare namespace retry {
|
|
47
|
+
var forSeconds: (seconds: number) => Date;
|
|
48
|
+
var abort: (e: Error) => Error;
|
|
49
|
+
}
|
|
50
|
+
export declare function outputFromStack(key: string, stack: Stack): string | undefined;
|
|
51
|
+
export declare function sleep(ms: number): Promise<unknown>;
|