diff --git a/CHANGELOG.v2.alpha.md b/CHANGELOG.v2.alpha.md index 15061e08b4ad1..2cc2dd43068ee 100644 --- a/CHANGELOG.v2.alpha.md +++ b/CHANGELOG.v2.alpha.md @@ -2,6 +2,31 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +## [2.88.0-alpha.0](https://github.com/aws/aws-cdk/compare/v2.87.0-alpha.0...v2.88.0-alpha.0) (2023-07-20) + + +### ⚠ BREAKING CHANGES TO EXPERIMENTAL FEATURES + +* **apprunner-alpha:** This change will be destructive if the `serviceName` is set on an existing resources. + +### Features + +* **glue:** support Data Quality ruleset ([#26272](https://github.com/aws/aws-cdk/issues/26272)) ([af3a188](https://github.com/aws/aws-cdk/commit/af3a18810847e68aa55865e380b5e4d7f9ba5edf)) +* **glue:** validate maxCapacity, workerCount, and workerType ([#26241](https://github.com/aws/aws-cdk/issues/26241)) ([349e4d4](https://github.com/aws/aws-cdk/commit/349e4d4401eb6b785ebc325905a212a41d664e1f)) +* **iot-actions:** iot rule https action l2 construct ([#25535](https://github.com/aws/aws-cdk/issues/25535)) ([3aee826](https://github.com/aws/aws-cdk/commit/3aee82692533a12ee44953ec4039d7cc8d6129e3)), closes [#25491](https://github.com/aws/aws-cdk/issues/25491) +* **synthetics:** lifecycle rules for auto-generated artifact buckets ([#26290](https://github.com/aws/aws-cdk/issues/26290)) ([ad0d40c](https://github.com/aws/aws-cdk/commit/ad0d40cc3a75f1cadc044393b5cb3ec7e9ab71a4)), closes [#22863](https://github.com/aws/aws-cdk/issues/22863) [#22634](https://github.com/aws/aws-cdk/issues/22634) + + +### Bug Fixes + +* **apprunner-alpha:** respect serviceName property ([#26238](https://github.com/aws/aws-cdk/issues/26238)) ([6da9a4c](https://github.com/aws/aws-cdk/commit/6da9a4c13444d82061ffd7d1f9326ca03c2bf367)), closes [#26237](https://github.com/aws/aws-cdk/issues/26237) +* **batch:** grant execution role logs:CreateLogStream by default ([#26288](https://github.com/aws/aws-cdk/issues/26288)) ([c755f50](https://github.com/aws/aws-cdk/commit/c755f50f7d2240345c3e9ee1c262a3b194db1618)), closes [#25675](https://github.com/aws/aws-cdk/issues/25675) +* **batch:** SSM parameters can't be used as ECS Container secrets ([#26373](https://github.com/aws/aws-cdk/issues/26373)) ([bc3d6a7](https://github.com/aws/aws-cdk/commit/bc3d6a7a82fb76c3ab3915abf4ba9660a65b3414)), closes [#26339](https://github.com/aws/aws-cdk/issues/26339) +* **integ-tests-alpha:** assertions handler is broken ([#26400](https://github.com/aws/aws-cdk/issues/26400)) ([111a1cf](https://github.com/aws/aws-cdk/commit/111a1cfce0aaa7497ebd1e966f76bb3ed485d857)), closes [#26271](https://github.com/aws/aws-cdk/issues/26271) [#26359](https://github.com/aws/aws-cdk/issues/26359) [#26360](https://github.com/aws/aws-cdk/issues/26360) +* **integ-tests-alpha:** incorrect sdk client resolution ([#26271](https://github.com/aws/aws-cdk/issues/26271)) ([17e343a](https://github.com/aws/aws-cdk/commit/17e343adbd815adb276ec4ccdf5eba2d8b39607a)) +* **redshift-alpha:** incorrect CR runtime version ([#26406](https://github.com/aws/aws-cdk/issues/26406)) ([c8d8421](https://github.com/aws/aws-cdk/commit/c8d8421370800384322b37b43c9644d3afec922d)), closes [#26397](https://github.com/aws/aws-cdk/issues/26397) +* **synthetics:** asset code validation failed on bundled assets ([#26291](https://github.com/aws/aws-cdk/issues/26291)) ([02a5482](https://github.com/aws/aws-cdk/commit/02a5482263b993e02c57923bda5e186d72255ade)), closes [#19342](https://github.com/aws/aws-cdk/issues/19342) [#11630](https://github.com/aws/aws-cdk/issues/11630) + ## [2.87.0-alpha.0](https://github.com/aws/aws-cdk/compare/v2.86.0-alpha.0...v2.87.0-alpha.0) (2023-07-06) diff --git a/CHANGELOG.v2.md b/CHANGELOG.v2.md index 2ace46e094bfc..fb16bbb66d89b 100644 --- a/CHANGELOG.v2.md +++ b/CHANGELOG.v2.md @@ -2,6 +2,54 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +## [2.88.0](https://github.com/aws/aws-cdk/compare/v2.87.0...v2.88.0) (2023-07-20) + + +### Features + +* **app-mesh:** support port property on weighted targets ([#26114](https://github.com/aws/aws-cdk/issues/26114)) ([54f91c8](https://github.com/aws/aws-cdk/commit/54f91c802d9930fcbf34a36ca5b5aadbfe765bf3)), closes [#26083](https://github.com/aws/aws-cdk/issues/26083) +* **autoscaling:** deprecate launch configurations (under feature flag) ([#25910](https://github.com/aws/aws-cdk/issues/25910)) ([ff21c69](https://github.com/aws/aws-cdk/commit/ff21c6913ce8079ee0969598d5cc5de43ae46951)), closes [#23165](https://github.com/aws/aws-cdk/issues/23165) +* **aws-cdk-lib:** use new L1 codegen ([#26318](https://github.com/aws/aws-cdk/issues/26318)) ([f15ed23](https://github.com/aws/aws-cdk/commit/f15ed231e7728623df9ca3943cdfc2c9feb06e9a)) +* **cfnspec:** cloudformation spec v130.0.0 ([#26278](https://github.com/aws/aws-cdk/issues/26278)) ([d316af7](https://github.com/aws/aws-cdk/commit/d316af79c2b8bf86d954c94404b2a685280f6f25)) +* **cfnspec:** cloudformation spec v130.1.0 ([#26362](https://github.com/aws/aws-cdk/issues/26362)) ([52e20c9](https://github.com/aws/aws-cdk/commit/52e20c921fa11693f3dd65702c9a0e7f8550f37d)) +* **cloudfront:** add denyList to OriginRequestPolicy behaviors ([#25767](https://github.com/aws/aws-cdk/issues/25767)) ([7926560](https://github.com/aws/aws-cdk/commit/7926560f0a150d8fd39d0775df5259621b8068ae)), closes [/github.com/awsdocs/aws-cloudformation-user-guide/commit/a38f2735de1b0b34a4feac1c7bde47524e0966b5#diff-630d84276f15d7dbe9836107b0c289d8692c9279ae10adacf34344273f28fcecR33](https://github.com/aws//github.com/awsdocs/aws-cloudformation-user-guide/commit/a38f2735de1b0b34a4feac1c7bde47524e0966b5/issues/diff-630d84276f15d7dbe9836107b0c289d8692c9279ae10adacf34344273f28fcecR33) [/github.com/awsdocs/aws-cloudformation-user-guide/commit/a38f2735de1b0b34a4feac1c7bde47524e0966b5#diff-83c67e21c489d688c4da6943452187182e96e8974f447bd3479044da752fe43bR34](https://github.com/aws//github.com/awsdocs/aws-cloudformation-user-guide/commit/a38f2735de1b0b34a4feac1c7bde47524e0966b5/issues/diff-83c67e21c489d688c4da6943452187182e96e8974f447bd3479044da752fe43bR34) [/github.com/awsdocs/aws-cloudformation-user-guide/commit/a38f2735de1b0b34a4feac1c7bde47524e0966b5#diff-96b632ead034b3554fb62969ffa46e799f53a1edfb3cfed5deba5df4d769aab1R34](https://github.com/aws//github.com/awsdocs/aws-cloudformation-user-guide/commit/a38f2735de1b0b34a4feac1c7bde47524e0966b5/issues/diff-96b632ead034b3554fb62969ffa46e799f53a1edfb3cfed5deba5df4d769aab1R34) +* **cloudwatch:** allow configuring period on SingleValueWidget ([#26260](https://github.com/aws/aws-cdk/issues/26260)) ([c8edc87](https://github.com/aws/aws-cdk/commit/c8edc876bb1e2ea0fb63905021d9b4c77a913c9f)), closes [#26259](https://github.com/aws/aws-cdk/issues/26259) +* **cloudwatch:** dashboard variables ([#26285](https://github.com/aws/aws-cdk/issues/26285)) ([73f2741](https://github.com/aws/aws-cdk/commit/73f274193d4c687822d956742722ce5cecdf9173)), closes [#26200](https://github.com/aws/aws-cdk/issues/26200) +* **codebuild:** support for Docker Registry Image for Linux Arm ([#26121](https://github.com/aws/aws-cdk/issues/26121)) ([f522796](https://github.com/aws/aws-cdk/commit/f522796426a0d9526fae99330784fff9bdb67740)), closes [#24367](https://github.com/aws/aws-cdk/issues/24367) [#24342](https://github.com/aws/aws-cdk/issues/24342) +* **core:** allow user to specify --platform ([#26368](https://github.com/aws/aws-cdk/issues/26368)) ([2f8df43](https://github.com/aws/aws-cdk/commit/2f8df4395ed7897ce3d450983c694cc40405f330)), closes [#25759](https://github.com/aws/aws-cdk/issues/25759) +* **custom-resources:** add custom environmentEncryption for Provider lambda functions ([#26236](https://github.com/aws/aws-cdk/issues/26236)) ([546456a](https://github.com/aws/aws-cdk/commit/546456a80a9204d9294831b759f04d3d4e3da72a)), closes [#26197](https://github.com/aws/aws-cdk/issues/26197) +* **ec2:** make VPC internet gateway creation controllable ([#26314](https://github.com/aws/aws-cdk/issues/26314)) ([cc4ce12](https://github.com/aws/aws-cdk/commit/cc4ce12803b756b174445f8493d4239c57f78f97)), closes [#26270](https://github.com/aws/aws-cdk/issues/26270) +* **ec2:** support using ssm parameter to resolve AMI ID at instance launch time ([#26273](https://github.com/aws/aws-cdk/issues/26273)) ([2462b0b](https://github.com/aws/aws-cdk/commit/2462b0b0155a5cf5382b1780e8a8cd40d1206a95)) +* **eks:** support eks with k8s 1.27 ([#25897](https://github.com/aws/aws-cdk/issues/25897)) ([fdd3309](https://github.com/aws/aws-cdk/commit/fdd3309ee98a8dcd9542d8ffec9defcdbdcd28af)) +* **lambda-event-sources:** added filters support to kafka sources ([#26366](https://github.com/aws/aws-cdk/issues/26366)) ([c575dde](https://github.com/aws/aws-cdk/commit/c575dded26834bd55618813b74046d2f380d1940)), closes [#26348](https://github.com/aws/aws-cdk/issues/26348) +* **opensearch:** opensearch 2.7 engine version ([#26313](https://github.com/aws/aws-cdk/issues/26313)) ([fb580b5](https://github.com/aws/aws-cdk/commit/fb580b56541a63485fc1ef24cd75e5f9ae18f940)) +* **opensearchservice:** support for MultiAZWithStandBy (under feature flag) ([#26082](https://github.com/aws/aws-cdk/issues/26082)) ([6c75581](https://github.com/aws/aws-cdk/commit/6c75581ae2b9537fa9d1d724b837fe81ae22d345)), closes [#26026](https://github.com/aws/aws-cdk/issues/26026) +* **rds:** support Aurora MySQL engine v. 2.11.3 ([#26419](https://github.com/aws/aws-cdk/issues/26419)) ([c646644](https://github.com/aws/aws-cdk/commit/c6466448e53f2f486ec40ff176b8623257e4b3f8)), closes [#26407](https://github.com/aws/aws-cdk/issues/26407) +* **rds:** support aurora postgresql 14.8 ([#26427](https://github.com/aws/aws-cdk/issues/26427)) ([e8fc7a8](https://github.com/aws/aws-cdk/commit/e8fc7a881e8c3e0ef3b437b316bba58e0c74d5a2)) +* **rds:** support aurora postgresql 15.3 ([#26377](https://github.com/aws/aws-cdk/issues/26377)) ([669dd7f](https://github.com/aws/aws-cdk/commit/669dd7f78a1ef41ab36ffb6fca66a7e90407ac45)), closes [#26363](https://github.com/aws/aws-cdk/issues/26363) +* **rds:** support configuring secret rotation behavior via rotateImmediatelyOnUpdate prop ([#26329](https://github.com/aws/aws-cdk/issues/26329)) ([979cbff](https://github.com/aws/aws-cdk/commit/979cbff5dc3e39c40e663ed87888a3ea8d2a6f7d)), closes [#26099](https://github.com/aws/aws-cdk/issues/26099) + + +### Bug Fixes + +* **apigateway:** method response from rest api default options are not passed to Method ([#26275](https://github.com/aws/aws-cdk/issues/26275)) ([9bcc6d5](https://github.com/aws/aws-cdk/commit/9bcc6d5b6e9a47affc8d972c6bf16e725915cfcd)), closes [#26252](https://github.com/aws/aws-cdk/issues/26252) +* **aws_ecs:** Do not output NetworkConfiguraiton to ECS Service when using EXTERNAL deployment controller ([#26338](https://github.com/aws/aws-cdk/issues/26338)) ([170edda](https://github.com/aws/aws-cdk/commit/170eddad663a75506443fd1619d716d2b7ac3e0f)), closes [#26335](https://github.com/aws/aws-cdk/issues/26335) +* **cli:** credential plugin exceptions stop the entire CLI ([#26244](https://github.com/aws/aws-cdk/issues/26244)) ([1a8f5ad](https://github.com/aws/aws-cdk/commit/1a8f5ade8ea0bc26bee0cefd73085aaf788434c8)) +* **cli:** hotswap doesn't update SSM parameter environment variables properly ([#26382](https://github.com/aws/aws-cdk/issues/26382)) ([32654f5](https://github.com/aws/aws-cdk/commit/32654f573651dd099e8e1b6823ef1934e03660dd)), closes [#25387](https://github.com/aws/aws-cdk/issues/25387) [#25483](https://github.com/aws/aws-cdk/issues/25483) +* **core:** cross region exports fail when parameter doesn't exist ([#26434](https://github.com/aws/aws-cdk/issues/26434)) ([d130bd7](https://github.com/aws/aws-cdk/commit/d130bd742a7b016311f56dd217b87bcbbedf6521)) +* **custom-resource:** `ignoreErrorCodesMatching` broken on sdk v3 ([#26430](https://github.com/aws/aws-cdk/issues/26430)) ([e21dd4e](https://github.com/aws/aws-cdk/commit/e21dd4e63e313992e8b88921f84a70a95428c0ae)) +* **ecs:** DeploymentAlarms property is specified for ECS service with CODE_DEPLOY and EXTERNAL deployment controller ([#26317](https://github.com/aws/aws-cdk/issues/26317)) ([b799c82](https://github.com/aws/aws-cdk/commit/b799c82526b755d3f6005fd022467d7dcb220bb3)), closes [#25840](https://github.com/aws/aws-cdk/issues/25840) [#26307](https://github.com/aws/aws-cdk/issues/26307) +* **ecs:** Windows ECS Optimized AMI SSM parameter format is incorrect ([#26326](https://github.com/aws/aws-cdk/issues/26326)) ([43013d0](https://github.com/aws/aws-cdk/commit/43013d04f3a2637b799b9a57916751c3d04b9a2f)), closes [#26327](https://github.com/aws/aws-cdk/issues/26327) +* **lambda:** add instrument handler option to adotInstrumentation to support python lambda functions ([#26040](https://github.com/aws/aws-cdk/issues/26040)) ([bd06669](https://github.com/aws/aws-cdk/commit/bd06669586baee054f1a9a6bb142d572d21ce3bc)), closes [#24666](https://github.com/aws/aws-cdk/issues/24666) +* **lambda:** bundling fails with pnpm >= 8.4.0 ([#25612](https://github.com/aws/aws-cdk/issues/25612)) ([#26386](https://github.com/aws/aws-cdk/issues/26386)) ([928cbc8](https://github.com/aws/aws-cdk/commit/928cbc821806d16d8e8875218d02fd2f4c134ed8)), closes [#25617](https://github.com/aws/aws-cdk/issues/25617) +* **lambda:** Update Python Lambda Adot Lambda layer versions ([#26411](https://github.com/aws/aws-cdk/issues/26411)) ([47f15a6](https://github.com/aws/aws-cdk/commit/47f15a6cf1899cf974066f6c864ef9884af7128d)), closes [#26168](https://github.com/aws/aws-cdk/issues/26168) +* **s3:** auto-delete-objects fails when bucket doesn't exist ([#26433](https://github.com/aws/aws-cdk/issues/26433)) ([228901a](https://github.com/aws/aws-cdk/commit/228901a6e5de9cb483dbd07dd0a9a046cf6ddf96)), closes [#16756](https://github.com/aws/aws-cdk/issues/16756) +* bad error checks in custom resources ([#26392](https://github.com/aws/aws-cdk/issues/26392)) ([267e42c](https://github.com/aws/aws-cdk/commit/267e42ce1668211d58c277b6901b80e62284abdc)) +* **pkglint:** library creation generates incorrect package names ([#26330](https://github.com/aws/aws-cdk/issues/26330)) ([05d875b](https://github.com/aws/aws-cdk/commit/05d875bd8a2b46d47e9fb250e5b2b6ab28d5b0de)), closes [#26331](https://github.com/aws/aws-cdk/issues/26331) +* **s3:** allow empty string as keyPrefixEquals ([#26243](https://github.com/aws/aws-cdk/issues/26243)) ([9381880](https://github.com/aws/aws-cdk/commit/9381880be98ab76580e7638c5d1b929d1e94e80d)), closes [#26242](https://github.com/aws/aws-cdk/issues/26242) +* **servicecatalog:** product stack asset bucket with forced encryption ([#26303](https://github.com/aws/aws-cdk/issues/26303)) ([cb5bef5](https://github.com/aws/aws-cdk/commit/cb5bef5e42ca047f4bd6f13cb382821f3df8a40c)), closes [#26302](https://github.com/aws/aws-cdk/issues/26302) +* **servicecatalog:** support nested stacks in product stacks ([#26311](https://github.com/aws/aws-cdk/issues/26311)) ([cad0635](https://github.com/aws/aws-cdk/commit/cad0635b0f35c55f2a305fa5723c66e5b0248939)), closes [#24317](https://github.com/aws/aws-cdk/issues/24317) + ## [2.87.0](https://github.com/aws/aws-cdk/compare/v2.86.0...v2.87.0) (2023-07-06) diff --git a/packages/aws-cdk-lib/aws-lambda-nodejs/test/.no-packagejson-validator b/packages/aws-cdk-lib/aws-lambda-nodejs/test/.no-packagejson-validator deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/packages/aws-cdk-lib/aws-lambda-nodejs/test/__snapshots__/bundling.test.js.snap b/packages/aws-cdk-lib/aws-lambda-nodejs/test/__snapshots__/bundling.test.js.snap index 74947ef80295d..5fb160d02a895 100644 --- a/packages/aws-cdk-lib/aws-lambda-nodejs/test/__snapshots__/bundling.test.js.snap +++ b/packages/aws-cdk-lib/aws-lambda-nodejs/test/__snapshots__/bundling.test.js.snap @@ -3,7 +3,7 @@ exports[`esbuild bundling with esbuild options 1`] = ` ""use strict"; (() => { - // aws-lambda-nodejs/test/integ-handlers/define.ts + // aws-lambda-nodejs/test/handlers/define.ts function handler() { return [ "VALUE", diff --git a/packages/aws-cdk-lib/aws-lambda-nodejs/test/bundling.test.ts b/packages/aws-cdk-lib/aws-lambda-nodejs/test/bundling.test.ts index 84f2a07508543..2051d54993d11 100644 --- a/packages/aws-cdk-lib/aws-lambda-nodejs/test/bundling.test.ts +++ b/packages/aws-cdk-lib/aws-lambda-nodejs/test/bundling.test.ts @@ -241,7 +241,7 @@ test('esbuild bundling with esbuild options', () => { }); // Make sure that the define instructions are working as expected with the esbuild CLI - const bundleProcess = util.exec('bash', ['-c', `npx esbuild --bundle ${`${__dirname}/integ-handlers/define.ts`} ${defineInstructions}`]); + const bundleProcess = util.exec('bash', ['-c', `npx esbuild --bundle ${`${__dirname}/handlers/define.ts`} ${defineInstructions}`]); expect(bundleProcess.stdout.toString()).toMatchSnapshot(); }); diff --git a/packages/aws-cdk-lib/aws-lambda-nodejs/test/function.test.handler1.ts b/packages/aws-cdk-lib/aws-lambda-nodejs/test/function.test.handler1.ts deleted file mode 100644 index 33af638be9b99..0000000000000 --- a/packages/aws-cdk-lib/aws-lambda-nodejs/test/function.test.handler1.ts +++ /dev/null @@ -1 +0,0 @@ -// Dummy for test purposes diff --git a/packages/aws-cdk-lib/aws-lambda-nodejs/test/function.test.handler2.js b/packages/aws-cdk-lib/aws-lambda-nodejs/test/function.test.handler2.js deleted file mode 100644 index 33af638be9b99..0000000000000 --- a/packages/aws-cdk-lib/aws-lambda-nodejs/test/function.test.handler2.js +++ /dev/null @@ -1 +0,0 @@ -// Dummy for test purposes diff --git a/packages/aws-cdk-lib/aws-lambda-nodejs/test/function.test.handler3.mjs b/packages/aws-cdk-lib/aws-lambda-nodejs/test/function.test.handler3.mjs deleted file mode 100644 index 33af638be9b99..0000000000000 --- a/packages/aws-cdk-lib/aws-lambda-nodejs/test/function.test.handler3.mjs +++ /dev/null @@ -1 +0,0 @@ -// Dummy for test purposes diff --git a/packages/aws-cdk-lib/aws-lambda-nodejs/test/function.test.handler4.mts b/packages/aws-cdk-lib/aws-lambda-nodejs/test/function.test.handler4.mts deleted file mode 100644 index 33af638be9b99..0000000000000 --- a/packages/aws-cdk-lib/aws-lambda-nodejs/test/function.test.handler4.mts +++ /dev/null @@ -1 +0,0 @@ -// Dummy for test purposes diff --git a/packages/aws-cdk-lib/aws-lambda-nodejs/test/function.test.handler5.cts b/packages/aws-cdk-lib/aws-lambda-nodejs/test/function.test.handler5.cts deleted file mode 100644 index 33af638be9b99..0000000000000 --- a/packages/aws-cdk-lib/aws-lambda-nodejs/test/function.test.handler5.cts +++ /dev/null @@ -1 +0,0 @@ -// Dummy for test purposes diff --git a/packages/aws-cdk-lib/aws-lambda-nodejs/test/function.test.handler6.cjs b/packages/aws-cdk-lib/aws-lambda-nodejs/test/function.test.handler6.cjs deleted file mode 100644 index 33af638be9b99..0000000000000 --- a/packages/aws-cdk-lib/aws-lambda-nodejs/test/function.test.handler6.cjs +++ /dev/null @@ -1 +0,0 @@ -// Dummy for test purposes diff --git a/packages/aws-cdk-lib/aws-lambda-nodejs/test/function.test.ts b/packages/aws-cdk-lib/aws-lambda-nodejs/test/function.test.ts index 0915016eded17..a578285e57f87 100644 --- a/packages/aws-cdk-lib/aws-lambda-nodejs/test/function.test.ts +++ b/packages/aws-cdk-lib/aws-lambda-nodejs/test/function.test.ts @@ -1,5 +1,4 @@ -import * as fs from 'fs'; -import * as path from 'path'; +import { bockfs } from '@aws-cdk/cdk-build-tools'; import { Template, Match } from '../../assertions'; import { Vpc } from '../../aws-ec2'; import { CodeConfig, Runtime } from '../../aws-lambda'; @@ -25,12 +24,45 @@ jest.mock('../lib/bundling', () => { }; }); +const mockCallsites = jest.fn(); +jest.mock('../lib/util', () => ({ + ...jest.requireActual('../lib/util'), + callsites: () => mockCallsites(), +})); + let stack: Stack; beforeEach(() => { stack = new Stack(); jest.clearAllMocks(); }); +// We MUST use a fake file system here. +// Using the real filesystem causes the tests to be flaky and fail at random. +// This way we are guaranteed to have the fake files setup on each test run. +bockfs({ + '/home/project/package.json': '{}', + '/home/project/package-lock.json': '{}', + '/home/project/handler.tsx': '// nothing', + '/home/project/function.test.handler1.ts': '// nothing', + '/home/project/function.test.handler2.js': '// nothing', + '/home/project/function.test.handler3.mjs': '// nothing', + '/home/project/function.test.handler4.mts': '// nothing', + '/home/project/function.test.handler5.cts': '// nothing', + '/home/project/function.test.handler6.cjs': '// nothing', + '/home/project/aws-lambda-nodejs/lib/index.ts': '// nothing', +}); +const bockPath = bockfs.workingDirectory('/home/project'); + +// pretend the calling file is in a fake file path +mockCallsites.mockImplementation(() => [ + { getFunctionName: () => 'NodejsFunction' }, + { getFileName: () => bockPath`function.test.ts` }, +]); + +afterAll(() => { + bockfs.restore(); +}); + test('NodejsFunction with .ts handler', () => { // WHEN new NodejsFunction(stack, 'handler1'); @@ -151,15 +183,11 @@ test('throws when entry is not js/ts', () => { }); test('accepts tsx', () => { - const entry = path.join(__dirname, 'handler.tsx'); - - fs.symlinkSync(path.join(__dirname, 'function.test.handler1.ts'), entry); + const entry = bockPath`handler.tsx`; expect(() => new NodejsFunction(stack, 'Fn', { entry, })).not.toThrow(); - - fs.unlinkSync(entry); }); test('throws when entry does not exist', () => { @@ -196,7 +224,7 @@ test('resolves depsLockFilePath to an absolute path', () => { }); expect(Bundling.bundle).toHaveBeenCalledWith(expect.objectContaining({ - depsLockFilePath: expect.stringMatching(/aws-cdk-lib\/package.json$/), + depsLockFilePath: bockPath`/home/project/package.json`, })); }); @@ -207,7 +235,7 @@ test('resolves entry to an absolute path', () => { }); expect(Bundling.bundle).toHaveBeenCalledWith(expect.objectContaining({ - entry: expect.stringMatching(/aws-cdk-lib\/aws-lambda-nodejs\/lib\/index.ts$/), + entry: bockPath`/home/project/aws-lambda-nodejs/lib/index.ts`, })); }); diff --git a/packages/aws-cdk-lib/aws-lambda-nodejs/test/integ-handlers/define.ts b/packages/aws-cdk-lib/aws-lambda-nodejs/test/handlers/define.ts similarity index 98% rename from packages/aws-cdk-lib/aws-lambda-nodejs/test/integ-handlers/define.ts rename to packages/aws-cdk-lib/aws-lambda-nodejs/test/handlers/define.ts index bd66dd3920bab..004e060ac2537 100644 --- a/packages/aws-cdk-lib/aws-lambda-nodejs/test/integ-handlers/define.ts +++ b/packages/aws-cdk-lib/aws-lambda-nodejs/test/handlers/define.ts @@ -5,4 +5,4 @@ export function handler() { process.env.NUMBER, process.env.STRING, ]; -} +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-lambda-nodejs/test/integ-handlers/dependencies-sdk-v3.ts b/packages/aws-cdk-lib/aws-lambda-nodejs/test/integ-handlers/dependencies-sdk-v3.ts deleted file mode 100644 index fe5e9259d5eb7..0000000000000 --- a/packages/aws-cdk-lib/aws-lambda-nodejs/test/integ-handlers/dependencies-sdk-v3.ts +++ /dev/null @@ -1,8 +0,0 @@ -/* eslint-disable no-console */ -import { S3Client } from '@aws-sdk/client-s3'; - -const s3 = new S3Client({}); - -export async function handler() { - console.log(s3); -} diff --git a/packages/aws-cdk-lib/aws-lambda-nodejs/test/integ-handlers/dependencies.ts b/packages/aws-cdk-lib/aws-lambda-nodejs/test/integ-handlers/dependencies.ts deleted file mode 100644 index d250f1ef4e6ff..0000000000000 --- a/packages/aws-cdk-lib/aws-lambda-nodejs/test/integ-handlers/dependencies.ts +++ /dev/null @@ -1,10 +0,0 @@ -/* eslint-disable no-console */ -import { S3 } from 'aws-sdk'; // eslint-disable-line import/no-extraneous-dependencies -import delay from 'delay'; - -const s3 = new S3(); - -export async function handler() { - console.log(s3); - await delay(5); -} diff --git a/packages/aws-cdk-lib/aws-lambda-nodejs/test/integ-handlers/esm.ts b/packages/aws-cdk-lib/aws-lambda-nodejs/test/integ-handlers/esm.ts deleted file mode 100644 index 29f247f3942ab..0000000000000 --- a/packages/aws-cdk-lib/aws-lambda-nodejs/test/integ-handlers/esm.ts +++ /dev/null @@ -1,6 +0,0 @@ -/* eslint-disable no-console */ -import * as crypto from 'crypto'; - -export async function handler() { - console.log(crypto.createHash('sha512').update('cdk').digest('hex')); -} diff --git a/packages/aws-cdk-lib/aws-lambda-nodejs/test/integ-handlers/js-handler.js b/packages/aws-cdk-lib/aws-lambda-nodejs/test/integ-handlers/js-handler.js deleted file mode 100644 index 61d9529f2cfea..0000000000000 --- a/packages/aws-cdk-lib/aws-lambda-nodejs/test/integ-handlers/js-handler.js +++ /dev/null @@ -1,5 +0,0 @@ -import { add } from './util'; - -export async function handler() { - console.log(add(1, 2)); -} diff --git a/packages/aws-cdk-lib/aws-lambda-nodejs/test/integ-handlers/pnpm/dependencies-pnpm.ts b/packages/aws-cdk-lib/aws-lambda-nodejs/test/integ-handlers/pnpm/dependencies-pnpm.ts deleted file mode 100644 index 81022e2b9e00f..0000000000000 --- a/packages/aws-cdk-lib/aws-lambda-nodejs/test/integ-handlers/pnpm/dependencies-pnpm.ts +++ /dev/null @@ -1,6 +0,0 @@ -// eslint-disable-next-line import/no-extraneous-dependencies -import axios from 'axios'; - -export async function handler() { - await axios.get('https://www.google.com'); -} diff --git a/packages/aws-cdk-lib/aws-lambda-nodejs/test/integ-handlers/pnpm/pnpm-lock.yaml b/packages/aws-cdk-lib/aws-lambda-nodejs/test/integ-handlers/pnpm/pnpm-lock.yaml deleted file mode 100644 index 899ba52e99ec2..0000000000000 --- a/packages/aws-cdk-lib/aws-lambda-nodejs/test/integ-handlers/pnpm/pnpm-lock.yaml +++ /dev/null @@ -1,70 +0,0 @@ -lockfileVersion: 5.4 - -specifiers: - axios: ^1.2.1 - -dependencies: - axios: 1.2.1 - -packages: - - /asynckit/0.4.0: - resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==} - dev: false - - /axios/1.2.1: - resolution: {integrity: sha512-I88cFiGu9ryt/tfVEi4kX2SITsvDddTajXTOFmt2uK1ZVA8LytjtdeyefdQWEf5PU8w+4SSJDoYnggflB5tW4A==} - dependencies: - follow-redirects: 1.15.2 - form-data: 4.0.0 - proxy-from-env: 1.1.0 - transitivePeerDependencies: - - debug - dev: false - - /combined-stream/1.0.8: - resolution: {integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==} - engines: {node: '>= 0.8'} - dependencies: - delayed-stream: 1.0.0 - dev: false - - /delayed-stream/1.0.0: - resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==} - engines: {node: '>=0.4.0'} - dev: false - - /follow-redirects/1.15.2: - resolution: {integrity: sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==} - engines: {node: '>=4.0'} - peerDependencies: - debug: '*' - peerDependenciesMeta: - debug: - optional: true - dev: false - - /form-data/4.0.0: - resolution: {integrity: sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==} - engines: {node: '>= 6'} - dependencies: - asynckit: 0.4.0 - combined-stream: 1.0.8 - mime-types: 2.1.35 - dev: false - - /mime-db/1.52.0: - resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==} - engines: {node: '>= 0.6'} - dev: false - - /mime-types/2.1.35: - resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==} - engines: {node: '>= 0.6'} - dependencies: - mime-db: 1.52.0 - dev: false - - /proxy-from-env/1.1.0: - resolution: {integrity: sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==} - dev: false diff --git a/packages/aws-cdk-lib/aws-lambda-nodejs/test/integ-handlers/ts-decorator-handler.ts b/packages/aws-cdk-lib/aws-lambda-nodejs/test/integ-handlers/ts-decorator-handler.ts deleted file mode 100644 index 3e31bfd38293f..0000000000000 --- a/packages/aws-cdk-lib/aws-lambda-nodejs/test/integ-handlers/ts-decorator-handler.ts +++ /dev/null @@ -1,22 +0,0 @@ -function enumerable(value: boolean) { - return function (_target: any, _propertyKey: string, descriptor: PropertyDescriptor) { - descriptor.enumerable = value; - }; -} - -class Greeter { - greeting: string; - constructor(message: string) { - this.greeting = message; - } - - @enumerable(false) - greet() { - return 'Hello, ' + this.greeting; - } -} - -export async function handler(): Promise { - const message = new Greeter('World').greet(); - console.log(message); // eslint-disable-line no-console -} diff --git a/packages/aws-cdk-lib/aws-lambda-nodejs/test/integ-handlers/ts-handler.ts b/packages/aws-cdk-lib/aws-lambda-nodejs/test/integ-handlers/ts-handler.ts deleted file mode 100644 index 94da6641cb2bd..0000000000000 --- a/packages/aws-cdk-lib/aws-lambda-nodejs/test/integ-handlers/ts-handler.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { mult } from './util'; - -export async function handler(): Promise { - console.log(mult(3, 4)); // eslint-disable-line no-console -} diff --git a/packages/aws-cdk-lib/aws-lambda-nodejs/test/integ-handlers/ts-web-handler.ts b/packages/aws-cdk-lib/aws-lambda-nodejs/test/integ-handlers/ts-web-handler.ts deleted file mode 100644 index bb0b3187a74ed..0000000000000 --- a/packages/aws-cdk-lib/aws-lambda-nodejs/test/integ-handlers/ts-web-handler.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { Server } from 'http'; -import { mult } from './util'; - -// Create simple http server -const server = new Server((_req, res) => { - res.writeHead(200, { 'Content-Type': 'text/plain' }); - res.end(`${mult(3, 4)}`); - console.log(mult(3, 4)); // eslint-disable-line no-console -}); - -const port = parseInt(process.env.PORT || '3001', 10); -server.listen(port); diff --git a/packages/aws-cdk-lib/aws-lambda-nodejs/test/integ-handlers/ts-web-run.sh b/packages/aws-cdk-lib/aws-lambda-nodejs/test/integ-handlers/ts-web-run.sh deleted file mode 100755 index def03845104ba..0000000000000 --- a/packages/aws-cdk-lib/aws-lambda-nodejs/test/integ-handlers/ts-web-run.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -# For AWS Lambda Adapter -# https://github.com/awslabs/aws-lambda-web-adapter -export READINESS_CHECK_PATH="${READINESS_CHECK_PATH:-/health}" -export AWS_LAMBDA_EXEC_WRAPPER="${AWS_LAMBDA_EXEC_WRAPPER:-/opt/bootstrap}" -export RUST_LOG="${RUST_LOG:-info}" -export AWS_LWA_ENABLE_COMPRESSION="${AWS_LWA_ENABLE_COMPRESSION:-true}" -export PORT="${PORT:-3001}" - -exec node index.js diff --git a/packages/aws-cdk-lib/aws-lambda-nodejs/test/integ-handlers/util.ts b/packages/aws-cdk-lib/aws-lambda-nodejs/test/integ-handlers/util.ts deleted file mode 100644 index 65af022b6b236..0000000000000 --- a/packages/aws-cdk-lib/aws-lambda-nodejs/test/integ-handlers/util.ts +++ /dev/null @@ -1,7 +0,0 @@ -export function add(a: number, b: number): number { - return a + b; -} - -export function mult(a: number, b: number): number { - return a * b; -} diff --git a/packages/aws-cdk-lib/aws-lambda-nodejs/test/util.test.ts b/packages/aws-cdk-lib/aws-lambda-nodejs/test/util.test.ts index 1414ead7d7933..90e3c067c02a0 100644 --- a/packages/aws-cdk-lib/aws-lambda-nodejs/test/util.test.ts +++ b/packages/aws-cdk-lib/aws-lambda-nodejs/test/util.test.ts @@ -1,6 +1,7 @@ import * as child_process from 'child_process'; import * as fs from 'fs'; import * as path from 'path'; +import { bockfs } from '@aws-cdk/cdk-build-tools'; import { callsites, exec, extractDependencies, findUp, findUpMultiple, getTsconfigCompilerOptions } from '../lib/util'; beforeEach(() => { @@ -11,68 +12,84 @@ describe('callsites', () => { expect(callsites()[0].getFileName()).toMatch(/\/test\/util.test.js$/); }); -describe('findUp', () => { - test('Starting at process.cwd()', () => { - expect(findUp('README.md')).toMatch(/aws-cdk-lib\/README.md$/); +describe('findUp helpers', () => { + // insert contents in fake filesystem + bockfs({ + '/home/project/file0': 'ARBITRARY', + '/home/project/file1': 'ARBITRARY', + '/home/project/file2': 'ARBITRARY', + '/home/project/subdir/.keep': 'ARBITRARY', + '/home/project/subdir/file3': 'ARBITRARY', }); + const bockPath = bockfs.workingDirectory('/home/project'); - test('Non existing file', () => { - expect(findUp('non-existing-file.unknown')).toBe(undefined); + afterAll(() => { + bockfs.restore(); }); - test('Starting at a specific path', () => { - expect(findUp('util.test.ts', path.join(__dirname, 'integ-handlers'))).toMatch(/aws-lambda-nodejs\/test\/util.test.ts$/); - }); + describe('findUp', () => { + test('Starting at process.cwd()', () => { + expect(findUp('file0')).toBe(bockPath`file0`); + }); - test('Non existing file starting at a non existing relative path', () => { - expect(findUp('not-to-be-found.txt', 'non-existing/relative/path')).toBe(undefined); - }); + test('Non existing file', () => { + expect(findUp('non-existing-file.unknown')).toBe(undefined); + }); - test('Starting at a relative path', () => { - expect(findUp('util.test.ts', 'aws-lambda-nodejs/test/integ-handlers')).toMatch(/aws-lambda-nodejs\/test\/util.test.ts$/); - }); -}); + test('Starting at a specific path', () => { + expect(findUp('file1', bockPath`/home/project/subdir`)).toBe(bockPath`/home/project/file1`); + }); -describe('findUpMultiple', () => { - test('Starting at process.cwd()', () => { - const files = findUpMultiple(['README.md', 'package.json']); - expect(files).toHaveLength(2); - expect(files[0]).toMatch(/aws-cdk-lib\/README\.md$/); - expect(files[1]).toMatch(/aws-cdk-lib\/package\.json$/); - }); + test('Non existing file starting at a non existing relative path', () => { + expect(findUp('not-to-be-found.txt', 'non-existing/relative/path')).toBe(undefined); + }); - test('Non existing files', () => { - expect(findUpMultiple(['non-existing-file.unknown', 'non-existing-file.unknown2'])).toEqual([]); + test('Starting at a relative path', () => { + expect(findUp('file1', 'subdir')).toBe(bockPath`file1`); + }); }); - test('Existing and non existing files', () => { - const files = findUpMultiple(['non-existing-file.unknown', 'README.md']); - expect(files).toHaveLength(1); - expect(files[0]).toMatch(/aws-cdk-lib\/README\.md$/); - }); + describe('findUpMultiple', () => { + test('Starting at process.cwd()', () => { + const files = findUpMultiple(['file0', 'file1']); + expect(files).toHaveLength(2); + expect(files[0]).toBe(bockPath`file0`); + expect(files[1]).toBe(bockPath`file1`); + }); - test('Starting at a specific path', () => { - const files = findUpMultiple(['util.test.ts', 'function.test.ts'], path.join(__dirname, 'integ-handlers')); - expect(files).toHaveLength(2); - expect(files[0]).toMatch(/aws-lambda-nodejs\/test\/util\.test\.ts$/); - expect(files[1]).toMatch(/aws-lambda-nodejs\/test\/function\.test\.ts$/); - }); + test('Non existing files', () => { + expect(findUpMultiple(['non-existing-file.unknown', 'non-existing-file.unknown2'])).toEqual([]); + }); - test('Non existing files starting at a non existing relative path', () => { - expect(findUpMultiple(['not-to-be-found.txt', 'not-to-be-found2.txt'], 'non-existing/relative/path')).toEqual([]); - }); + test('Existing and non existing files', () => { + const files = findUpMultiple(['non-existing-file.unknown', 'file0']); + expect(files).toHaveLength(1); + expect(files[0]).toMatch(bockPath`file0`); + }); - test('Starting at a relative path', () => { - const files = findUpMultiple(['util.test.ts', 'function.test.ts'], 'aws-lambda-nodejs/test/integ-handlers'); - expect(files).toHaveLength(2); - expect(files[0]).toMatch(/aws-lambda-nodejs\/test\/util\.test\.ts$/); - expect(files[1]).toMatch(/aws-lambda-nodejs\/test\/function\.test\.ts$/); - }); + test('Starting at a specific path', () => { + const files = findUpMultiple(['file1', 'file2'], bockPath`/home/project/subdir`); + expect(files).toHaveLength(2); + expect(files[0]).toBe(bockPath`file1`); + expect(files[1]).toBe(bockPath`file2`); + }); - test('Files on multiple levels', () => { - const files = findUpMultiple(['README.md', 'util.test.ts'], path.join(__dirname, 'integ-handlers')); - expect(files).toHaveLength(1); - expect(files[0]).toMatch(/aws-lambda-nodejs\/test\/util\.test\.ts$/); + test('Non existing files starting at a non existing relative path', () => { + expect(findUpMultiple(['not-to-be-found.txt', 'not-to-be-found2.txt'], 'non-existing/relative/path')).toEqual([]); + }); + + test('Starting at a relative path', () => { + const files = findUpMultiple(['file1', 'file2'], 'subdir'); + expect(files).toHaveLength(2); + expect(files[0]).toBe(bockPath`file1`); + expect(files[1]).toBe(bockPath`file2`); + }); + + test('Files on multiple levels', () => { + const files = findUpMultiple(['file0', 'file3'], bockPath`/home/project/subdir`); + expect(files).toHaveLength(1); + expect(files[0]).toBe(bockPath`subdir/file3`); + }); }); }); diff --git a/packages/aws-cdk-lib/aws-stepfunctions/lib/state-machine.ts b/packages/aws-cdk-lib/aws-stepfunctions/lib/state-machine.ts index 552a60d7c320e..e341239f62391 100644 --- a/packages/aws-cdk-lib/aws-stepfunctions/lib/state-machine.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions/lib/state-machine.ts @@ -407,6 +407,12 @@ export class StateMachine extends StateMachineBase { */ public readonly stateMachineType: StateMachineType; + /** + * Identifier for the state machine revision, which is an immutable, read-only snapshot of a state machine’s definition and configuration. + * @attribute + */ + public readonly stateMachineRevisionId: string; + constructor(scope: Construct, id: string, props: StateMachineProps) { super(scope, id, { physicalName: props.stateMachineName, @@ -451,6 +457,7 @@ export class StateMachine extends StateMachineBase { resourceName: this.physicalName, arnFormat: ArnFormat.COLON_RESOURCE_NAME, }); + this.stateMachineRevisionId = resource.attrStateMachineRevisionId; } /** diff --git a/packages/aws-cdk-lib/aws-stepfunctions/test/state-machine.test.ts b/packages/aws-cdk-lib/aws-stepfunctions/test/state-machine.test.ts index 4dd9b3c374dde..7055ad2fad5d5 100644 --- a/packages/aws-cdk-lib/aws-stepfunctions/test/state-machine.test.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions/test/state-machine.test.ts @@ -579,4 +579,26 @@ describe('State Machine', () => { DeletionPolicy: 'Retain', }); }); + + test('stateMachineRevisionId property uses attribute reference', () => { + // GIVEN + const stack = new cdk.Stack(); + + // WHEN + const stateMachine = new sfn.StateMachine(stack, 'MyStateMachine', { + stateMachineName: 'MyStateMachine', + definitionBody: sfn.DefinitionBody.fromChainable(new sfn.Pass(stack, 'Pass')), + }); + + new sfn.CfnStateMachineVersion(stack, 'MyStateMachineVersion', { + stateMachineRevisionId: stateMachine.stateMachineRevisionId, + stateMachineArn: stateMachine.stateMachineArn, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::StepFunctions::StateMachineVersion', { + StateMachineArn: { Ref: 'MyStateMachine6C968CA5' }, + StateMachineRevisionId: { 'Fn::GetAtt': ['MyStateMachine6C968CA5', 'StateMachineRevisionId'] }, + }); + }); }); diff --git a/packages/aws-cdk-lib/cx-api/FEATURE_FLAGS.md b/packages/aws-cdk-lib/cx-api/FEATURE_FLAGS.md index 19a44575155c2..9c213bb2b54e6 100644 --- a/packages/aws-cdk-lib/cx-api/FEATURE_FLAGS.md +++ b/packages/aws-cdk-lib/cx-api/FEATURE_FLAGS.md @@ -54,8 +54,8 @@ Flags come in three types: | [@aws-cdk/aws-ec2:restrictDefaultSecurityGroup](#aws-cdkaws-ec2restrictdefaultsecuritygroup) | Restrict access to the VPC default security group | 2.78.0 | (default) | | [@aws-cdk/aws-kms:aliasNameRef](#aws-cdkaws-kmsaliasnameref) | KMS Alias name and keyArn will have implicit reference to KMS Key | 2.83.0 | (fix) | | [@aws-cdk/core:includePrefixInUniqueNameGeneration](#aws-cdkcoreincludeprefixinuniquenamegeneration) | Include the stack prefix in the stack name generation process | 2.84.0 | (fix) | -| [@aws-cdk/aws-autoscaling:generateLaunchTemplateInsteadOfLaunchConfig](#aws-cdkaws-autoscalinggeneratelaunchtemplateinsteadoflaunchconfig) | Generate a launch template when creating an AutoScalingGroup | V2NEXT | (fix) | -| [@aws-cdk/aws-opensearchservice:enableOpensearchMultiAzWithStandby](#aws-cdkaws-opensearchserviceenableopensearchmultiazwithstandby) | Enables support for Multi-AZ with Standby deployment for opensearch domains | V2NEXT | (default) | +| [@aws-cdk/aws-autoscaling:generateLaunchTemplateInsteadOfLaunchConfig](#aws-cdkaws-autoscalinggeneratelaunchtemplateinsteadoflaunchconfig) | Generate a launch template when creating an AutoScalingGroup | 2.88.0 | (fix) | +| [@aws-cdk/aws-opensearchservice:enableOpensearchMultiAzWithStandby](#aws-cdkaws-opensearchserviceenableopensearchmultiazwithstandby) | Enables support for Multi-AZ with Standby deployment for opensearch domains | 2.88.0 | (default) | @@ -1028,7 +1028,7 @@ provided. | Since | Default | Recommended | | ----- | ----- | ----- | | (not in v1) | | | -| V2NEXT | `false` | `true` | +| 2.88.0 | `false` | `true` | **Compatibility with old behavior:** If backwards compatibility needs to be maintained due to an existing autoscaling group @@ -1047,7 +1047,7 @@ multi-az with standby enabled. | Since | Default | Recommended | | ----- | ----- | ----- | | (not in v1) | | | -| V2NEXT | `false` | `true` | +| 2.88.0 | `false` | `true` | **Compatibility with old behavior:** Pass `capacity.multiAzWithStandbyEnabled: false` to `Domain` construct to restore the old behavior. diff --git a/packages/aws-cdk-lib/cx-api/lib/features.ts b/packages/aws-cdk-lib/cx-api/lib/features.ts index 3a4c461fdcefe..6e798ae651d43 100644 --- a/packages/aws-cdk-lib/cx-api/lib/features.ts +++ b/packages/aws-cdk-lib/cx-api/lib/features.ts @@ -821,7 +821,7 @@ export const FLAGS: Record = { attempt to set user data according to the OS of the machine image if explicit user data is not provided. `, - introducedIn: { v2: 'V2NEXT' }, + introducedIn: { v2: '2.88.0' }, compatibilityWithOldBehaviorMd: ` If backwards compatibility needs to be maintained due to an existing autoscaling group using a launch config, set this flag to false. @@ -855,7 +855,7 @@ export const FLAGS: Record = { If this is set, an opensearch domain will automatically be created with multi-az with standby enabled. `, - introducedIn: { v2: 'V2NEXT' }, + introducedIn: { v2: '2.88.0' }, recommendedValue: true, compatibilityWithOldBehaviorMd: 'Pass `capacity.multiAzWithStandbyEnabled: false` to `Domain` construct to restore the old behavior.', }, diff --git a/packages/aws-cdk/test/api/exec.test.ts b/packages/aws-cdk/test/api/exec.test.ts index 5dd74d131eb8e..d15f9ac9c0ce2 100644 --- a/packages/aws-cdk/test/api/exec.test.ts +++ b/packages/aws-cdk/test/api/exec.test.ts @@ -1,5 +1,6 @@ /* eslint-disable import/order */ jest.mock('child_process'); +import { bockfs } from '@aws-cdk/cdk-build-tools'; import * as cxschema from 'aws-cdk-lib/cloud-assembly-schema'; import * as cdk from 'aws-cdk-lib'; import * as semver from 'semver'; @@ -8,7 +9,6 @@ import { ImportMock } from 'ts-mock-imports'; import { execProgram } from '../../lib/api/cxapp/exec'; import { LogLevel, setLogLevel } from '../../lib/logging'; import { Configuration } from '../../lib/settings'; -import * as bockfs from '../bockfs'; import { testAssembly } from '../util'; import { mockSpawn } from '../util/mock-child_process'; import { MockSdkProvider } from '../util/mock-sdk'; diff --git a/packages/aws-cdk/test/api/sdk-provider.test.ts b/packages/aws-cdk/test/api/sdk-provider.test.ts index 25dc5d36e8563..22bf095de4ec7 100644 --- a/packages/aws-cdk/test/api/sdk-provider.test.ts +++ b/packages/aws-cdk/test/api/sdk-provider.test.ts @@ -1,5 +1,6 @@ /* eslint-disable import/order */ import * as os from 'os'; +import { bockfs } from '@aws-cdk/cdk-build-tools'; import * as cxapi from '@aws-cdk/cx-api'; import * as AWS from 'aws-sdk'; import type { ConfigurationOptions } from 'aws-sdk/lib/config-base'; @@ -9,7 +10,6 @@ import { FakeSts, RegisterRoleOptions, RegisterUserOptions } from './fake-sts'; import { ISDK, Mode, SDK, SdkProvider, defaultCliUserAgent } from '../../lib/api/aws-auth'; import { PluginHost } from '../../lib/api/plugin'; import * as logging from '../../lib/logging'; -import * as bockfs from '../bockfs'; import { withMocked } from '../util'; jest.mock('promptly', () => ({ diff --git a/packages/cdk-assets/test/bockfs.ts b/packages/cdk-assets/test/bockfs.ts deleted file mode 100644 index ffdc43aa9b6fa..0000000000000 --- a/packages/cdk-assets/test/bockfs.ts +++ /dev/null @@ -1,32 +0,0 @@ -// A not-so-fake filesystem mock similar to mock-fs -import * as fs from 'fs'; -import * as os from 'os'; -import * as path_ from 'path'; -import { rmRfSync } from '../lib/private/fs-extra'; - -const bockFsRoot = path_.join(os.tmpdir(), 'bockfs'); - -function bockfs(files: Record) { - for (const [fileName, contents] of Object.entries(files)) { - bockfs.write(fileName, contents); - } -} - -namespace bockfs { - export function write(fileName: string, contents: string) { - const fullPath = path(fileName); - fs.mkdirSync(path_.dirname(fullPath), { recursive: true }); - fs.writeFileSync(fullPath, contents, { encoding: 'utf-8' }); - } - - export function path(x: string) { - if (x.startsWith('/')) { x = x.slice(1); } // Force path to be non-absolute - return path_.join(bockFsRoot, x); - } - - export function restore() { - rmRfSync(bockFsRoot); - } -} - -export = bockfs; \ No newline at end of file diff --git a/packages/cdk-assets/test/zipping.test.ts b/packages/cdk-assets/test/zipping.test.ts index 8b850896c1144..71651289070b8 100644 --- a/packages/cdk-assets/test/zipping.test.ts +++ b/packages/cdk-assets/test/zipping.test.ts @@ -1,6 +1,6 @@ // Separate test file since the archiving module doesn't work well with 'mock-fs' +import { bockfs } from '@aws-cdk/cdk-build-tools'; import { Manifest } from '@aws-cdk/cloud-assembly-schema'; -import * as bockfs from './bockfs'; import { mockAws, mockedApiResult, mockUpload } from './mock-aws'; import { AssetManifest, AssetPublishing } from '../lib'; diff --git a/packages/aws-cdk/test/bockfs.ts b/tools/@aws-cdk/cdk-build-tools/lib/bockfs.ts similarity index 76% rename from packages/aws-cdk/test/bockfs.ts rename to tools/@aws-cdk/cdk-build-tools/lib/bockfs.ts index 5158d7633f94d..761df09dbe35a 100644 --- a/packages/aws-cdk/test/bockfs.ts +++ b/tools/@aws-cdk/cdk-build-tools/lib/bockfs.ts @@ -13,7 +13,7 @@ import * as os from 'os'; import * as path_ from 'path'; import * as fs from 'fs-extra'; -const bockFsRoot = fs.mkdtempSync(path_.join(os.tmpdir(), 'bockfs')); +const bockFsRoot = fs.realpathSync(fs.mkdtempSync(path_.join(os.tmpdir(), 'bockfs'))); let oldCwd: string | undefined; function bockfs(files: Record) { @@ -43,9 +43,20 @@ namespace bockfs { /** * Change to a fake directory + * + * @returns A template literal function to turn a fake path into a real path. Relative paths are assumed to be in the working dir. */ - export function workingDirectory(fakePath: string) { + export function workingDirectory(fakePath: string): (parts: TemplateStringsArray) => string { process.chdir(path(fakePath)); + + return function (elements: TemplateStringsArray) { + const fullPath = elements.join(''); + if (!fullPath.startsWith('/')) { + return path(path_.join(fakePath, fullPath)); + } + + return path(fullPath); + }; } export function executable(...fakePaths: string[]) { diff --git a/tools/@aws-cdk/cdk-build-tools/lib/index.ts b/tools/@aws-cdk/cdk-build-tools/lib/index.ts index dff88eb689ea6..f4ff5e9a73660 100644 --- a/tools/@aws-cdk/cdk-build-tools/lib/index.ts +++ b/tools/@aws-cdk/cdk-build-tools/lib/index.ts @@ -1,2 +1,4 @@ export { shell } from './os'; export * from './deprecated-symbols'; +import * as bockfs from './bockfs'; +export { bockfs }; diff --git a/tools/@aws-cdk/prlint/lint.ts b/tools/@aws-cdk/prlint/lint.ts index 15b536f059221..ae68360d55f1e 100644 --- a/tools/@aws-cdk/prlint/lint.ts +++ b/tools/@aws-cdk/prlint/lint.ts @@ -336,7 +336,7 @@ export class PullRequestLinter { * * In addition, we differentiate between ready for review by a core team member * (pr/needs-maintainer-review) or ready for review by core OR the trusted community - * (pr/needs-review). A PR is prioritized for core team review when: + * (pr/needs-community-review). A PR is prioritized for core team review when: * * 6. It links to a p1 issue * 7. It links to a p2 issue and has an approved community review @@ -396,12 +396,12 @@ export class PullRequestLinter { if (readyForReview && (fixesP1 || communityApproved)) { this.addLabel('pr/needs-maintainer-review', pr); - this.removeLabel('pr/needs-review', pr); + this.removeLabel('pr/needs-community-review', pr); } else if (readyForReview && !fixesP1) { this.removeLabel('pr/needs-maintainer-review', pr); - this.addLabel('pr/needs-review', pr); + this.addLabel('pr/needs-community-review', pr); } else { - this.removeLabel('pr/needs-review', pr); + this.removeLabel('pr/needs-community-review', pr); this.removeLabel('pr/needs-maintainer-review', pr); } } diff --git a/tools/@aws-cdk/prlint/test/lint.test.ts b/tools/@aws-cdk/prlint/test/lint.test.ts index f25064404d769..efd09ad6ccd31 100644 --- a/tools/@aws-cdk/prlint/test/lint.test.ts +++ b/tools/@aws-cdk/prlint/test/lint.test.ts @@ -541,7 +541,7 @@ describe('integration tests required on features', () => { // THEN expect(mockAddLabel.mock.calls[0][0]).toEqual({ "issue_number": 1234, - "labels": ["pr/needs-review"], + "labels": ["pr/needs-community-review"], "owner": "aws", "repo": "aws-cdk", }); @@ -577,7 +577,7 @@ describe('integration tests required on features', () => { }); (pr as any).labels = [ { - name: 'pr/needs-review', + name: 'pr/needs-community-review', } ]; @@ -592,7 +592,7 @@ describe('integration tests required on features', () => { // THEN expect(mockRemoveLabel.mock.calls[0][0]).toEqual({ "issue_number": 1234, - "name": "pr/needs-review", + "name": "pr/needs-community-review", "owner": "aws", "repo": "aws-cdk", }); @@ -623,7 +623,7 @@ describe('integration tests required on features', () => { // THEN expect(mockAddLabel.mock.calls[0][0]).toEqual({ "issue_number": 1234, - "labels": ["pr/needs-review"], + "labels": ["pr/needs-community-review"], "owner": "aws", "repo": "aws-cdk", }); @@ -645,7 +645,7 @@ describe('integration tests required on features', () => { name: 'pr-linter/exemption-requested', }, { - name: 'pr/needs-review', + name: 'pr/needs-community-review', }, ]; @@ -660,7 +660,7 @@ describe('integration tests required on features', () => { // THEN expect(mockRemoveLabel.mock.calls[0][0]).toEqual({ "issue_number": 1234, - "name": "pr/needs-review", + "name": "pr/needs-community-review", "owner": "aws", "repo": "aws-cdk", }); @@ -678,7 +678,7 @@ describe('integration tests required on features', () => { }); (pr as any).labels = [ { - name: 'pr/needs-review', + name: 'pr/needs-community-review', } ]; @@ -693,7 +693,7 @@ describe('integration tests required on features', () => { // THEN expect(mockRemoveLabel.mock.calls[0][0]).toEqual({ "issue_number": 1234, - "name": "pr/needs-review", + "name": "pr/needs-community-review", "owner": "aws", "repo": "aws-cdk", }); @@ -711,7 +711,7 @@ describe('integration tests required on features', () => { }); (pr as any).labels = [ { - name: 'pr/needs-review', + name: 'pr/needs-community-review', } ]; @@ -726,7 +726,7 @@ describe('integration tests required on features', () => { // THEN expect(mockRemoveLabel.mock.calls[0][0]).toEqual({ "issue_number": 1234, - "name": "pr/needs-review", + "name": "pr/needs-community-review", "owner": "aws", "repo": "aws-cdk", }); @@ -749,7 +749,7 @@ describe('integration tests required on features', () => { }); (pr as any).labels = [ { - name: 'pr/needs-review', + name: 'pr/needs-community-review', } ]; @@ -764,7 +764,7 @@ describe('integration tests required on features', () => { // THEN expect(mockRemoveLabel.mock.calls[0][0]).toEqual({ "issue_number": 1234, - "name": "pr/needs-review", + "name": "pr/needs-community-review", "owner": "aws", "repo": "aws-cdk", }); @@ -782,7 +782,7 @@ describe('integration tests required on features', () => { }); (pr as any).labels = [ { - name: 'pr/needs-review', + name: 'pr/needs-community-review', } ]; @@ -815,7 +815,7 @@ describe('integration tests required on features', () => { name: 'pr-linter/exemption-requested', }, { - name: 'pr/needs-review', + name: 'pr/needs-community-review', } ]; @@ -826,7 +826,7 @@ describe('integration tests required on features', () => { // THEN expect(mockRemoveLabel.mock.calls[0][0]).toEqual({ "issue_number": 1234, - "name": "pr/needs-review", + "name": "pr/needs-community-review", "owner": "aws", "repo": "aws-cdk", }); diff --git a/version.v2.json b/version.v2.json index 551840e3f8abf..751482038e22f 100644 --- a/version.v2.json +++ b/version.v2.json @@ -1,4 +1,4 @@ { - "version": "2.87.0", - "alphaVersion": "2.87.0-alpha.0" + "version": "2.88.0", + "alphaVersion": "2.88.0-alpha.0" } \ No newline at end of file