From bbc26287244d65fa41de102e6f0c6677b9de9d0c Mon Sep 17 00:00:00 2001 From: Madeline Kusters <80541297+madeline-k@users.noreply.github.com> Date: Tue, 29 Mar 2022 15:07:13 -0700 Subject: [PATCH] =?UTF-8?q?chore(aws-cdk):=20Revert=20"fix(aws-cdk):=20inc?= =?UTF-8?q?lude=20nested=20stacks=20when=20building=20changesets=20?= =?UTF-8?q?=E2=80=A6=20(#19618)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit …(#19494)" This reverts commit 97cc8e29e155b222d553b1fe955a0302036feed5. Reverting this commit since it introduced a regression. Or, it is not a regression but the regression runs of the CLI integ tests think it is. The same test fails in the run-against-latest-release and the run-against-latest-code regression test suites: https://github.com/aws/aws-cdk/blob/master/packages/aws-cdk/test/integ/cli/cli.integtest.ts#L629. Test fails with: ``` expect(received).not.toEqual(expected) // deep equality Expected: not "arn:aws:cloudformation:ap-southeast-2:416588550161:changeSet/cdk-deploy-change-set/c8c68622-fc38-4199-81b2-b74206380152" at cli.integtest.ts:644:38 at runMicrotasks () at ../helpers/cdk.ts:130:7 at ResourcePool.using (../helpers/resource-pool.ts:44:14) at ../helpers/test-helpers.ts:38:14 ``` ---- ### All Submissions: * [ ] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/master/CONTRIBUTING.md) ### Adding new Unconventional Dependencies: * [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/master/CONTRIBUTING.md/#adding-new-unconventional-dependencies) ### New Features * [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/master/INTEGRATION_TESTS.md)? * [ ] Did you use `cdk-integ` to deploy the infrastructure and generate the snapshot (i.e. `cdk-integ` without `--dry-run`)? *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- packages/aws-cdk/lib/api/deploy-stack.ts | 1 - packages/aws-cdk/test/api/deploy-stack.test.ts | 12 ------------ packages/aws-cdk/test/integ/cli/cli.integtest.ts | 9 +++------ packages/aws-cdk/test/integ/helpers/cdk.ts | 6 ++++-- 4 files changed, 7 insertions(+), 21 deletions(-) diff --git a/packages/aws-cdk/lib/api/deploy-stack.ts b/packages/aws-cdk/lib/api/deploy-stack.ts index d8f8a390677bf..76b9386cc9550 100644 --- a/packages/aws-cdk/lib/api/deploy-stack.ts +++ b/packages/aws-cdk/lib/api/deploy-stack.ts @@ -299,7 +299,6 @@ async function prepareAndExecuteChangeSet( StackName: deployName, ChangeSetName: changeSetName, ChangeSetType: update ? 'UPDATE' : 'CREATE', - IncludeNestedStacks: true, Description: `CDK Changeset for execution ${executionId}`, TemplateBody: bodyParameter.TemplateBody, TemplateURL: bodyParameter.TemplateURL, diff --git a/packages/aws-cdk/test/api/deploy-stack.test.ts b/packages/aws-cdk/test/api/deploy-stack.test.ts index d8eb55bf77eaa..2b199ea225b87 100644 --- a/packages/aws-cdk/test/api/deploy-stack.test.ts +++ b/packages/aws-cdk/test/api/deploy-stack.test.ts @@ -164,18 +164,6 @@ test('correctly passes CFN parameters, ignoring ones with empty values', async ( })); }); -test('correctly passes IncludeNestedStacks', async () => { - // WHEN - await deployStack({ - ...standardDeployStackArguments(), - }); - - // THEN - expect(cfnMocks.createChangeSet).toHaveBeenCalledWith(expect.objectContaining({ - IncludeNestedStacks: true, - })); -}); - test('reuse previous parameters if requested', async () => { // GIVEN givenStackExists({ diff --git a/packages/aws-cdk/test/integ/cli/cli.integtest.ts b/packages/aws-cdk/test/integ/cli/cli.integtest.ts index 627dc150c36bf..7f65950550cb4 100644 --- a/packages/aws-cdk/test/integ/cli/cli.integtest.ts +++ b/packages/aws-cdk/test/integ/cli/cli.integtest.ts @@ -638,13 +638,10 @@ integTest('fast deploy', withDefaultFixture(async (fixture) => { const changeSet2 = await getLatestChangeSet(); expect(changeSet2.ChangeSetId).toEqual(changeSet1.ChangeSetId); - // Deploy the stack again with --force. This creates a changeset which will be - // empty (since CFN now tracks changes into nested stacks as well), so we delete - // it again because it couldn't be executed anyway. - const output = await fixture.cdkDeploy('with-nested-stack', { options: ['--force'] }); + // Deploy the stack again with --force, now we should create a changeset + await fixture.cdkDeploy('with-nested-stack', { options: ['--force'] }); const changeSet3 = await getLatestChangeSet(); - expect(output).toContain('No changes are to be performed on'); - expect(changeSet3.ChangeSetId).toEqual(changeSet2.ChangeSetId); + expect(changeSet3.ChangeSetId).not.toEqual(changeSet2.ChangeSetId); // Deploy the stack again with tags, expected to create a new changeset // even though the resources didn't change. diff --git a/packages/aws-cdk/test/integ/helpers/cdk.ts b/packages/aws-cdk/test/integ/helpers/cdk.ts index 62a6abd08afce..75787ab7b747c 100644 --- a/packages/aws-cdk/test/integ/helpers/cdk.ts +++ b/packages/aws-cdk/test/integ/helpers/cdk.ts @@ -720,9 +720,11 @@ export async function installNpmPackages(fixture: TestFixture, packages: Record< const installNpm7 = memoize0(async (): Promise => { const installDir = path.join(os.tmpdir(), 'cdk-integ-npm7'); await shell(['rm', '-rf', installDir]); - await shell(['mkdir', '-p', `${installDir}/node_modules`]); + await shell(['mkdir', '-p', installDir]); - await shell(['npm', 'install', 'npm@7'], { cwd: installDir }); + await shell(['npm', 'install', + '--prefix', installDir, + 'npm@7']); return path.join(installDir, 'node_modules', '.bin', 'npm'); });