Skip to content

Commit 4db1516

Browse files
rix0rrrgithub-actions
and
github-actions
authored
feat(cli-integ-test): allow configuring upstream versions (#824)
* feat(cli-integ-test): allow configuring upstream versions Allows configuring that upstream versions are visible for select packages. This will be used for `@aws-cdk/cloud-assembly-schema`, which we will need available under the new version (for `cdk-assets`) as well as under an old version (for `aws-cdk-lib`). * chore: self mutation Signed-off-by: github-actions <[email protected]> --------- Signed-off-by: github-actions <[email protected]> Co-authored-by: github-actions <[email protected]>
1 parent 2c3bab6 commit 4db1516

File tree

4 files changed

+36
-2
lines changed

4 files changed

+36
-2
lines changed

API.md

+16
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/cdk-cli-integ-tests.ts

+18-1
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,22 @@ export interface CdkCliIntegTestsWorkflowProps {
3333

3434
/**
3535
* Packages that are locally transfered (we will never use the upstream versions)
36+
*
37+
* Takes package names; these are expected to live in `packages/<NAME>/dist/js`.
3638
*/
3739
readonly localPackages: string[];
3840

3941
/**
4042
* The official repo this workflow is used for
4143
*/
4244
readonly sourceRepo: string;
45+
46+
/**
47+
* If given, allows accessing upstream versions of these packages
48+
*
49+
* @default - No upstream versions
50+
*/
51+
readonly allowUpstreamVersions?: string[];
4352
}
4453

4554
/**
@@ -79,6 +88,12 @@ export class CdkCliIntegTestsWorkflow extends Component {
7988
}
8089
((buildWorkflow as any).workflow as github.GithubWorkflow);
8190

91+
props.allowUpstreamVersions?.forEach((pack) => {
92+
if (!props.localPackages.includes(pack)) {
93+
throw new Error(`Package in allowUpstreamVersions but not in localPackages: ${pack}`);
94+
}
95+
});
96+
8297
runTestsWorkflow.on({
8398
pullRequestTarget: {
8499
branches: ['main'],
@@ -182,10 +197,12 @@ export class CdkCliIntegTestsWorkflow extends Component {
182197
};
183198

184199
for (const pack of props.localPackages) {
200+
const allowUpstream = props.allowUpstreamVersions?.includes(pack);
201+
185202
verdaccioConfig.packages[pack] = {
186203
access: '$all',
187204
publish: '$all',
188-
proxy: 'none',
205+
proxy: allowUpstream ? 'npmjs' : 'none',
189206
};
190207
};
191208
verdaccioConfig.packages['**'] = {

test/__snapshots__/cdk-cli-integ-tests.test.ts.snap

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/cdk-cli-integ-tests.test.ts

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ test('snapshot test for the CDK CLI integ tests', () => {
1414
testRunsOn: 'testRunsOn',
1515
localPackages: ['@aws-cdk/bla', '@aws-cdk/bloeh'],
1616
sourceRepo: 'aws/some-repo',
17+
allowUpstreamVersions: ['@aws-cdk/bla'],
1718
});
1819

1920
const outdir = Testing.synth(repo);

0 commit comments

Comments
 (0)