Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cli): bootstrap respects qualifier from cdk.json #31410

Merged
merged 5 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion packages/aws-cdk/lib/api/bootstrap/bootstrap-props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,5 +129,4 @@ export interface BootstrappingParameters {
* @default - No value, optional argument
*/
readonly customPermissionsBoundary?: string;

}
2 changes: 1 addition & 1 deletion packages/aws-cdk/lib/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ export async function exec(args: string[], synthesizer?: Synthesizer): Promise<n
bucketName: configuration.settings.get(['toolkitBucket', 'bucketName']),
kmsKeyId: configuration.settings.get(['toolkitBucket', 'kmsKeyId']),
createCustomerMasterKey: args.bootstrapCustomerKey,
qualifier: args.qualifier,
qualifier: args.qualifier ?? configuration.context.get('@aws-cdk/core:bootstrapQualifier'),
publicAccessBlockConfiguration: args.publicAccessBlockConfiguration,
examplePermissionsBoundary: argv.examplePermissionsBoundary,
customPermissionsBoundary: argv.customPermissionsBoundary,
Expand Down
25 changes: 24 additions & 1 deletion packages/aws-cdk/test/cdk-toolkit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ import { HotswapMode } from '../lib/api/hotswap/common';
import { Template } from '../lib/api/util/cloudformation';
import { CdkToolkit, Tag } from '../lib/cdk-toolkit';
import { RequireApproval } from '../lib/diff';
import { Configuration } from '../lib/settings';
import { flatten } from '../lib/util';

let cloudExecutable: MockCloudExecutable;
Expand Down Expand Up @@ -115,7 +116,6 @@ describe('readCurrentTemplate', () => {
let mockForEnvironment = jest.fn();
let mockCloudExecutable: MockCloudExecutable;
beforeEach(() => {

template = {
Resources: {
Func: {
Expand Down Expand Up @@ -394,6 +394,29 @@ describe('readCurrentTemplate', () => {
});
});

describe('bootstrap', () => {
test('accepts qualifier from context', async () => {
// GIVEN
const toolkit = defaultToolkitSetup();
const configuration = new Configuration();
configuration.context.set('@aws-cdk/core:bootstrapQualifier', 'abcde');

// WHEN
await toolkit.bootstrap(['aws://56789/south-pole'], bootstrapper, {
parameters: {
qualifier: configuration.context.get('@aws-cdk/core:bootstrapQualifier'),
},
});

// THEN
expect(bootstrapper.bootstrapEnvironment).toHaveBeenCalledWith(expect.anything(), expect.anything(), {
parameters: {
qualifier: 'abcde',
},
});
});
});

describe('deploy', () => {
test('fails when no valid stack names are given', async () => {
// GIVEN
Expand Down
Loading