@aws-cdk-testing/cli-integ 3.0.1 → 3.1.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/lib/aws.js +2 -2
- package/lib/aws.ts +1 -1
- package/lib/integ-test.js +37 -6
- package/lib/integ-test.ts +42 -5
- package/lib/shell.d.ts +5 -2
- package/lib/shell.js +16 -8
- package/lib/shell.ts +16 -9
- package/lib/with-cdk-app.js +7 -2
- package/lib/with-cdk-app.ts +6 -1
- package/lib/with-sam.js +26 -21
- package/lib/with-sam.ts +23 -21
- package/package.json +4 -4
- package/resources/cdk-apps/app/app.js +3 -3
- package/resources/cdk-apps/rollback-test-app/app.js +1 -1
- package/resources/cdk-apps/sam_cdk_integ_app/lib/test-stack.js +3 -1
- package/resources/cli-regression-patches/v1.130.0/bootstrapping.integtest.js +1 -1
- package/tests/init-go/init-go.integtest.js +7 -2
- package/tests/init-go/init-go.integtest.ts +6 -1
- package/tests/init-typescript-app/init-typescript-app.integtest.js +3 -3
- package/tests/init-typescript-app/init-typescript-app.integtest.ts +4 -3
- package/bin/query-github.ts +0 -56
- package/bin/run-suite.ts +0 -140
- package/bin/stage-distribution.ts +0 -267
- package/bin/test-root.ts +0 -3
|
@@ -1,267 +0,0 @@
|
|
|
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.ts
DELETED