Skip to content

Commit cae757a

Browse files
Merge pull request #1408 from pwrmiller/main
feat!: cdkCliVersion parameter renamed to cdkAssetsVersion
2 parents bd20e46 + f4c7bc3 commit cae757a

File tree

4 files changed

+127
-9
lines changed

4 files changed

+127
-9
lines changed

API.md

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/pipeline.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,10 @@ export interface GitHubWorkflowProps extends PipelineBaseProps {
8484
readonly concurrency?: github.ConcurrencyOptions;
8585

8686
/**
87-
* Version of the CDK CLI to use.
87+
* Version of the [cdk-assets package](https://www.npmjs.com/package/cdk-assets) to use.
8888
* @default - automatic
8989
*/
90-
readonly cdkCliVersion?: string;
90+
readonly cdkAssetsVersion?: string;
9191

9292
/**
9393
* Indicates if the repository already contains a synthesized `cdk.out` directory, in which
@@ -204,7 +204,7 @@ export class GitHubWorkflow extends PipelineBase {
204204
private readonly preSynthed: boolean;
205205
private readonly awsCredentials: AwsCredentialsProvider;
206206
private readonly dockerCredentials: DockerCredential[];
207-
private readonly cdkCliVersion?: string;
207+
private readonly cdkAssetsVersion?: string;
208208
private readonly buildContainer?: github.ContainerOptions;
209209
private readonly preBuildSteps: github.JobStep[];
210210
private readonly postBuildSteps: github.JobStep[];
@@ -229,7 +229,7 @@ export class GitHubWorkflow extends PipelineBase {
229229
constructor(scope: Construct, id: string, props: GitHubWorkflowProps) {
230230
super(scope, id, props);
231231

232-
this.cdkCliVersion = props.cdkCliVersion;
232+
this.cdkAssetsVersion = props.cdkAssetsVersion;
233233
this.preSynthed = props.preSynthed ?? false;
234234
this.buildContainer = props.buildContainer;
235235
this.preBuildSteps = props.preBuildSteps ?? [];
@@ -538,7 +538,7 @@ export class GitHubWorkflow extends PipelineBase {
538538
throw new Error('Asset Publish step must have at least 1 asset');
539539
}
540540

541-
const installSuffix = this.cdkCliVersion ? `@${this.cdkCliVersion}` : '';
541+
const installSuffix = this.cdkAssetsVersion ? `@${this.cdkAssetsVersion}` : '';
542542
const cdkoutDir = options.assemblyDir;
543543
const jobId = node.uniqueId;
544544
const { assetId, assetManifestPath } = assets[0];

test/__snapshots__/github.test.ts.snap

Lines changed: 92 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/github.test.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -673,3 +673,29 @@ function wrapEnv(variable: string, value: string, cb: () => void) {
673673
process.env[variable] = original;
674674
}
675675
}
676+
677+
test('pipeline with cdkAssetVersion override', () => {
678+
withTemporaryDirectory((dir) => {
679+
const github = new GitHubWorkflow(app, 'Pipeline', {
680+
workflowPath: `${dir}/.github/workflows/deploy.yml`,
681+
synth: new ShellStep('Build', {
682+
installCommands: ['yarn'],
683+
commands: ['yarn build'],
684+
}),
685+
runner: Runner.WINDOWS_LATEST,
686+
cdkAssetsVersion: '4.2.0',
687+
});
688+
689+
const stage = new Stage(app, 'MyStack', {
690+
env: { account: '111111111111', region: 'us-east-1' },
691+
});
692+
693+
new Stack(stage, 'MyStack');
694+
695+
github.addStage(stage);
696+
697+
app.synth();
698+
699+
expect(readFileSync(github.workflowPath, 'utf-8')).toMatchSnapshot();
700+
});
701+
});

0 commit comments

Comments
 (0)