From 8ab84ec69854ae636c07e6f58ba57757b2876168 Mon Sep 17 00:00:00 2001 From: Elad Ben-Israel Date: Sun, 23 Jun 2019 23:31:14 +0300 Subject: [PATCH] refactor(cx-api): bump cli <=> cdk protocol version (#2956) following up on #2922, manifest may include "env" that indicates unknown-account/unknown-region, which will cause old CLIs to fail, so we must bump the version to ensure compatibility. BREAKING CHANGE: Previous versions of the CDK CLI will not be fully compatible with this version of the framework and vice versa. --- packages/@aws-cdk/cdk/test/test.synthesis.ts | 2 +- packages/@aws-cdk/cx-api/lib/cloud-assembly.ts | 2 +- packages/@aws-cdk/cx-api/lib/versioning.ts | 2 +- .../cx-api/test/__snapshots__/cloud-assembly.test.js.snap | 2 +- packages/@aws-cdk/cx-api/test/cloud-assembly.test.ts | 6 +++--- packages/@aws-cdk/cx-api/test/fixtures/assets/manifest.json | 2 +- .../@aws-cdk/cx-api/test/fixtures/depends/manifest.json | 2 +- packages/@aws-cdk/cx-api/test/fixtures/empty/manifest.json | 2 +- .../test/fixtures/invalid-artifact-type/manifest.json | 2 +- .../cx-api/test/fixtures/invalid-depends/manifest.json | 2 +- .../cx-api/test/fixtures/invalid-env-format/manifest.json | 2 +- .../cx-api/test/fixtures/logical-id-map/manifest.json | 2 +- .../@aws-cdk/cx-api/test/fixtures/messages/manifest.json | 2 +- .../cx-api/test/fixtures/missing-context/manifest.json | 2 +- .../cx-api/test/fixtures/multiple-stacks/manifest.json | 2 +- .../cx-api/test/fixtures/single-stack/manifest.json | 2 +- .../cx-api/test/fixtures/stack-without-params/manifest.json | 2 +- 17 files changed, 19 insertions(+), 19 deletions(-) diff --git a/packages/@aws-cdk/cdk/test/test.synthesis.ts b/packages/@aws-cdk/cdk/test/test.synthesis.ts index 4da477d69c07c..90aa0102d44c2 100644 --- a/packages/@aws-cdk/cdk/test/test.synthesis.ts +++ b/packages/@aws-cdk/cdk/test/test.synthesis.ts @@ -78,7 +78,7 @@ export = { ]); test.deepEqual(readJson(session.directory, 'foo.json'), { bar: 123 }); test.deepEqual(session.manifest, { - version: '0.34.0', + version: '0.36.0', artifacts: { 'my-random-construct': { type: 'aws:cloudformation:stack', diff --git a/packages/@aws-cdk/cx-api/lib/cloud-assembly.ts b/packages/@aws-cdk/cx-api/lib/cloud-assembly.ts index cc48c79cdacc7..6412a42d16dbe 100644 --- a/packages/@aws-cdk/cx-api/lib/cloud-assembly.ts +++ b/packages/@aws-cdk/cx-api/lib/cloud-assembly.ts @@ -209,7 +209,7 @@ export class CloudAssemblyBuilder { // "backwards compatibility": in order for the old CLI to tell the user they // need a new version, we'll emit the legacy manifest with only "version". - // this will result in an error "CDK Toolkit >= 0.34.0 is required in order to interact with this program." + // this will result in an error "CDK Toolkit >= CLOUD_ASSEMBLY_VERSION is required in order to interact with this program." fs.writeFileSync(path.join(this.outdir, 'cdk.out'), JSON.stringify({ version: CLOUD_ASSEMBLY_VERSION })); return new CloudAssembly(this.outdir); diff --git a/packages/@aws-cdk/cx-api/lib/versioning.ts b/packages/@aws-cdk/cx-api/lib/versioning.ts index f5d2be483dc91..ae684a8361bc0 100644 --- a/packages/@aws-cdk/cx-api/lib/versioning.ts +++ b/packages/@aws-cdk/cx-api/lib/versioning.ts @@ -16,7 +16,7 @@ import semver = require('semver'); * updated (as the current verison in package.json has already been released!) * - The request does not have versioning yet, only the response. */ -export const CLOUD_ASSEMBLY_VERSION = '0.34.0'; +export const CLOUD_ASSEMBLY_VERSION = '0.36.0'; /** * Look at the type of response we get and upgrade it to the latest expected version diff --git a/packages/@aws-cdk/cx-api/test/__snapshots__/cloud-assembly.test.js.snap b/packages/@aws-cdk/cx-api/test/__snapshots__/cloud-assembly.test.js.snap index 76fbb4eeb9785..c80da3f4d669b 100644 --- a/packages/@aws-cdk/cx-api/test/__snapshots__/cloud-assembly.test.js.snap +++ b/packages/@aws-cdk/cx-api/test/__snapshots__/cloud-assembly.test.js.snap @@ -39,7 +39,7 @@ Array [ exports[`empty assembly 1`] = ` Object { - "version": "0.34.0", + "version": "0.36.0", } `; diff --git a/packages/@aws-cdk/cx-api/test/cloud-assembly.test.ts b/packages/@aws-cdk/cx-api/test/cloud-assembly.test.ts index 3f66e6c38f215..87ef7f7da341b 100644 --- a/packages/@aws-cdk/cx-api/test/cloud-assembly.test.ts +++ b/packages/@aws-cdk/cx-api/test/cloud-assembly.test.ts @@ -87,7 +87,7 @@ test('fails for invalid dependencies', () => { }); test('verifyManifestVersion', () => { - verifyManifestVersion('0.34.0'); - expect(() => verifyManifestVersion('0.31.0')).toThrow('CDK CLI can only be used with apps created by CDK >= 0.34.0'); - expect(() => verifyManifestVersion('0.35.0')).toThrow('CDK CLI >= 0.35.0 is required to interact with this app'); + verifyManifestVersion(CLOUD_ASSEMBLY_VERSION); + expect(() => verifyManifestVersion('0.31.0')).toThrow(`CDK CLI can only be used with apps created by CDK >= ${CLOUD_ASSEMBLY_VERSION}`); + expect(() => verifyManifestVersion('99.99.99')).toThrow(`CDK CLI >= 99.99.99 is required to interact with this app`); }); \ No newline at end of file diff --git a/packages/@aws-cdk/cx-api/test/fixtures/assets/manifest.json b/packages/@aws-cdk/cx-api/test/fixtures/assets/manifest.json index 7a82e769c79e4..353fb533e0d85 100644 --- a/packages/@aws-cdk/cx-api/test/fixtures/assets/manifest.json +++ b/packages/@aws-cdk/cx-api/test/fixtures/assets/manifest.json @@ -1,5 +1,5 @@ { - "version": "0.34.0", + "version": "0.36.0", "artifacts": { "MyStackName": { "type": "aws:cloudformation:stack", diff --git a/packages/@aws-cdk/cx-api/test/fixtures/depends/manifest.json b/packages/@aws-cdk/cx-api/test/fixtures/depends/manifest.json index a611f4b5b62b3..d33226288d567 100644 --- a/packages/@aws-cdk/cx-api/test/fixtures/depends/manifest.json +++ b/packages/@aws-cdk/cx-api/test/fixtures/depends/manifest.json @@ -1,5 +1,5 @@ { - "version": "0.34.0", + "version": "0.36.0", "artifacts": { "StackA": { "type": "aws:cloudformation:stack", diff --git a/packages/@aws-cdk/cx-api/test/fixtures/empty/manifest.json b/packages/@aws-cdk/cx-api/test/fixtures/empty/manifest.json index 11b30463aa234..066fd21aa9379 100644 --- a/packages/@aws-cdk/cx-api/test/fixtures/empty/manifest.json +++ b/packages/@aws-cdk/cx-api/test/fixtures/empty/manifest.json @@ -1,3 +1,3 @@ { - "version": "0.34.0" + "version": "0.36.0" } \ No newline at end of file diff --git a/packages/@aws-cdk/cx-api/test/fixtures/invalid-artifact-type/manifest.json b/packages/@aws-cdk/cx-api/test/fixtures/invalid-artifact-type/manifest.json index 0c92139477a1d..3f62abc47b4c0 100644 --- a/packages/@aws-cdk/cx-api/test/fixtures/invalid-artifact-type/manifest.json +++ b/packages/@aws-cdk/cx-api/test/fixtures/invalid-artifact-type/manifest.json @@ -1,5 +1,5 @@ { - "version": "0.34.0", + "version": "0.36.0", "artifacts": { "MyArt": { "type": "who:am:i", diff --git a/packages/@aws-cdk/cx-api/test/fixtures/invalid-depends/manifest.json b/packages/@aws-cdk/cx-api/test/fixtures/invalid-depends/manifest.json index 2f15a7b00a313..adfb3c85ac697 100644 --- a/packages/@aws-cdk/cx-api/test/fixtures/invalid-depends/manifest.json +++ b/packages/@aws-cdk/cx-api/test/fixtures/invalid-depends/manifest.json @@ -1,5 +1,5 @@ { - "version": "0.34.0", + "version": "0.36.0", "artifacts": { "StackA": { "type": "aws:cloudformation:stack", diff --git a/packages/@aws-cdk/cx-api/test/fixtures/invalid-env-format/manifest.json b/packages/@aws-cdk/cx-api/test/fixtures/invalid-env-format/manifest.json index db458ca00d7b5..89ad8f9c5296e 100644 --- a/packages/@aws-cdk/cx-api/test/fixtures/invalid-env-format/manifest.json +++ b/packages/@aws-cdk/cx-api/test/fixtures/invalid-env-format/manifest.json @@ -1,5 +1,5 @@ { - "version": "0.34.0", + "version": "0.36.0", "artifacts": { "MyStackName": { "type": "aws:cloudformation:stack", diff --git a/packages/@aws-cdk/cx-api/test/fixtures/logical-id-map/manifest.json b/packages/@aws-cdk/cx-api/test/fixtures/logical-id-map/manifest.json index 063f712757085..18901db071707 100644 --- a/packages/@aws-cdk/cx-api/test/fixtures/logical-id-map/manifest.json +++ b/packages/@aws-cdk/cx-api/test/fixtures/logical-id-map/manifest.json @@ -1,5 +1,5 @@ { - "version": "0.34.0", + "version": "0.36.0", "artifacts": { "MyStackName": { "type": "aws:cloudformation:stack", diff --git a/packages/@aws-cdk/cx-api/test/fixtures/messages/manifest.json b/packages/@aws-cdk/cx-api/test/fixtures/messages/manifest.json index d90c854d19241..c5e99392312c9 100644 --- a/packages/@aws-cdk/cx-api/test/fixtures/messages/manifest.json +++ b/packages/@aws-cdk/cx-api/test/fixtures/messages/manifest.json @@ -1,5 +1,5 @@ { - "version": "0.34.0", + "version": "0.36.0", "artifacts": { "MyStackName": { "type": "aws:cloudformation:stack", diff --git a/packages/@aws-cdk/cx-api/test/fixtures/missing-context/manifest.json b/packages/@aws-cdk/cx-api/test/fixtures/missing-context/manifest.json index 033e0298244b1..70eaa1758b4df 100644 --- a/packages/@aws-cdk/cx-api/test/fixtures/missing-context/manifest.json +++ b/packages/@aws-cdk/cx-api/test/fixtures/missing-context/manifest.json @@ -1,5 +1,5 @@ { - "version": "0.34.0", + "version": "0.36.0", "missing": { "key": "missing:context:key", "provider": "context-provider", diff --git a/packages/@aws-cdk/cx-api/test/fixtures/multiple-stacks/manifest.json b/packages/@aws-cdk/cx-api/test/fixtures/multiple-stacks/manifest.json index 419fb9720861e..054e01f01204d 100644 --- a/packages/@aws-cdk/cx-api/test/fixtures/multiple-stacks/manifest.json +++ b/packages/@aws-cdk/cx-api/test/fixtures/multiple-stacks/manifest.json @@ -1,5 +1,5 @@ { - "version": "0.34.0", + "version": "0.36.0", "artifacts": { "MyStackName": { "type": "aws:cloudformation:stack", diff --git a/packages/@aws-cdk/cx-api/test/fixtures/single-stack/manifest.json b/packages/@aws-cdk/cx-api/test/fixtures/single-stack/manifest.json index 52431c4ec78f0..fc95445f48e0c 100644 --- a/packages/@aws-cdk/cx-api/test/fixtures/single-stack/manifest.json +++ b/packages/@aws-cdk/cx-api/test/fixtures/single-stack/manifest.json @@ -1,5 +1,5 @@ { - "version": "0.34.0", + "version": "0.36.0", "artifacts": { "MyStackName": { "type": "aws:cloudformation:stack", diff --git a/packages/@aws-cdk/cx-api/test/fixtures/stack-without-params/manifest.json b/packages/@aws-cdk/cx-api/test/fixtures/stack-without-params/manifest.json index 1a13623b27127..162f05483a9f5 100644 --- a/packages/@aws-cdk/cx-api/test/fixtures/stack-without-params/manifest.json +++ b/packages/@aws-cdk/cx-api/test/fixtures/stack-without-params/manifest.json @@ -1,5 +1,5 @@ { - "version": "0.34.0", + "version": "0.36.0", "artifacts": { "MyStackName": { "type": "aws:cloudformation:stack",