diff --git a/.gitignore b/.gitignore index 450c0ffc94eaf..1be7eae0b8a63 100644 --- a/.gitignore +++ b/.gitignore @@ -28,4 +28,7 @@ coverage/ cdk.context.json .cdk.staging/ cdk.out/ +*.tabl.json +# Yarn error log +yarn-error.log diff --git a/.mergify.yml b/.mergify.yml index d58d427e27eb7..4bd8b174e4a1a 100644 --- a/.mergify.yml +++ b/.mergify.yml @@ -22,6 +22,8 @@ pull_request_rules: - -label~=(blocked|do-not-merge) - -merged - -closed + - author!=dependabot[bot] + - author!=dependabot-preview[bot] - "#approved-reviews-by>=1" - -approved-reviews-by~=author - "#changes-requested-reviews-by=0" diff --git a/CHANGELOG.md b/CHANGELOG.md index 147f2343582a3..69145a82950ad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,71 @@ 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. +## [1.20.0](https://github.com/aws/aws-cdk/compare/v1.19.0...v1.20.0) (2020-01-07) + + +### ⚠ BREAKING CHANGES + +* **autoscaling:** AutoScalingGroups without `desiredCapacity` are now +initially scaled to their minimum capacity (instead of their maximum +capaciety). +* **rds:** `addRotationSingleUser(id: string, options: SecretRotationOptions)` is now `addRotationSingleUser(automaticallyAfter?: Duration)` +* **glue:** InputFormat. TEXT_INPUT_FORMAT has been renamed to TEXT. OutputFormat. HIVE_IGNORE_KEY_TEXT_OUTPUT_FORMAT has been renamed to HIVE_IGNORE_KEY_TEXT + +### Features + +* **apigateway:** lambda token authorizer ([#5197](https://github.com/aws/aws-cdk/issues/5197)) ([5c16744](https://github.com/aws/aws-cdk/commit/5c167448f16ea368efc8192abc26e281f976ec7f)), closes [#5584](https://github.com/aws/aws-cdk/issues/5584) +* **aws-stepfunctions:** support StateMachineType ([#5398](https://github.com/aws/aws-cdk/issues/5398)) ([ea095f0](https://github.com/aws/aws-cdk/commit/ea095f0198ebe1efd2f20621cac111b71ee68bd7)), closes [#5397](https://github.com/aws/aws-cdk/issues/5397) +* **cli:** support custom CA certificate bundles ([ac748c1](https://github.com/aws/aws-cdk/commit/ac748c1786e68774f5d0ea9cfbec439034166c40)), closes [#5294](https://github.com/aws/aws-cdk/issues/5294) +* **cloudformation:** update cloudformation spec to v10.2.0 ([#5542](https://github.com/aws/aws-cdk/issues/5542)) ([cb65da3](https://github.com/aws/aws-cdk/commit/cb65da3cd31425265aadd2f2e806a45b244fab8b)) +* **cloudwatch:** make Metric objects region-aware ([212687c](https://github.com/aws/aws-cdk/commit/212687c1427b4e0e6dde11c69139e5036a1ce087)) +* **cloudwatch:** support for metric math ([#5582](https://github.com/aws/aws-cdk/issues/5582)) ([a7f189e](https://github.com/aws/aws-cdk/commit/a7f189e980fdc21b44b8d20fcb491d798ffb682e)), closes [#1077](https://github.com/aws/aws-cdk/issues/1077) [#5449](https://github.com/aws/aws-cdk/issues/5449) [#5261](https://github.com/aws/aws-cdk/issues/5261) [#4716](https://github.com/aws/aws-cdk/issues/4716) +* **codebuild:** add 2X_Large compute type option ([#5429](https://github.com/aws/aws-cdk/issues/5429)) ([1291ef6](https://github.com/aws/aws-cdk/commit/1291ef6b4eb7b8333247b243bcf37bdcb8aaa07f)), closes [#5401](https://github.com/aws/aws-cdk/issues/5401) +* **core:** add support for the ref intrinsic function ([#5468](https://github.com/aws/aws-cdk/issues/5468)) ([#5470](https://github.com/aws/aws-cdk/issues/5470)) ([cad5bc1](https://github.com/aws/aws-cdk/commit/cad5bc148bfdd088c1307932b919899a98fd860a)) +* **custom-resource:** Allow custom ResourceTypes on CustomResources ([#5248](https://github.com/aws/aws-cdk/issues/5248)) ([c605ceb](https://github.com/aws/aws-cdk/commit/c605ceb40a49528505669bac61403673b38da5ba)) +* **custom-resources:** getDataString for AwsCustomResource ([#5578](https://github.com/aws/aws-cdk/issues/5578)) ([faa368d](https://github.com/aws/aws-cdk/commit/faa368dfa7d6706669a9eaca2279cb86d2dd42c7)), closes [#5570](https://github.com/aws/aws-cdk/issues/5570) +* **custom-resources:** ignore DELETE after failed CREATE ([#5525](https://github.com/aws/aws-cdk/issues/5525)) ([9ab989e](https://github.com/aws/aws-cdk/commit/9ab989e4aba7b4fdeee062097dda01b25d41675d)), closes [#5524](https://github.com/aws/aws-cdk/issues/5524) +* **custom-resources:** use latest SDK in AwsCustomResource ([#5442](https://github.com/aws/aws-cdk/issues/5442)) ([a111cdd](https://github.com/aws/aws-cdk/commit/a111cdd97928280b206c3dcfc522e642106e3a70)), closes [#2689](https://github.com/aws/aws-cdk/issues/2689) [#5063](https://github.com/aws/aws-cdk/issues/5063) +* **dynamodb:** Implement importing existing dynamodb table. ([#5280](https://github.com/aws/aws-cdk/issues/5280)) ([8d9b58b](https://github.com/aws/aws-cdk/commit/8d9b58bbf58c0b7281dbce79720e471e533a18c0)), closes [#3895](https://github.com/aws/aws-cdk/issues/3895) +* **ec2:** add `privateIpAddress` to Instance ([a00906d](https://github.com/aws/aws-cdk/commit/a00906d22317103156acacc597623aafa660acbb)), closes [#4004](https://github.com/aws/aws-cdk/issues/4004) +* **ec2:** support block devices for `Instance` ([#5567](https://github.com/aws/aws-cdk/issues/5567)) ([1085a27](https://github.com/aws/aws-cdk/commit/1085a27d6d57621b47f415a3e2a11166702e8709)), closes [#4773](https://github.com/aws/aws-cdk/issues/4773) [#4781](https://github.com/aws/aws-cdk/issues/4781) +* **ecr-assets:** custom docker files ([#5652](https://github.com/aws/aws-cdk/issues/5652)) ([1b25a4b](https://github.com/aws/aws-cdk/commit/1b25a4b44e992f076d0bcf2d805880fdbebca34a)) +* **ecs-patterns:** higher-level constructs for ECS service with multiple target groups ([#5083](https://github.com/aws/aws-cdk/issues/5083)) ([c0a7192](https://github.com/aws/aws-cdk/commit/c0a7192c7a3b4a69a0415af679c684f7783c95c8)) +* **eks:** EKS-Optimized AMI with GPU support for G4 instance ([#5479](https://github.com/aws/aws-cdk/issues/5479)) ([7b34d56](https://github.com/aws/aws-cdk/commit/7b34d5635ecda5db337dfab32711443f57ad1518)) +* **eks:** helm chart support ([#5390](https://github.com/aws/aws-cdk/issues/5390)) ([394313e](https://github.com/aws/aws-cdk/commit/394313ee931e38bc20fc3dcb1cd2fd1b6f66822e)) +* **glue:** add support for more DataFormats ([#5246](https://github.com/aws/aws-cdk/issues/5246)) ([ca535d0](https://github.com/aws/aws-cdk/commit/ca535d0b1f1e993e3cc452e9ebc2a4a268032998)) +* **lambda:** configuration for async invocations ([#5299](https://github.com/aws/aws-cdk/issues/5299)) ([746ba32](https://github.com/aws/aws-cdk/commit/746ba3247a86a0cca60a1bb7897dd12848d904e9)) +* **logs:** import a LogGroup from its name ([#5580](https://github.com/aws/aws-cdk/issues/5580)) ([9cbbaea](https://github.com/aws/aws-cdk/commit/9cbbaeae66311921c2db459e91f2a6943628577e)) +* **rds:** more extensive secret rotation support ([#5281](https://github.com/aws/aws-cdk/issues/5281)) ([b700b77](https://github.com/aws/aws-cdk/commit/b700b778e74822e520867dbc5ff5524fb0c82eaf)), closes [#5194](https://github.com/aws/aws-cdk/issues/5194) +* **codebuild:** add Secrets Manager to CodeBuild environment variable types ([#5464](https://github.com/aws/aws-cdk/issues/5464)) ([ff1fa68](https://github.com/aws/aws-cdk/commit/ff1fa68408136f9677326f0d2d92a891396c0709)) + + +### Bug Fixes + +* **autoscaling:** every deployment resets capacity ([#5507](https://github.com/aws/aws-cdk/issues/5507)) ([0adf6c7](https://github.com/aws/aws-cdk/commit/0adf6c75c1f0aa4acc131915970a496326dc559f)), closes [#5215](https://github.com/aws/aws-cdk/issues/5215) [#5208](https://github.com/aws/aws-cdk/issues/5208) +* **aws-cdk:** upgrade canaries lambda node version ([#5674](https://github.com/aws/aws-cdk/issues/5674)) ([96b802b](https://github.com/aws/aws-cdk/commit/96b802b23f347a83617aa292e320cee20793b0c1)) +* **codebuild:** ARM images have the wrong type and compute kind ([#5541](https://github.com/aws/aws-cdk/issues/5541)) ([6999baf](https://github.com/aws/aws-cdk/commit/6999baf4c493ce618e66c3a4e4f6f4970540a5d1)), closes [#5517](https://github.com/aws/aws-cdk/issues/5517) +* **codebuild:** cannot use immutable roles for Project ([6103180](https://github.com/aws/aws-cdk/commit/6103180c5427bb887fe1734330b109579874649d)), closes [#1408](https://github.com/aws/aws-cdk/issues/1408) +* **codebuild:** rename CodeBuild VPC policy to be unique ([#5385](https://github.com/aws/aws-cdk/issues/5385)) ([16a1200](https://github.com/aws/aws-cdk/commit/16a1200b7132f72772a5d5230e137f793cd56d7a)) +* **core:** nested Fn.join with token fails ([#5679](https://github.com/aws/aws-cdk/issues/5679)) ([24ded60](https://github.com/aws/aws-cdk/commit/24ded60d82482b17bb08f98cba262f4f9bd23493)), closes [#5655](https://github.com/aws/aws-cdk/issues/5655) +* **cli:** java sample-app init template does not have a src/ directory ([#5546](https://github.com/aws/aws-cdk/issues/5546)) ([71947b5](https://github.com/aws/aws-cdk/commit/71947b5d7417e9ff26b59f16b6610fd176195662)) +* **core:** nested stacks does not report missing context [#5594](https://github.com/aws/aws-cdk/issues/5594) ([#5638](https://github.com/aws/aws-cdk/issues/5638)) ([9472e09](https://github.com/aws/aws-cdk/commit/9472e0956c9e2ebe657462afe581fab5675c55cd)) +* **core:** tags not working for cognito user pools ([#4225](https://github.com/aws/aws-cdk/issues/4225)) ([a67f0ef](https://github.com/aws/aws-cdk/commit/a67f0efb736f71ee8dd9c9ec31f8c867618849df)), closes [#3882](https://github.com/aws/aws-cdk/issues/3882) +* **custom-resources:** default timeout of 2 minutes for AwsCustomResource ([#5658](https://github.com/aws/aws-cdk/issues/5658)) ([e0c41d4](https://github.com/aws/aws-cdk/commit/e0c41d4246fc0588a298bb27efd743fc05439b36)) +* **ec2:** allow ingress to VPC interface endpoints ([#4938](https://github.com/aws/aws-cdk/issues/4938)) ([d5ed97a](https://github.com/aws/aws-cdk/commit/d5ed97a84d91e4eb7b13c11c4b0b826625f564d4)), closes [#4937](https://github.com/aws/aws-cdk/issues/4937) +* **eks:** aws-auth username not set by default ([#5649](https://github.com/aws/aws-cdk/issues/5649)) ([87befa6](https://github.com/aws/aws-cdk/commit/87befa6f725072cb0fa3712e8819f97ef3698602)), closes [#5263](https://github.com/aws/aws-cdk/issues/5263) +* **eks:** default capacity uses desiredCapacity which is an anti-pattern ([#5651](https://github.com/aws/aws-cdk/issues/5651)) ([a883fed](https://github.com/aws/aws-cdk/commit/a883fed02a520068221c91ea3755cf63dd493f4e)), closes [#5215](https://github.com/aws/aws-cdk/issues/5215) [#5507](https://github.com/aws/aws-cdk/issues/5507) [#5650](https://github.com/aws/aws-cdk/issues/5650) +* **eks:** failures when creating or updating clusters ([#5540](https://github.com/aws/aws-cdk/issues/5540)) ([a13cfe6](https://github.com/aws/aws-cdk/commit/a13cfe683412f81198f65aa7639d52100ce3aa17)), closes [#5544](https://github.com/aws/aws-cdk/issues/5544) [#4087](https://github.com/aws/aws-cdk/issues/4087) [#4695](https://github.com/aws/aws-cdk/issues/4695) [#5259](https://github.com/aws/aws-cdk/issues/5259) [#5501](https://github.com/aws/aws-cdk/issues/5501) +* **eks:** generated cluster name can exceed 100 characters ([#5597](https://github.com/aws/aws-cdk/issues/5597)) ([3256a41](https://github.com/aws/aws-cdk/commit/3256a41787c365a67b01bee193bd75e48645f7a0)), closes [#5596](https://github.com/aws/aws-cdk/issues/5596) +* **eks:** kubernetes cannot create external load balancers ([#5448](https://github.com/aws/aws-cdk/issues/5448)) ([384d22d](https://github.com/aws/aws-cdk/commit/384d22da7198c1885df019e3cf985c16c59a825b)), closes [#5443](https://github.com/aws/aws-cdk/issues/5443) +* **iam:** policy added to resource for immutable Role ([#5568](https://github.com/aws/aws-cdk/issues/5568)) ([950a5f7](https://github.com/aws/aws-cdk/commit/950a5f76185f7e1197f006535d2638c6e79db2d2)) +* **java:** resolve Java class naming error ([#5602](https://github.com/aws/aws-cdk/issues/5602)) ([e9ede13](https://github.com/aws/aws-cdk/commit/e9ede138b7681115f1fdf9e60b710fabd5bf14b4)) +* **rds:** do not allow aurora engines when using DatabaseInstance ([#5367](https://github.com/aws/aws-cdk/issues/5367)) ([03b3b7a](https://github.com/aws/aws-cdk/commit/03b3b7a9ea0f8449e60d46370e9e4daec81d7c54)), closes [#5345](https://github.com/aws/aws-cdk/issues/5345) +* **s3n:** s3n lambda destination works with function by arn ([#5599](https://github.com/aws/aws-cdk/issues/5599)) ([7ceee6d](https://github.com/aws/aws-cdk/commit/7ceee6dacc268a3e2daecbec254c59886d28add6)), closes [#5592](https://github.com/aws/aws-cdk/issues/5592) +* **stepfunctions:** permission race condition on state machine deletion ([#5466](https://github.com/aws/aws-cdk/issues/5466)) ([c3ac965](https://github.com/aws/aws-cdk/commit/c3ac965b5c4cb816e9ecc974b741dc7e29fb86b1)), closes [#5336](https://github.com/aws/aws-cdk/issues/5336) +* **tests:** flaky integration tests in release pipeline ([#5485](https://github.com/aws/aws-cdk/issues/5485)) ([01800cf](https://github.com/aws/aws-cdk/commit/01800cfd848b84a3d7646738128946ef58eebf60)) +* increase IAM wait timeout in integ test ([#5504](https://github.com/aws/aws-cdk/issues/5504)) ([f10b3e6](https://github.com/aws/aws-cdk/commit/f10b3e64feab9c9ccc78c9820dc99a8b6b0971ec)) + ## [1.19.0](https://github.com/aws/aws-cdk/compare/v1.18.0...v1.19.0) (2019-12-17) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 521a36c30aac3..6b8b44adf9c3c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -36,6 +36,7 @@ and let us know if it's not up-to-date (even better, submit a PR with your corr - [Updating all Dependencies](#updating-all-dependencies) - [Running CLI integration tests](#running-cli-integration-tests) - [API Compatibility Checks](#api-compatibility-checks) + - [Examples](#examples) - [Feature Flags](#feature-flags) - [Troubleshooting](#troubleshooting) - [Debugging](#debugging) @@ -201,7 +202,7 @@ The build process is divided into stages, so you can invoke them as needed from - __`yarn build`__: runs the `build` and `test` commands in all modules (in topological order). - __`yarn pack`__: packages all modules to all supported languages and produces a `dist/` directory with all the outputs - (running this script requires that you installed the [toolchains](#Toolchains) for all target languages on your + (running this script requires that you installed the [toolchains](#getting-started) for all target languages on your system). ### Partial build tools @@ -302,10 +303,17 @@ if a task fails, it will stop, and then to resume, simply run `foreach.sh` again To reset the session (either when all tasks finished or if you wish to run a different session), run: ```console -$ rm -f ~/.foreach.* +$ scripts/foreach.sh --reset ``` -This will effectively delete the state files. +If you wish to run a command only against a module's dependency closure, use: + +```console +$ cd packages/my-module +$ ../scripts/foreach.sh --up COMMAND +``` + +This will execute `COMMAND` against `my-module` and all it's deps (in a topological order of course). ### Jetbrains support (WebStorm/IntelliJ) @@ -336,7 +344,7 @@ $ ./install.sh $ yarn build ``` -If you also wish to package to all languages, make sure you have all the [toolchains](#Toolchains) and now run: +If you also wish to package to all languages, make sure you have all the [toolchains](#getting-started) and now run: ``` $ ./pack.sh @@ -375,6 +383,8 @@ $ cd packages/@aws-cdk/aws-ec2 $ ../../../scripts/buildup ``` +Note that `buildup` uses `foreach.sh`, which means it's resumable. If your build fails and you wish to resume, just run `buildup` again. If you wish to restart, run `buildup --restart`. + ### Quick Iteration After you've built the modules you want to work on once, use `lr watch` for each module that you are modifying. @@ -518,6 +528,62 @@ this API we will not break anyone, because they weren't able to use it. The file `allowed-breaking-changes.txt` in the root of the repo is an exclusion file that can be used in these cases. +### Examples + +Examples typed in fenced code blocks (looking like `'''ts`, but then with backticks +instead of regular quotes) will be automatically extrated, compiled and translated +to other languages when the bindings are generated. + +To successfully do that, they must be compilable. The easiest way to do that is using +a *fixture*, which looks like this: + +``` +'''ts fixture=with-bucket +bucket.addLifecycleTransition({ ... }); +''' +``` + +While processing the examples, the tool will look for a file called +`rosetta/with-bucket.ts-fixture` in the package directory. This file will be +treated as a regular TypeScript source file, but it must also contain the text +`/// here`, at which point the example will be inserted. The complete file must +compile properly. + +Before the `/// here` marker, the fixture should import the necessary packages +and initialize the required variables. + +If no fixture is specified, the fixture with the name +`rosetta/default.ts-fixture` will be used if present. `nofixture` can be used to +opt out of that behavior. + +In an `@example` block, which is unfenced, the first line of the example can +contain three slashes to achieve the same effect: + +``` +/** + * @example + * /// fixture=with-bucket + * bucket.addLifecycleTransition({ ... }); + */ +``` + +When including packages in your examples (even the package you're writing the +examples for), use the full package name (e.g. `import s3 = +require('@aws-cdk/aws-s3);`). The example will be compiled in an environment +where all CDK packages are available using their public names. In this way, +it's also possible to import packages that are not in the dependency set of +the current package. + +For a practical example of how making sample code compilable works, see the +`aws-ec2` package. + +Examples of all packages are extracted and compiled as part of the packaging +step. If you are working on getting rid of example compilation errors of a +single package, you can run `scripts/compile-samples` on the package by itself. + +For now, non-compiling examples will not yet block the build, but at some point +in the future they will. + ### Feature Flags Sometimes we want to introduce new breaking behavior because we believe this is @@ -550,9 +616,9 @@ The pattern is simple: 5. Under `BREAKING CHANGES` in your commit message describe this new behavior: ``` - BREAKING CHANGE: template file names for new projects created through "cdk init" - will use the template artifact ID instead of the physical stack name to enable - multiple stacks to use the same name. This is enabled through the flag + BREAKING CHANGE: template file names for new projects created through "cdk init" + will use the template artifact ID instead of the physical stack name to enable + multiple stacks to use the same name. This is enabled through the flag `@aws-cdk/core:enableStackNameDuplicates` in newly generated `cdk.json` files. ``` diff --git a/LICENSE b/LICENSE index 46c185646b439..b71ec1688783a 100644 --- a/LICENSE +++ b/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2018-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. + Copyright 2018-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/lerna.json b/lerna.json index 139d3202b1bf8..6822cabb86b31 100644 --- a/lerna.json +++ b/lerna.json @@ -9,5 +9,5 @@ "tools/*" ], "rejectCycles": "true", - "version": "1.19.0" + "version": "1.20.0" } diff --git a/pack.sh b/pack.sh index 199ad97a51c77..49166439a4777 100755 --- a/pack.sh +++ b/pack.sh @@ -25,22 +25,31 @@ function lerna_scopes() { done } -echo "Packaging jsii modules" >&2 +# Compile examples with respect to "decdk" directory, as all packages will +# be symlinked there so they can all be included. +echo "Extracting code samples" >&2 +node --experimental-worker $(which jsii-rosetta) \ + --compile \ + --output samples.tabl.json \ + --directory packages/decdk \ + $(cat $TMPDIR/jsii.txt) # Jsii packaging (all at once using jsii-pacmak) +echo "Packaging jsii modules" >&2 jsii-pacmak \ --verbose \ - --outdir $distdir/ \ + --rosetta-tablet samples.tabl.json \ $(cat $TMPDIR/jsii.txt) # Non-jsii packaging, which means running 'package' in every individual -# module and rsync'ing the result to the shared dist directory. +# module echo "Packaging non-jsii modules" >&2 lerna run $(lerna_scopes $(cat $TMPDIR/nonjsii.txt)) --sort --concurrency=1 --stream package +# Finally rsync all 'dist' directories together into a global 'dist' directory for dir in $(find packages -name dist | grep -v node_modules | grep -v run-wrappers); do - echo "Merging ${dir} into ${distdir}" - rsync -av $dir/ ${distdir}/ + echo "Merging ${dir} into ${distdir}" >&2 + rsync -a $dir/ ${distdir}/ done # Remove a JSII aggregate POM that may have snuk past diff --git a/package.json b/package.json index 4180762ac99cf..1fe02950551c1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "aws-cdk", - "version": "1.19.0", + "version": "1.20.0", "private": true, "pkglint": { "include": "dependencies/node-version" @@ -15,9 +15,10 @@ "devDependencies": { "conventional-changelog-cli": "^2.0.31", "fs-extra": "^8.1.0", - "jsii-diff": "^0.20.11", - "jsii-pacmak": "^0.20.11", - "lerna": "^3.18.4", + "jsii-diff": "^0.21.1", + "jsii-pacmak": "^0.21.1", + "jsii-rosetta": "^0.21.1", + "lerna": "^3.20.2", "typescript": "~3.7.4" }, "repository": { diff --git a/packages/@aws-cdk/alexa-ask/.gitignore b/packages/@aws-cdk/alexa-ask/.gitignore index 7b20ed5f53385..95ee96981d6b4 100644 --- a/packages/@aws-cdk/alexa-ask/.gitignore +++ b/packages/@aws-cdk/alexa-ask/.gitignore @@ -6,7 +6,7 @@ .jsii .LAST_BUILD .LAST_PACKAGE -.nycrc +nyc.config.js .nyc_output coverage dist diff --git a/packages/@aws-cdk/alexa-ask/LICENSE b/packages/@aws-cdk/alexa-ask/LICENSE index 46c185646b439..b71ec1688783a 100644 --- a/packages/@aws-cdk/alexa-ask/LICENSE +++ b/packages/@aws-cdk/alexa-ask/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2018-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. + Copyright 2018-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/packages/@aws-cdk/alexa-ask/NOTICE b/packages/@aws-cdk/alexa-ask/NOTICE index 8585168af8b7d..bfccac9a7f69c 100644 --- a/packages/@aws-cdk/alexa-ask/NOTICE +++ b/packages/@aws-cdk/alexa-ask/NOTICE @@ -1,2 +1,2 @@ AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. +Copyright 2018-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/alexa-ask/package.json b/packages/@aws-cdk/alexa-ask/package.json index 36084acf566e5..b03d02b585f9e 100644 --- a/packages/@aws-cdk/alexa-ask/package.json +++ b/packages/@aws-cdk/alexa-ask/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/alexa-ask", - "version": "1.19.0", + "version": "1.20.0", "description": "The CDK Construct Library for Alexa::ASK", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -70,20 +70,26 @@ "branches": 60, "statements": 80 } - } + }, + "collectCoverage": true, + "coverageReporters": [ + "lcov", + "html", + "text-summary" + ] }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "1.19.0", - "cdk-build-tools": "1.19.0", - "cfn2ts": "1.19.0", - "pkglint": "1.19.0" + "@aws-cdk/assert": "1.20.0", + "cdk-build-tools": "1.20.0", + "cfn2ts": "1.20.0", + "pkglint": "1.20.0" }, "dependencies": { - "@aws-cdk/core": "1.19.0" + "@aws-cdk/core": "1.20.0" }, "peerDependencies": { - "@aws-cdk/core": "1.19.0" + "@aws-cdk/core": "1.20.0" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/app-delivery/.gitignore b/packages/@aws-cdk/app-delivery/.gitignore index c49007df54187..e83cd3c5e30bb 100644 --- a/packages/@aws-cdk/app-delivery/.gitignore +++ b/packages/@aws-cdk/app-delivery/.gitignore @@ -3,7 +3,7 @@ dist .LAST_BUILD .jsii .nyc_output -.nycrc +nyc.config.js tsconfig.json *.js *.d.ts diff --git a/packages/@aws-cdk/app-delivery/LICENSE b/packages/@aws-cdk/app-delivery/LICENSE index 46c185646b439..b71ec1688783a 100644 --- a/packages/@aws-cdk/app-delivery/LICENSE +++ b/packages/@aws-cdk/app-delivery/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2018-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. + Copyright 2018-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/packages/@aws-cdk/app-delivery/NOTICE b/packages/@aws-cdk/app-delivery/NOTICE index 8585168af8b7d..bfccac9a7f69c 100644 --- a/packages/@aws-cdk/app-delivery/NOTICE +++ b/packages/@aws-cdk/app-delivery/NOTICE @@ -1,2 +1,2 @@ AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. +Copyright 2018-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/app-delivery/package.json b/packages/@aws-cdk/app-delivery/package.json index 1a11a6a53c71a..fbb84029d8ea6 100644 --- a/packages/@aws-cdk/app-delivery/package.json +++ b/packages/@aws-cdk/app-delivery/package.json @@ -1,7 +1,7 @@ { "name": "@aws-cdk/app-delivery", "description": "Continuous Integration / Continuous Delivery for CDK Applications", - "version": "1.19.0", + "version": "1.20.0", "main": "lib/index.js", "types": "lib/index.d.ts", "jsii": { @@ -40,24 +40,24 @@ "compat": "cdk-compat" }, "dependencies": { - "@aws-cdk/aws-cloudformation": "1.19.0", - "@aws-cdk/aws-codebuild": "1.19.0", - "@aws-cdk/aws-codepipeline": "1.19.0", - "@aws-cdk/aws-codepipeline-actions": "1.19.0", - "@aws-cdk/aws-events": "1.19.0", - "@aws-cdk/aws-iam": "1.19.0", - "@aws-cdk/core": "1.19.0", - "@aws-cdk/cx-api": "1.19.0" + "@aws-cdk/aws-cloudformation": "1.20.0", + "@aws-cdk/aws-codebuild": "1.20.0", + "@aws-cdk/aws-codepipeline": "1.20.0", + "@aws-cdk/aws-codepipeline-actions": "1.20.0", + "@aws-cdk/aws-events": "1.20.0", + "@aws-cdk/aws-iam": "1.20.0", + "@aws-cdk/core": "1.20.0", + "@aws-cdk/cx-api": "1.20.0" }, "devDependencies": { - "@aws-cdk/assert": "1.19.0", - "@aws-cdk/aws-s3": "1.19.0", + "@aws-cdk/assert": "1.20.0", + "@aws-cdk/aws-s3": "1.20.0", "@types/nodeunit": "^0.0.30", - "cdk-build-tools": "1.19.0", - "cdk-integ-tools": "1.19.0", - "fast-check": "^1.20.1", + "cdk-build-tools": "1.20.0", + "cdk-integ-tools": "1.20.0", + "fast-check": "^1.21.0", "nodeunit": "^0.11.3", - "pkglint": "1.19.0" + "pkglint": "1.20.0" }, "repository": { "type": "git", @@ -76,14 +76,14 @@ "cdk" ], "peerDependencies": { - "@aws-cdk/aws-cloudformation": "1.19.0", - "@aws-cdk/aws-codebuild": "1.19.0", - "@aws-cdk/aws-codepipeline": "1.19.0", - "@aws-cdk/aws-codepipeline-actions": "1.19.0", - "@aws-cdk/aws-events": "1.19.0", - "@aws-cdk/aws-iam": "1.19.0", - "@aws-cdk/core": "1.19.0", - "@aws-cdk/cx-api": "1.19.0" + "@aws-cdk/aws-cloudformation": "1.20.0", + "@aws-cdk/aws-codebuild": "1.20.0", + "@aws-cdk/aws-codepipeline": "1.20.0", + "@aws-cdk/aws-codepipeline-actions": "1.20.0", + "@aws-cdk/aws-events": "1.20.0", + "@aws-cdk/aws-iam": "1.20.0", + "@aws-cdk/core": "1.20.0", + "@aws-cdk/cx-api": "1.20.0" }, "engines": { "node": ">= 10.3.0" @@ -98,4 +98,4 @@ "docs-public-apis:@aws-cdk/app-delivery.PipelineDeployStackActionProps" ] } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/assert/.gitignore b/packages/@aws-cdk/assert/.gitignore index 6cff5540e188a..eb142198f6493 100644 --- a/packages/@aws-cdk/assert/.gitignore +++ b/packages/@aws-cdk/assert/.gitignore @@ -7,6 +7,6 @@ dist .LAST_BUILD .nyc_output coverage -.nycrc +nyc.config.js .LAST_PACKAGE -*.snk \ No newline at end of file +*.snk diff --git a/packages/@aws-cdk/assert/LICENSE b/packages/@aws-cdk/assert/LICENSE index 46c185646b439..b71ec1688783a 100644 --- a/packages/@aws-cdk/assert/LICENSE +++ b/packages/@aws-cdk/assert/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2018-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. + Copyright 2018-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/packages/@aws-cdk/assert/NOTICE b/packages/@aws-cdk/assert/NOTICE index 8585168af8b7d..bfccac9a7f69c 100644 --- a/packages/@aws-cdk/assert/NOTICE +++ b/packages/@aws-cdk/assert/NOTICE @@ -1,2 +1,2 @@ AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. +Copyright 2018-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/assert/README.md b/packages/@aws-cdk/assert/README.md index d3db7d3a96c23..ff04c0e985828 100644 --- a/packages/@aws-cdk/assert/README.md +++ b/packages/@aws-cdk/assert/README.md @@ -79,3 +79,25 @@ expect(stack).to(haveResource('AWS::CertificateManager::Certificate', { // Note: some properties omitted here })); ``` +### Check existence of an output +`haveOutput` assertion can be used to check that a stack contains specific output. +Parameters to check against can be: +- `outputName` +- `outputValue` +- `exportName` + +If `outputValue` is provided, at least one of `outputName`, `exportName` should be provided as well + +Example +```ts +expect(synthStack).to(haveOutput({ + outputName: 'TestOutputName', + exportName: 'TestOutputExportName', + outputValue: { + 'Fn::GetAtt': [ + 'TestResource', + 'Arn' + ] + } +})); +``` diff --git a/packages/@aws-cdk/assert/jest.ts b/packages/@aws-cdk/assert/jest.ts index d5715364652a7..78fa8fab38d90 100644 --- a/packages/@aws-cdk/assert/jest.ts +++ b/packages/@aws-cdk/assert/jest.ts @@ -1,8 +1,11 @@ -import { Stack } from "@aws-cdk/core"; +import { Stack } from '@aws-cdk/core'; import * as cxapi from '@aws-cdk/cx-api'; -import { HaveResourceAssertion, ResourcePart } from "./lib/assertions/have-resource"; -import { MatchStyle, matchTemplate } from "./lib/assertions/match-template"; +import { JestFriendlyAssertion } from './lib/assertion'; +import { haveOutput, HaveOutputProperties } from './lib/assertions/have-output'; +import { HaveResourceAssertion, ResourcePart } from './lib/assertions/have-resource'; +import { MatchStyle, matchTemplate } from './lib/assertions/match-template'; import { expect as ourExpect } from './lib/expect'; +import { StackInspector } from './lib/inspector'; declare global { namespace jest { @@ -17,6 +20,8 @@ declare global { toHaveResourceLike(resourceType: string, properties?: any, comparison?: ResourcePart): R; + + toHaveOutput(props: HaveOutputProperties): R; } } } @@ -50,8 +55,9 @@ expect.extend({ comparison?: ResourcePart) { const assertion = new HaveResourceAssertion(resourceType, properties, comparison, false); - return assertHaveResource(assertion, actual); + return applyAssertion(assertion, actual); }, + toHaveResourceLike( actual: cxapi.CloudFormationStackArtifact | Stack, resourceType: string, @@ -59,11 +65,18 @@ expect.extend({ comparison?: ResourcePart) { const assertion = new HaveResourceAssertion(resourceType, properties, comparison, true); - return assertHaveResource(assertion, actual); + return applyAssertion(assertion, actual); + }, + + toHaveOutput( + actual: cxapi.CloudFormationStackArtifact | Stack, + props: HaveOutputProperties) { + + return applyAssertion(haveOutput(props), actual); } }); -function assertHaveResource(assertion: HaveResourceAssertion, actual: cxapi.CloudFormationStackArtifact | Stack) { +function applyAssertion(assertion: JestFriendlyAssertion, actual: cxapi.CloudFormationStackArtifact | Stack) { const inspector = ourExpect(actual); const pass = assertion.assertUsing(inspector); if (pass) { diff --git a/packages/@aws-cdk/assert/lib/assertion.ts b/packages/@aws-cdk/assert/lib/assertion.ts index d193a6856c27e..57ef3ca759e78 100644 --- a/packages/@aws-cdk/assert/lib/assertion.ts +++ b/packages/@aws-cdk/assert/lib/assertion.ts @@ -20,6 +20,13 @@ export abstract class Assertion { } } +export abstract class JestFriendlyAssertion extends Assertion { + /** + * Generates an error message that can be used by Jest. + */ + public abstract generateErrorMessage(): string; +} + import { AndAssertion } from "./assertions/and-assertion"; function and(left: Assertion, right: Assertion): Assertion { diff --git a/packages/@aws-cdk/assert/lib/assertions/have-output.ts b/packages/@aws-cdk/assert/lib/assertions/have-output.ts new file mode 100644 index 0000000000000..36f76b3e573a0 --- /dev/null +++ b/packages/@aws-cdk/assert/lib/assertions/have-output.ts @@ -0,0 +1,116 @@ +import { JestFriendlyAssertion } from '../assertion'; +import { StackInspector } from '../inspector'; + +class HaveOutputAssertion extends JestFriendlyAssertion { + private readonly inspected: InspectionFailure[] = []; + + constructor(private readonly outputName?: string, private readonly exportName?: any, private outputValue?: any) { + super(); + if (!this.outputName && !this.exportName) { + throw new Error('At least one of [outputName, exportName] should be provided'); + } + } + + public get description(): string { + const descriptionPartsArray = new Array(); + + if (this.outputName) { + descriptionPartsArray.push(`name '${this.outputName}'`); + } + if (this.exportName) { + descriptionPartsArray.push(`export name ${JSON.stringify(this.exportName)}`); + } + if (this.outputValue) { + descriptionPartsArray.push(`value ${JSON.stringify(this.outputValue)}`); + } + + return 'output with ' + descriptionPartsArray.join(', '); + } + + public assertUsing(inspector: StackInspector): boolean { + if (!('Outputs' in inspector.value)) { + return false; + } + + for (const [name, props] of Object.entries(inspector.value.Outputs as Record)) { + const mismatchedFields = new Array(); + + if (this.outputName && name !== this.outputName) { + mismatchedFields.push('name'); + } + + if (this.exportName && JSON.stringify(this.exportName) !== JSON.stringify(props.Export?.Name)) { + mismatchedFields.push('export name'); + } + + if (this.outputValue && JSON.stringify(this.outputValue) !== JSON.stringify(props.Value)) { + mismatchedFields.push('value'); + } + + if (mismatchedFields.length === 0) { + return true; + } + + this.inspected.push({ + output: { [name]: props }, + failureReason: `mismatched ${mismatchedFields.join(', ')}`, + }); + } + + return false; + } + + public generateErrorMessage() { + const lines = new Array(); + + lines.push(`None of ${this.inspected.length} outputs matches ${this.description}.`); + + for (const inspected of this.inspected) { + lines.push(`- ${inspected.failureReason} in:`); + lines.push(indent(4, JSON.stringify(inspected.output, null, 2))); + } + + return lines.join('\n'); + } +} + +/** + * Interface for haveOutput function properties + * NOTE that at least one of [outputName, exportName] should be provided + */ +export interface HaveOutputProperties { + /** + * Logical ID of the output + * @default - the logical ID of the output will not be checked + */ + outputName?: string; + /** + * Export name of the output, when it's exported for cross-stack referencing + * @default - the export name is not required and will not be checked + */ + exportName?: any; + /** + * Value of the output; + * @default - the value will not be checked + */ + outputValue?: any; +} + +interface InspectionFailure { + output: any; + failureReason: string; +} + +/** + * An assertion to check whether Output with particular properties is present in a stack + * @param props properties of the Output that is being asserted against. + * Check ``HaveOutputProperties`` interface to get full list of available parameters + */ +export function haveOutput(props: HaveOutputProperties): JestFriendlyAssertion { + return new HaveOutputAssertion(props.outputName, props.exportName, props.outputValue); +} + +function indent(n: number, s: string) { + const prefix = ' '.repeat(n); + return prefix + s.replace(/\n/g, '\n' + prefix); +} diff --git a/packages/@aws-cdk/assert/lib/assertions/have-resource.ts b/packages/@aws-cdk/assert/lib/assertions/have-resource.ts index d6653f3b64ce6..ce94e152ab5ac 100644 --- a/packages/@aws-cdk/assert/lib/assertions/have-resource.ts +++ b/packages/@aws-cdk/assert/lib/assertions/have-resource.ts @@ -1,4 +1,4 @@ -import { Assertion } from "../assertion"; +import { Assertion, JestFriendlyAssertion } from "../assertion"; import { StackInspector } from "../inspector"; /** @@ -30,8 +30,8 @@ export function haveResourceLike(resourceType: string, type PropertyPredicate = (props: any, inspection: InspectionFailure) => boolean; -export class HaveResourceAssertion extends Assertion { - private inspected: InspectionFailure[] = []; +export class HaveResourceAssertion extends JestFriendlyAssertion { + private readonly inspected: InspectionFailure[] = []; private readonly part: ResourcePart; private readonly predicate: PropertyPredicate; diff --git a/packages/@aws-cdk/assert/lib/index.ts b/packages/@aws-cdk/assert/lib/index.ts index b79d93592affc..ff3516dc2f6fd 100644 --- a/packages/@aws-cdk/assert/lib/index.ts +++ b/packages/@aws-cdk/assert/lib/index.ts @@ -4,6 +4,7 @@ export * from './inspector'; export * from './synth-utils'; export * from './assertions/exist'; +export * from './assertions/have-output'; export * from './assertions/have-resource'; export * from './assertions/have-type'; export * from './assertions/match-template'; diff --git a/packages/@aws-cdk/assert/package.json b/packages/@aws-cdk/assert/package.json index 390800a41ad17..ece2c28931749 100644 --- a/packages/@aws-cdk/assert/package.json +++ b/packages/@aws-cdk/assert/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/assert", - "version": "1.19.0", + "version": "1.20.0", "description": "An assertion library for use with CDK Apps", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -14,10 +14,24 @@ "build+test+package": "npm run build+test && npm run package", "build+test": "npm run build && npm test" }, - "nyc": { - "statements": 40, - "lines": 40, - "branches": 30 + "jest": { + "collectCoverage": true, + "coverageReporters": [ + "lcov", + "html", + "text-summary" + ], + "coverageThreshold": { + "global": { + "statements": 75, + "branches": 65 + } + }, + "preset": "ts-jest", + "testMatch": [ + "**/__tests__/**/*.ts?(x)", + "**/?(*.)+(spec|test).ts?(x)" + ] }, "author": { "name": "Amazon Web Services", @@ -26,18 +40,19 @@ }, "license": "Apache-2.0", "devDependencies": { - "@types/jest": "^24.0.23", - "@types/nodeunit": "^0.0.30", - "cdk-build-tools": "1.19.0", - "nodeunit": "^0.11.3", - "pkglint": "1.19.0" + "@types/jest": "^24.9.0", + "cdk-build-tools": "1.20.0", + "jest": "^24.9.0", + "pkglint": "1.20.0", + "ts-jest": "^24.3.0" }, "dependencies": { - "@aws-cdk/cloudformation-diff": "1.19.0", - "@aws-cdk/core": "1.19.0", - "@aws-cdk/cx-api": "1.19.0", - "jest": "^24.9.0", - "source-map-support": "^0.5.16" + "@aws-cdk/cloudformation-diff": "1.20.0", + "@aws-cdk/core": "1.20.0", + "@aws-cdk/cx-api": "1.20.0" + }, + "peerDependencies": { + "jest": "^24.9.0" }, "repository": { "url": "https://github.com/aws/aws-cdk.git", diff --git a/packages/@aws-cdk/assert/test/test.assertions.ts b/packages/@aws-cdk/assert/test/assertions.test.ts similarity index 80% rename from packages/@aws-cdk/assert/test/test.assertions.ts rename to packages/@aws-cdk/assert/test/assertions.test.ts index dcfa5a602505f..26e5cb1707c5f 100644 --- a/packages/@aws-cdk/assert/test/test.assertions.ts +++ b/packages/@aws-cdk/assert/test/assertions.test.ts @@ -1,37 +1,34 @@ -import 'source-map-support/register'; - import * as cdk from '@aws-cdk/core'; import * as cx from '@aws-cdk/cx-api'; -import { Test } from 'nodeunit'; -import { countResources, exist, expect, haveType, MatchStyle, matchTemplate } from '../lib/index'; +import { countResources, exist, expect as cdkExpect, haveType, MatchStyle, matchTemplate } from '../lib/index'; passingExample('expect at to have ', () => { const resourceType = 'Test::Resource'; const synthStack = synthesizedStack(stack => { new TestResource(stack, 'TestResource', { type: resourceType }); }); - expect(synthStack).at('/TestResource').to(haveType(resourceType)); + cdkExpect(synthStack).at('/TestResource').to(haveType(resourceType)); }); passingExample('expect non-synthesized stack at to have ', () => { const resourceType = 'Test::Resource'; const stack = new cdk.Stack(); new TestResource(stack, 'TestResource', { type: resourceType }); - expect(stack).at('/TestResource').to(haveType(resourceType)); + cdkExpect(stack).at('/TestResource').to(haveType(resourceType)); }); passingExample('expect at *not* to have ', () => { const resourceType = 'Test::Resource'; const synthStack = synthesizedStack(stack => { new TestResource(stack, 'TestResource', { type: resourceType }); }); - expect(synthStack).at('/TestResource').notTo(haveType('Foo::Bar')); + cdkExpect(synthStack).at('/TestResource').notTo(haveType('Foo::Bar')); }); passingExample('expect at to exist', () => { const resourceType = 'Test::Resource'; const synthStack = synthesizedStack(stack => { new TestResource(stack, 'TestResource', { type: resourceType }); }); - expect(synthStack).at('/TestResource').to(exist()); + cdkExpect(synthStack).at('/TestResource').to(exist()); }); passingExample('expect to match (exactly)