@aws-cdk-testing/cli-integ 3.4.5 → 3.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (307) hide show
  1. package/lib/aws.js +6 -9
  2. package/lib/cli/query-github.js +2 -3
  3. package/lib/cli/run-suite.js +2 -3
  4. package/lib/cli/stage-distribution.js +4 -4
  5. package/lib/eventually.js +3 -3
  6. package/lib/files.js +2 -3
  7. package/lib/github.js +5 -6
  8. package/lib/integ-test.js +58 -3
  9. package/lib/package-sources/release-source.d.ts +1 -1
  10. package/lib/package-sources/release-source.js +2 -3
  11. package/lib/package-sources/repo-source.d.ts +1 -1
  12. package/lib/package-sources/repo-source.js +1 -1
  13. package/lib/package-sources/repo-tools/npm.js +4 -5
  14. package/lib/package-sources/subprocess.d.ts +1 -1
  15. package/lib/package-sources/subprocess.js +1 -1
  16. package/lib/process.js +5 -6
  17. package/lib/proxy.d.ts +1 -1
  18. package/lib/proxy.js +2 -2
  19. package/lib/resource-pool.js +5 -3
  20. package/lib/shell.d.ts +3 -3
  21. package/lib/shell.js +8 -12
  22. package/lib/staging/codeartifact.js +8 -11
  23. package/lib/staging/maven.d.ts +2 -2
  24. package/lib/staging/maven.js +3 -5
  25. package/lib/staging/npm.d.ts +2 -2
  26. package/lib/staging/npm.js +1 -1
  27. package/lib/staging/nuget.d.ts +2 -2
  28. package/lib/staging/nuget.js +1 -1
  29. package/lib/staging/parallel-shell.js +2 -2
  30. package/lib/staging/pypi.d.ts +2 -2
  31. package/lib/staging/pypi.js +1 -1
  32. package/lib/with-aws.d.ts +2 -2
  33. package/lib/with-aws.js +5 -4
  34. package/lib/with-cdk-app.d.ts +7 -5
  35. package/lib/with-cdk-app.js +30 -33
  36. package/lib/with-cli-lib.d.ts +4 -3
  37. package/lib/with-cli-lib.js +2 -1
  38. package/lib/with-packages.d.ts +1 -1
  39. package/lib/with-packages.js +1 -1
  40. package/lib/with-sam.d.ts +3 -3
  41. package/lib/with-sam.js +5 -7
  42. package/lib/with-temporary-directory.d.ts +1 -1
  43. package/lib/with-temporary-directory.js +1 -1
  44. package/lib/xpmutex.js +5 -3
  45. package/npm-shrinkwrap.json +8722 -0
  46. package/package.json +11 -7
  47. package/resources/cdk-apps/refactoring/cdk.json +7 -0
  48. package/resources/cdk-apps/refactoring/refactoring.js +18 -0
  49. package/test-reports/junit.xml +15 -0
  50. package/tests/cli-integ-tests/cdk-assets/cdk-assets-uses-profile.integtest.js +11 -11
  51. package/tests/cli-integ-tests/cdk-assets/smoketest.integtest.js +9 -9
  52. package/tests/cli-integ-tests/cdk-bootstrap-add-tags.integtest.js +2 -3
  53. package/tests/cli-integ-tests/cdk-bootstrap-can-add-tags-then-update-tags-during-re-bootstrap.integtest.js +2 -3
  54. package/tests/cli-integ-tests/cdk-bootstrap-can-bootstrap-without-execution.integtest.js +2 -3
  55. package/tests/cli-integ-tests/cdk-bootstrap-can-create-a-legacy-bootstrap-stack-with---public-access-block-configuration-false.integtest.js +2 -3
  56. package/tests/cli-integ-tests/cdk-bootstrap-can-create-multiple-legacy-bootstrap-stacks.integtest.js +2 -3
  57. package/tests/cli-integ-tests/cdk-bootstrap-can-remove-custompermissionsboundary.integtest.js +4 -6
  58. package/tests/cli-integ-tests/cdk-bootstrap-can-remove-trusted-account.integtest.js +2 -3
  59. package/tests/cli-integ-tests/cdk-bootstrap-create-ecr-with-tag-immutability-to-set-on.integtest.js +4 -5
  60. package/tests/cli-integ-tests/cdk-bootstrap-switch-on-termination-protection.integtest.js +2 -3
  61. package/tests/cli-integ-tests/cdk-ci-true-output-to-stdout.integtest.js +1 -1
  62. package/tests/cli-integ-tests/cdk-deploy---method-direct.integtest.js +2 -3
  63. package/tests/cli-integ-tests/cdk-deploy-and-test-stack-with-lambda-asset.integtest.js +3 -4
  64. package/tests/cli-integ-tests/cdk-deploy-deletes-all-notification-arns-when-empty-array-is-passed.integtest.js +3 -4
  65. package/tests/cli-integ-tests/cdk-deploy-preserves-existing-notification-arns-when-not-specified.integtest.js +2 -3
  66. package/tests/cli-integ-tests/cdk-deploy-with-import-existing-resources-true.integtest.js +2 -3
  67. package/tests/cli-integ-tests/cdk-deploy-with-notification-arn-as-flag.integtest.js +2 -3
  68. package/tests/cli-integ-tests/cdk-deploy-with-notification-arn-as-prop-and-flag.integtest.js +2 -3
  69. package/tests/cli-integ-tests/cdk-deploy-with-notification-arn-as-prop.integtest.js +2 -3
  70. package/tests/cli-integ-tests/cdk-deploy-with-parameters-multi.integtest.js +3 -4
  71. package/tests/cli-integ-tests/cdk-deploy-with-parameters.integtest.js +2 -3
  72. package/tests/cli-integ-tests/cdk-deploy-without-execute-a-named-change-set.integtest.js +2 -3
  73. package/tests/cli-integ-tests/cdk-deploy-without-import-existing-resources.integtest.js +2 -3
  74. package/tests/cli-integ-tests/cdk-deploy.integtest.js +2 -3
  75. package/tests/cli-integ-tests/cdk-destroy-interactive.integtest.js +6 -7
  76. package/tests/cli-integ-tests/cdk-fast-deploy.integtest.js +4 -5
  77. package/tests/cli-integ-tests/cdk-gc-garbage-collection-untags-in-use-s3-objects.integtest.js +2 -2
  78. package/tests/cli-integ-tests/cdk-hotswap-deployment-for-ecs-service-waits-for-deployment-to-complete.integtest.js +6 -5
  79. package/tests/cli-integ-tests/cdk-hotswap-deployment-supports-appsync-apis-with-many-functions.integtest.js +2 -3
  80. package/tests/cli-integ-tests/cdk-hotswap-deployment-supports-ecs-service.integtest.js +3 -4
  81. package/tests/cli-integ-tests/cdk-hotswap-deployment-supports-fn::importvalue-intrinsic.integtest.js +3 -4
  82. package/tests/cli-integ-tests/cdk-hotswap-deployment-supports-lambda-functions-description-and-environment-variables.integtest.js +3 -4
  83. package/tests/cli-integ-tests/cdk-hotswap-ecs-deployment-respects-properties-override.integtest.js +5 -6
  84. package/tests/cli-integ-tests/cdk-import-interactive.integtest.js +5 -6
  85. package/tests/cli-integ-tests/cdk-lib-cli-lib-deploy.integtest.js +2 -3
  86. package/tests/cli-integ-tests/cdk-lib-security-related-changes-without-a-cli-are-expected-to-fail-when-approval-is-required.integtest.js +1 -2
  87. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate--from-stack-creates-deployable-app-csharp.integtest.js +1 -1
  88. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate--from-stack-creates-deployable-app-java.integtest.js +1 -1
  89. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate--from-stack-creates-deployable-app-python.integtest.js +1 -1
  90. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate--from-stack-creates-deployable-app-typescript.integtest.js +1 -1
  91. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate-deploys-successfully-csharp.integtest.js +1 -1
  92. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate-deploys-successfully-java.integtest.js +1 -1
  93. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate-deploys-successfully-python.integtest.js +1 -1
  94. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate-deploys-successfully-typescript.integtest.js +1 -1
  95. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate-generates-migrate.json.integtest.js +1 -1
  96. package/tests/cli-integ-tests/cdk-migrate/testcase.d.ts +1 -1
  97. package/tests/cli-integ-tests/cdk-migrate/testcase.js +4 -6
  98. package/tests/cli-integ-tests/cdk-nested-stack-with-parameters.integtest.js +2 -3
  99. package/tests/cli-integ-tests/cdk-refactor-dry-run.integtest.d.ts +1 -0
  100. package/tests/cli-integ-tests/cdk-refactor-dry-run.integtest.js +41 -0
  101. package/tests/cli-integ-tests/cdk-requests-go-through-a-proxy-when-configured.integtest.js +2 -3
  102. package/tests/cli-integ-tests/cdk-stack-in-update_rollback_complete-state-can-be-updated.integtest.js +5 -6
  103. package/tests/cli-integ-tests/cdk-test-migrate-deployment-for-app-with-localfile-source-in-migrate.json.integtest.js +4 -4
  104. package/tests/cli-integ-tests/cdk-update-to-stack-in-rollback_complete-state-will-delete-stack-and-create-a-new-one.integtest.js +5 -6
  105. package/tests/cli-integ-tests/proxy.integtest.js +2 -3
  106. package/tests/init-go/init-go.integtest.js +2 -3
  107. package/tests/init-typescript-app/init-typescript-app.integtest.js +1 -1
  108. package/tests/tool-integrations/amplify.integtest.js +4 -4
  109. package/tests/tool-integrations/with-tool-context.d.ts +5 -5
  110. package/tests/tool-integrations/with-tool-context.js +1 -1
  111. package/.eslintrc.js +0 -9
  112. package/lib/aws.ts +0 -303
  113. package/lib/cli/query-github.ts +0 -56
  114. package/lib/cli/run-suite.ts +0 -153
  115. package/lib/cli/stage-distribution.ts +0 -262
  116. package/lib/cli/test-root.ts +0 -3
  117. package/lib/corking.ts +0 -33
  118. package/lib/eventually.ts +0 -42
  119. package/lib/files.ts +0 -80
  120. package/lib/github.ts +0 -43
  121. package/lib/index.ts +0 -13
  122. package/lib/integ-test.ts +0 -110
  123. package/lib/lists.ts +0 -9
  124. package/lib/memoize.ts +0 -14
  125. package/lib/npm.ts +0 -41
  126. package/lib/package-sources/release-source.ts +0 -82
  127. package/lib/package-sources/repo-source.ts +0 -112
  128. package/lib/package-sources/repo-tools/npm.ts +0 -48
  129. package/lib/package-sources/source.ts +0 -35
  130. package/lib/package-sources/subprocess.ts +0 -15
  131. package/lib/process.ts +0 -154
  132. package/lib/proxy.ts +0 -64
  133. package/lib/resource-pool.ts +0 -140
  134. package/lib/resources.ts +0 -4
  135. package/lib/shell.ts +0 -331
  136. package/lib/staging/codeartifact.ts +0 -387
  137. package/lib/staging/maven.ts +0 -95
  138. package/lib/staging/npm.ts +0 -62
  139. package/lib/staging/nuget.ts +0 -75
  140. package/lib/staging/parallel-shell.ts +0 -51
  141. package/lib/staging/pypi.ts +0 -50
  142. package/lib/staging/usage-dir.ts +0 -99
  143. package/lib/with-aws.ts +0 -111
  144. package/lib/with-cdk-app.ts +0 -845
  145. package/lib/with-cli-lib.ts +0 -149
  146. package/lib/with-packages.ts +0 -15
  147. package/lib/with-sam.ts +0 -294
  148. package/lib/with-temporary-directory.ts +0 -35
  149. package/lib/with-timeout.ts +0 -33
  150. package/lib/xpmutex.ts +0 -218
  151. package/resources/cli-regression-patches/v2.130.0/node_modules/@aws-cdk-testing/cli-integ/resources/cdk-apps/sam_cdk_integ_app/lib/nested-stack.js +0 -19
  152. package/resources/cli-regression-patches/v2.130.0/node_modules/@aws-cdk-testing/cli-integ/resources/cdk-apps/sam_cdk_integ_app/lib/test-stack.js +0 -134
  153. package/tests/cli-integ-tests/cdk---exclusively-selects-only-selected-stack.integtest.ts +0 -29
  154. package/tests/cli-integ-tests/cdk-assets/cdk-assets-uses-profile.integtest.ts +0 -92
  155. package/tests/cli-integ-tests/cdk-assets/smoketest.integtest.ts +0 -82
  156. package/tests/cli-integ-tests/cdk-automatic-ordering-with-concurrency.integtest.ts +0 -15
  157. package/tests/cli-integ-tests/cdk-automatic-ordering.integtest.ts +0 -15
  158. package/tests/cli-integ-tests/cdk-automatic-rollback-if-paused-and---no-rollback-is-removed-from-flags.integtest.ts +0 -40
  159. package/tests/cli-integ-tests/cdk-automatic-rollback-if-paused-and-change-contains-a-replacement.integtest.ts +0 -40
  160. package/tests/cli-integ-tests/cdk-automatic-rollback-if-replacement-and---no-rollback-is-removed-from-flags.integtest.ts +0 -29
  161. package/tests/cli-integ-tests/cdk-bootstrap-a-customized-template-vendor-will-not-overwrite-the-default-template.integtest.ts +0 -42
  162. package/tests/cli-integ-tests/cdk-bootstrap-add-tags.integtest.ts +0 -26
  163. package/tests/cli-integ-tests/cdk-bootstrap-can-add-tags-then-update-tags-during-re-bootstrap.integtest.ts +0 -28
  164. package/tests/cli-integ-tests/cdk-bootstrap-can-and-deploy-if-omitting-execution-policies.integtest.ts +0 -21
  165. package/tests/cli-integ-tests/cdk-bootstrap-can-bootstrap-without-execution.integtest.ts +0 -22
  166. package/tests/cli-integ-tests/cdk-bootstrap-can-create-a-legacy-bootstrap-stack-with---public-access-block-configuration-false.integtest.ts +0 -21
  167. package/tests/cli-integ-tests/cdk-bootstrap-can-create-multiple-legacy-bootstrap-stacks.integtest.ts +0 -27
  168. package/tests/cli-integ-tests/cdk-bootstrap-can-deploy-modern-synthesized-stack-even-if-bootstrap-stack-name-is-unknown.integtest.ts +0 -24
  169. package/tests/cli-integ-tests/cdk-bootstrap-can-deploy-with-session-tags-on-the-deploy.integtest.ts +0 -25
  170. package/tests/cli-integ-tests/cdk-bootstrap-can-deploy-without-execution-role-and-with-session-tags-on-deploy-role.integtest.ts +0 -22
  171. package/tests/cli-integ-tests/cdk-bootstrap-can-dump-the-template.integtest.ts +0 -32
  172. package/tests/cli-integ-tests/cdk-bootstrap-can-remove-custompermissionsboundary.integtest.ts +0 -77
  173. package/tests/cli-integ-tests/cdk-bootstrap-can-remove-trusted-account.integtest.ts +0 -30
  174. package/tests/cli-integ-tests/cdk-bootstrap-can-use-the-custom-permissions-boundary-(with-slashes)-to-bootstrap.integtest.ts +0 -15
  175. package/tests/cli-integ-tests/cdk-bootstrap-can-use-the-custom-permissions-boundary-to-bootstrap.integtest.ts +0 -15
  176. package/tests/cli-integ-tests/cdk-bootstrap-can-use-the-default-permissions-boundary-to-bootstrap.integtest.ts +0 -15
  177. package/tests/cli-integ-tests/cdk-bootstrap-create-ecr-with-tag-immutability-to-set-on.integtest.ts +0 -34
  178. package/tests/cli-integ-tests/cdk-bootstrap-deploy-new-style-synthesis-to-new-style-bootstrap-(with-docker-image).integtest.ts +0 -22
  179. package/tests/cli-integ-tests/cdk-bootstrap-deploy-new-style-synthesis-to-new-style-bootstrap.integtest.ts +0 -22
  180. package/tests/cli-integ-tests/cdk-bootstrap-deploy-old-style-synthesis-to-new-style-bootstrap.integtest.ts +0 -21
  181. package/tests/cli-integ-tests/cdk-bootstrap-switch-on-termination-protection.integtest.ts +0 -24
  182. package/tests/cli-integ-tests/cdk-bootstrap-upgrade-legacy-bootstrap-stack-to-new-bootstrap-stack-while-in-use.integtest.ts +0 -47
  183. package/tests/cli-integ-tests/cdk-can-still-load-old-assemblies.integtest.ts +0 -57
  184. package/tests/cli-integ-tests/cdk-cdk-diff---fail-on-multiple-stacks-exits-with-error-if-any-of-the-stacks-contains-a-diff.integtest.ts +0 -22
  185. package/tests/cli-integ-tests/cdk-cdk-diff---fail-with-multiple-stack-exits-with-if-any-of-the-stacks-contains-a-diff.integtest.ts +0 -22
  186. package/tests/cli-integ-tests/cdk-cdk-diff---quiet-does-not-print-there-were-no-differences-message-for-stacks-which-have-no-differences.integtest.ts +0 -19
  187. package/tests/cli-integ-tests/cdk-cdk-diff---security-only---fail-exits-when-security-changes-are-present.integtest.ts +0 -14
  188. package/tests/cli-integ-tests/cdk-cdk-diff---security-only---fail-exits-when-security-diff-for-sso-access-control-config.integtest.ts +0 -13
  189. package/tests/cli-integ-tests/cdk-cdk-diff---security-only---fail-exits-when-security-diff-for-sso-assignment.integtest.ts +0 -13
  190. package/tests/cli-integ-tests/cdk-cdk-diff---security-only---fail-exits-when-security-diff-for-sso-perm-set-with-managed-policy.integtest.ts +0 -13
  191. package/tests/cli-integ-tests/cdk-cdk-diff---security-only---fail-exits-when-security-diff-for-sso-perm-set-without-managed-policy.integtest.ts +0 -13
  192. package/tests/cli-integ-tests/cdk-cdk-diff---security-only-successfully-outputs-sso-access-control-information.integtest.ts +0 -35
  193. package/tests/cli-integ-tests/cdk-cdk-diff---security-only-successfully-outputs-sso-assignment-information.integtest.ts +0 -37
  194. package/tests/cli-integ-tests/cdk-cdk-diff---security-only-successfully-outputs-sso-permission-set-with-managed-policy-information.integtest.ts +0 -35
  195. package/tests/cli-integ-tests/cdk-cdk-diff---security-only-successfully-outputs-sso-permission-set-without-managed-policy-information.integtest.ts +0 -37
  196. package/tests/cli-integ-tests/cdk-cdk-diff-doesnt-show-resource-metadata-changes.integtest.ts +0 -23
  197. package/tests/cli-integ-tests/cdk-cdk-diff-shows-resource-metadata-changes-with---no-change-set.integtest.ts +0 -23
  198. package/tests/cli-integ-tests/cdk-cdk-diff-with-large-changeset-and-custom-toolkit-stack-name-and-qualifier-does-not-fail.integtest.ts +0 -39
  199. package/tests/cli-integ-tests/cdk-cdk-diff-with-large-changeset-does-not-fail.integtest.ts +0 -28
  200. package/tests/cli-integ-tests/cdk-cdk-diff.integtest.ts +0 -18
  201. package/tests/cli-integ-tests/cdk-cdk-ls---show-dependencies---json---long.integtest.ts +0 -50
  202. package/tests/cli-integ-tests/cdk-cdk-ls---show-dependencies---json.integtest.ts +0 -95
  203. package/tests/cli-integ-tests/cdk-cdk-ls.integtest.ts +0 -36
  204. package/tests/cli-integ-tests/cdk-cdk-notices-are-displayed-correctly.integtest.ts +0 -42
  205. package/tests/cli-integ-tests/cdk-cdk-notices-with---unacknowledged.integtest.ts +0 -14
  206. package/tests/cli-integ-tests/cdk-cdk-synth-add-the-metadata-properties-expected-by-sam.integtest.ts +0 -126
  207. package/tests/cli-integ-tests/cdk-cdk-synth-bundled-functions-as-expected.integtest.ts +0 -80
  208. package/tests/cli-integ-tests/cdk-cdk-synth.integtest.ts +0 -53
  209. package/tests/cli-integ-tests/cdk-ci-output-to-stderr.integtest.ts +0 -19
  210. package/tests/cli-integ-tests/cdk-ci-true-output-to-stdout.integtest.ts +0 -28
  211. package/tests/cli-integ-tests/cdk-construct-with-builtin-lambda-function.integtest.ts +0 -14
  212. package/tests/cli-integ-tests/cdk-context-in-stage-propagates-to-top.integtest.ts +0 -20
  213. package/tests/cli-integ-tests/cdk-context-setting.integtest.ts +0 -33
  214. package/tests/cli-integ-tests/cdk-deploy---method-direct.integtest.ts +0 -23
  215. package/tests/cli-integ-tests/cdk-deploy-all-concurrently.integtest.ts +0 -17
  216. package/tests/cli-integ-tests/cdk-deploy-all.integtest.ts +0 -14
  217. package/tests/cli-integ-tests/cdk-deploy-and-test-stack-with-lambda-asset.integtest.ts +0 -31
  218. package/tests/cli-integ-tests/cdk-deploy-deletes-all-notification-arns-when-empty-array-is-passed.integtest.ts +0 -50
  219. package/tests/cli-integ-tests/cdk-deploy-no-stacks-error.integtest.ts +0 -18
  220. package/tests/cli-integ-tests/cdk-deploy-no-stacks-with---ignore-no-stacks.integtest.ts +0 -17
  221. package/tests/cli-integ-tests/cdk-deploy-preserves-existing-notification-arns-when-not-specified.integtest.ts +0 -51
  222. package/tests/cli-integ-tests/cdk-deploy-stack-with-docker-asset.integtest.ts +0 -11
  223. package/tests/cli-integ-tests/cdk-deploy-stack-with-lambda-asset-to-object-lock-enabled-asset-bucket.integtest.ts +0 -42
  224. package/tests/cli-integ-tests/cdk-deploy-stack-without-resource.integtest.ts +0 -32
  225. package/tests/cli-integ-tests/cdk-deploy-wildcard-with-outputs.integtest.ts +0 -28
  226. package/tests/cli-integ-tests/cdk-deploy-with-import-existing-resources-true.integtest.ts +0 -29
  227. package/tests/cli-integ-tests/cdk-deploy-with-method-direct-and-import-existing-resources-fails.integtest.ts +0 -17
  228. package/tests/cli-integ-tests/cdk-deploy-with-notification-arn-as-flag.integtest.ts +0 -36
  229. package/tests/cli-integ-tests/cdk-deploy-with-notification-arn-as-prop-and-flag.integtest.ts +0 -45
  230. package/tests/cli-integ-tests/cdk-deploy-with-notification-arn-as-prop.integtest.ts +0 -37
  231. package/tests/cli-integ-tests/cdk-deploy-with-parameters-multi.integtest.ts +0 -33
  232. package/tests/cli-integ-tests/cdk-deploy-with-parameters.integtest.ts +0 -26
  233. package/tests/cli-integ-tests/cdk-deploy-with-role.integtest.ts +0 -119
  234. package/tests/cli-integ-tests/cdk-deploy-with-wildcard-and-parameters.integtest.ts +0 -22
  235. package/tests/cli-integ-tests/cdk-deploy-without-execute-a-named-change-set.integtest.ts +0 -36
  236. package/tests/cli-integ-tests/cdk-deploy-without-import-existing-resources.integtest.ts +0 -28
  237. package/tests/cli-integ-tests/cdk-deploy.integtest.ts +0 -20
  238. package/tests/cli-integ-tests/cdk-destroy-interactive.integtest.ts +0 -36
  239. package/tests/cli-integ-tests/cdk-doubly-nested-stack.integtest.ts +0 -12
  240. package/tests/cli-integ-tests/cdk-enablediffnofail.integtest.ts +0 -44
  241. package/tests/cli-integ-tests/cdk-failed-deploy-does-not-hang.integtest.ts +0 -12
  242. package/tests/cli-integ-tests/cdk-fast-deploy.integtest.ts +0 -41
  243. package/tests/cli-integ-tests/cdk-gc-garbage-collection-deletes-unused-ecr-images.integtest.ts +0 -48
  244. package/tests/cli-integ-tests/cdk-gc-garbage-collection-deletes-unused-s3-objects.integtest.ts +0 -51
  245. package/tests/cli-integ-tests/cdk-gc-garbage-collection-keeps-in-use-ecr-images.integtest.ts +0 -48
  246. package/tests/cli-integ-tests/cdk-gc-garbage-collection-keeps-in-use-s3-objects.integtest.ts +0 -52
  247. package/tests/cli-integ-tests/cdk-gc-garbage-collection-tags-unused-ecr-images.integtest.ts +0 -47
  248. package/tests/cli-integ-tests/cdk-gc-garbage-collection-tags-unused-s3-objects.integtest.ts +0 -63
  249. package/tests/cli-integ-tests/cdk-gc-garbage-collection-untags-in-use-ecr-images.integtest.ts +0 -55
  250. package/tests/cli-integ-tests/cdk-gc-garbage-collection-untags-in-use-s3-objects.integtest.ts +0 -63
  251. package/tests/cli-integ-tests/cdk-generating-and-loading-assembly.integtest.ts +0 -52
  252. package/tests/cli-integ-tests/cdk-hotswap-deployment-for-ecs-service-detects-failed-deployment-and-errors.integtest.ts +0 -29
  253. package/tests/cli-integ-tests/cdk-hotswap-deployment-for-ecs-service-waits-for-deployment-to-complete.integtest.ts +0 -45
  254. package/tests/cli-integ-tests/cdk-hotswap-deployment-supports-appsync-apis-with-many-functions.integtest.ts +0 -36
  255. package/tests/cli-integ-tests/cdk-hotswap-deployment-supports-ecs-service.integtest.ts +0 -41
  256. package/tests/cli-integ-tests/cdk-hotswap-deployment-supports-fn::importvalue-intrinsic.integtest.ts +0 -53
  257. package/tests/cli-integ-tests/cdk-hotswap-deployment-supports-lambda-functions-description-and-environment-variables.integtest.ts +0 -43
  258. package/tests/cli-integ-tests/cdk-hotswap-ecs-deployment-respects-properties-override.integtest.ts +0 -59
  259. package/tests/cli-integ-tests/cdk-iam-diff.integtest.ts +0 -23
  260. package/tests/cli-integ-tests/cdk-import-interactive.integtest.ts +0 -57
  261. package/tests/cli-integ-tests/cdk-lib-cli-lib-deploy.integtest.ts +0 -32
  262. package/tests/cli-integ-tests/cdk-lib-cli-lib-list.integtest.ts +0 -12
  263. package/tests/cli-integ-tests/cdk-lib-cli-lib-synth.integtest.ts +0 -27
  264. package/tests/cli-integ-tests/cdk-lib-security-related-changes-without-a-cli-are-expected-to-fail-when-approval-is-required.integtest.ts +0 -32
  265. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate--from-stack-creates-deployable-app-csharp.integtest.ts +0 -13
  266. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate--from-stack-creates-deployable-app-java.integtest.ts +0 -14
  267. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate--from-stack-creates-deployable-app-python.integtest.ts +0 -13
  268. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate--from-stack-creates-deployable-app-typescript.integtest.ts +0 -13
  269. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate-deploys-successfully-csharp.integtest.ts +0 -15
  270. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate-deploys-successfully-java.integtest.ts +0 -15
  271. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate-deploys-successfully-python.integtest.ts +0 -15
  272. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate-deploys-successfully-typescript.integtest.ts +0 -15
  273. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate-generates-migrate.json.integtest.ts +0 -20
  274. package/tests/cli-integ-tests/cdk-migrate/testcase.ts +0 -69
  275. package/tests/cli-integ-tests/cdk-nested-stack-with-parameters.integtest.ts +0 -28
  276. package/tests/cli-integ-tests/cdk-requests-go-through-a-proxy-when-configured.integtest.ts +0 -39
  277. package/tests/cli-integ-tests/cdk-sam-can-locally-test-the-synthesized-cdk-application.integtest.ts +0 -25
  278. package/tests/cli-integ-tests/cdk-security-related-changes-without-a-cli-are-expected-to-fail.integtest.ts +0 -30
  279. package/tests/cli-integ-tests/cdk-skips-notice-refresh.integtest.ts +0 -26
  280. package/tests/cli-integ-tests/cdk-ssm-parameter-provider-error.integtest.ts +0 -18
  281. package/tests/cli-integ-tests/cdk-stack-in-update_rollback_complete-state-can-be-updated.integtest.ts +0 -59
  282. package/tests/cli-integ-tests/cdk-stage-with-bundled-lambda-function.integtest.ts +0 -13
  283. package/tests/cli-integ-tests/cdk-synth---quiet-can-be-specified-in-cdk.json.integtest.ts +0 -20
  284. package/tests/cli-integ-tests/cdk-synthing-a-stage-with-errors-can-be-suppressed.integtest.ts +0 -15
  285. package/tests/cli-integ-tests/cdk-synthing-a-stage-with-errors-leads-to-failure.integtest.ts +0 -18
  286. package/tests/cli-integ-tests/cdk-templates-on-disk-contain-metadata-resource.integtest.ts +0 -25
  287. package/tests/cli-integ-tests/cdk-termination-protection.integtest.ts +0 -19
  288. package/tests/cli-integ-tests/cdk-test-cdk-rollback---force.integtest.ts +0 -48
  289. package/tests/cli-integ-tests/cdk-test-cdk-rollback.integtest.ts +0 -38
  290. package/tests/cli-integ-tests/cdk-test-migrate-deployment-for-app-with-localfile-source-in-migrate.json.integtest.ts +0 -56
  291. package/tests/cli-integ-tests/cdk-test-resource-import-with-construct-that-requires-bundling.integtest.ts +0 -74
  292. package/tests/cli-integ-tests/cdk-test-resource-import.integtest.ts +0 -64
  293. package/tests/cli-integ-tests/cdk-two-ways-of-showing-the-version.integtest.ts +0 -14
  294. package/tests/cli-integ-tests/cdk-update-to-stack-in-rollback_complete-state-will-delete-stack-and-create-a-new-one.integtest.ts +0 -47
  295. package/tests/cli-integ-tests/cdk-vpc-lookup.integtest.ts +0 -26
  296. package/tests/cli-integ-tests/proxy.integtest.ts +0 -168
  297. package/tests/init-csharp/init-csharp.integtest.ts +0 -15
  298. package/tests/init-fsharp/init-fsharp.integtest.ts +0 -15
  299. package/tests/init-go/init-go.integtest.ts +0 -28
  300. package/tests/init-java/init-java.integtest.ts +0 -14
  301. package/tests/init-javascript/init-javascript.integtest.ts +0 -58
  302. package/tests/init-python/init-python.integtest.ts +0 -20
  303. package/tests/init-typescript-app/init-typescript-app.integtest.ts +0 -67
  304. package/tests/init-typescript-lib/init-typescript-lib.integtest.ts +0 -13
  305. package/tests/tool-integrations/amplify.integtest.ts +0 -117
  306. package/tests/tool-integrations/with-tool-context.ts +0 -14
  307. package/tests/uberpackage/uberpackage.integtest.ts +0 -11
@@ -1,95 +0,0 @@
1
- /* eslint-disable no-console */
2
- import * as path from 'path';
3
- import { pathExists } from 'fs-extra';
4
- import { LoginInformation } from './codeartifact';
5
- import { parallelShell } from './parallel-shell';
6
- import { UsageDir } from './usage-dir';
7
- import { writeFile } from '../files';
8
- import { shell } from '../shell';
9
-
10
- // Do not try to JIT the Maven binary
11
- const NO_JIT = '-XX:+TieredCompilation -XX:TieredStopAtLevel=1';
12
-
13
- export async function mavenLogin(login: LoginInformation, usageDir: UsageDir) {
14
- await writeMavenSettingsFile(settingsFile(usageDir), login);
15
-
16
- // Write env var
17
- // Twiddle JVM settings a bit to make Maven survive running on a CodeBuild box.
18
- await usageDir.addToEnv({
19
- MAVEN_OPTS: `-Duser.home=${usageDir.directory} ${NO_JIT} ${process.env.MAVEN_OPTS ?? ''}`.trim(),
20
- });
21
- }
22
-
23
- function settingsFile(usageDir: UsageDir) {
24
- // If we configure usageDir as a fake home directory Maven will find this file.
25
- // (No other way to configure the settings file as part of the environment).
26
- return path.join(usageDir.directory, '.m2', 'settings.xml');
27
- }
28
-
29
- export async function uploadJavaPackages(packages: string[], login: LoginInformation, usageDir: UsageDir) {
30
- await parallelShell(packages, async (pkg, output) => {
31
- console.log(`⏳ ${pkg}`);
32
-
33
- const sourcesFile = pkg.replace(/.pom$/, '-sources.jar');
34
- const javadocFile = pkg.replace(/.pom$/, '-javadoc.jar');
35
-
36
- await shell(['mvn',
37
- `--settings=${settingsFile(usageDir)}`,
38
- 'org.apache.maven.plugins:maven-deploy-plugin:3.0.0:deploy-file',
39
- `-Durl=${login.mavenEndpoint}`,
40
- '-DrepositoryId=codeartifact',
41
- `-DpomFile=${pkg}`,
42
- `-Dfile=${pkg.replace(/.pom$/, '.jar')}`,
43
- ...await pathExists(sourcesFile) ? [`-Dsources=${sourcesFile}`] : [],
44
- ...await pathExists(javadocFile) ? [`-Djavadoc=${javadocFile}`] : []], {
45
- outputs: [output],
46
- modEnv: {
47
- // Do not try to JIT the Maven binary
48
- MAVEN_OPTS: `${NO_JIT} ${process.env.MAVEN_OPTS ?? ''}`.trim(),
49
- },
50
- });
51
-
52
- console.log(`✅ ${pkg}`);
53
- },
54
- (pkg, output) => {
55
- if (output.toString().includes('409 Conflict')) {
56
- console.log(`❌ ${pkg}: already exists. Skipped.`);
57
- return 'skip';
58
- }
59
- if (output.toString().includes('Too Many Requests')) {
60
- console.log(`♻️ ${pkg}: Too many requests. Retrying.`);
61
- return 'retry';
62
- }
63
- return 'fail';
64
- });
65
- }
66
-
67
- export async function writeMavenSettingsFile(filename: string, login: LoginInformation) {
68
- await writeFile(filename, `<?xml version="1.0" encoding="UTF-8" ?>
69
- <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
70
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
71
- xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
72
- http://maven.apache.org/xsd/settings-1.0.0.xsd">
73
- <servers>
74
- <server>
75
- <id>codeartifact</id>
76
- <username>aws</username>
77
- <password>${login.authToken}</password>
78
- </server>
79
- </servers>
80
- <profiles>
81
- <profile>
82
- <id>default</id>
83
- <repositories>
84
- <repository>
85
- <id>codeartifact</id>
86
- <url>${login.mavenEndpoint}</url>
87
- </repository>
88
- </repositories>
89
- </profile>
90
- </profiles>
91
- <activeProfiles>
92
- <activeProfile>default</activeProfile>
93
- </activeProfiles>
94
- </settings>`);
95
- }
@@ -1,62 +0,0 @@
1
- /* eslint-disable no-console */
2
- import * as path from 'path';
3
- import { LoginInformation } from './codeartifact';
4
- import { parallelShell } from './parallel-shell';
5
- import { UsageDir } from './usage-dir';
6
- import { updateIniKey, loadLines, writeLines } from '../files';
7
- import { shell } from '../shell';
8
-
9
- export async function npmLogin(login: LoginInformation, usageDir: UsageDir) {
10
- // Creating an ~/.npmrc that references an envvar is what you're supposed to do. (https://docs.npmjs.com/private-modules/ci-server-config)
11
- await writeNpmLoginToken(usageDir, login.npmEndpoint, '${NPM_TOKEN}');
12
-
13
- // Add variables to env file
14
- await usageDir.addToEnv(npmEnv(usageDir, login));
15
- }
16
-
17
- function npmEnv(usageDir: UsageDir, login: LoginInformation) {
18
- return {
19
- npm_config_userconfig: path.join(usageDir.directory, '.npmrc'),
20
- npm_config_registry: login.npmEndpoint,
21
- npm_config_always_auth: 'true', // Necessary for NPM 6, otherwise it will sometimes not pass the token
22
- NPM_TOKEN: login.authToken,
23
- };
24
- }
25
-
26
- export async function uploadNpmPackages(packages: string[], login: LoginInformation, usageDir: UsageDir) {
27
- await parallelShell(packages, async (pkg, output) => {
28
- console.log(`⏳ ${pkg}`);
29
-
30
- // path.resolve() is required -- if the filename ends up looking like `js/bla.tgz` then NPM thinks it's a short form GitHub name.
31
- await shell(['node', require.resolve('npm'), 'publish', path.resolve(pkg)], {
32
- modEnv: npmEnv(usageDir, login),
33
- show: 'error',
34
- outputs: [output],
35
- });
36
-
37
- console.log(`✅ ${pkg}`);
38
- }, (pkg, output) => {
39
- if (output.toString().includes('code EPUBLISHCONFLICT')) {
40
- console.log(`❌ ${pkg}: already exists. Skipped.`);
41
- return 'skip';
42
- }
43
- if (output.toString().includes('code EPRIVATE')) {
44
- console.log(`❌ ${pkg}: is private. Skipped.`);
45
- return 'skip';
46
- }
47
- return 'fail';
48
- });
49
- }
50
-
51
- async function writeNpmLoginToken(usageDir: UsageDir, endpoint: string, token: string) {
52
- const rcFile = path.join(usageDir.directory, '.npmrc');
53
- const lines = await loadLines(rcFile);
54
-
55
- const key = `${endpoint.replace(/^https:/, '')}:_authToken`;
56
- updateIniKey(lines, key, token);
57
-
58
- await writeLines(rcFile, lines);
59
- return rcFile;
60
- }
61
-
62
- // Environment variable, .npmrc in same directory as package.json or in home dir
@@ -1,75 +0,0 @@
1
- /* eslint-disable no-console */
2
- import { LoginInformation } from './codeartifact';
3
- import { parallelShell } from './parallel-shell';
4
- import { UsageDir } from './usage-dir';
5
- import { writeFile } from '../files';
6
- import { shell } from '../shell';
7
-
8
- export async function nugetLogin(login: LoginInformation, usageDir: UsageDir) {
9
- // NuGet.Config MUST live in the current directory or in the home directory, and there is no environment
10
- // variable to configure its location.
11
- await writeNuGetConfigFile(usageDir.cwdFile('NuGet.Config'), login);
12
- }
13
-
14
- export async function uploadDotnetPackages(packages: string[], usageDir: UsageDir) {
15
- await usageDir.copyCwdFileHere('NuGet.Config');
16
-
17
- await parallelShell(packages, async (pkg, output) => {
18
- console.log(`⏳ ${pkg}`);
19
-
20
- await shell(['dotnet', 'nuget', 'push',
21
- pkg,
22
- '--source', 'CodeArtifact',
23
- '--no-symbols',
24
- '--force-english-output',
25
- '--disable-buffering',
26
- '--timeout', '600',
27
- '--skip-duplicate'], {
28
- outputs: [output],
29
- });
30
-
31
- console.log(`✅ ${pkg}`);
32
- },
33
- (pkg, output) => {
34
- if (output.toString().includes('Conflict')) {
35
- console.log(`❌ ${pkg}: already exists. Skipped.`);
36
- return 'skip';
37
- }
38
- if (output.includes('System.Threading.AbandonedMutexException')) {
39
- console.log(`♻️ ${pkg}: AbandonedMutexException. Probably a sign of throttling, retrying.`);
40
- return 'retry';
41
- }
42
- if (output.includes('Too Many Requests')) {
43
- console.log(`♻️ ${pkg}: Too many requests. Retrying.`);
44
- return 'retry';
45
- }
46
- if (output.includes('System.IO.IOException: The system cannot open the device or file specified.')) {
47
- console.log(`♻️ ${pkg}: Some error that we've seen before as a result of throttling. Retrying.`);
48
- return 'retry';
49
- }
50
- return 'fail';
51
- });
52
- }
53
-
54
- async function writeNuGetConfigFile(filename: string, login: LoginInformation) {
55
- // `dotnet nuget push` has an `--api-key` parameter, but CodeArtifact
56
- // does not support that. We must authenticate with Basic auth.
57
- await writeFile(filename, `<?xml version="1.0" encoding="utf-8"?>
58
- <configuration>
59
- <packageSources>
60
- <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
61
- <add key="CodeArtifact" value="${login.nugetEndpoint}v3/index.json" />
62
- </packageSources>
63
- <activePackageSource>
64
- <add key="CodeArtifact" value="${login.nugetEndpoint}v3/index.json" />
65
- </activePackageSource>
66
- <packageSourceCredentials>
67
- <CodeArtifact>
68
- <add key="Username" value="aws" />
69
- <add key="ClearTextPassword" value="${login.authToken}" />
70
- </CodeArtifact>
71
- </packageSourceCredentials>
72
- </configuration>`);
73
- }
74
-
75
- // NuGet.Config in current directory
@@ -1,51 +0,0 @@
1
- import PQueue from 'p-queue';
2
- import { sleep } from '../aws';
3
- import { MemoryStream } from '../corking';
4
-
5
- export type ErrorResponse = 'fail' | 'skip' | 'retry';
6
-
7
- /**
8
- * Run a function in parallel with cached output
9
- */
10
- export async function parallelShell<A>(
11
- inputs: A[],
12
- block: (x: A, output: NodeJS.WritableStream) => Promise<void>,
13
- swallowError?: (x: A, output: string) => ErrorResponse,
14
- ) {
15
- // Limit to 10 for now, too many instances of Maven exhaust the CodeBuild instance memory
16
- const q = new PQueue({ concurrency: Number(process.env.CONCURRENCY) || 10 });
17
- await q.addAll(inputs.map(input => async () => {
18
- let attempts = 10;
19
- let sleepMs = 500;
20
- while (true) {
21
- const output = new MemoryStream();
22
- try {
23
- await block(input, output);
24
- return;
25
- } catch (e) {
26
- switch (swallowError?.(input, output.toString())) {
27
- case 'skip':
28
- return;
29
-
30
- case 'retry':
31
- if (--attempts > 0) {
32
- await sleep(Math.floor(Math.random() * sleepMs));
33
- sleepMs *= 2;
34
- continue;
35
- }
36
- break;
37
-
38
- case 'fail':
39
- case undefined:
40
- break;
41
- }
42
-
43
- // eslint-disable-next-line no-console
44
- console.error(output.toString());
45
- throw e;
46
- }
47
- }
48
- }));
49
-
50
- await q.onEmpty();
51
- }
@@ -1,50 +0,0 @@
1
- /* eslint-disable no-console */
2
- import * as path from 'path';
3
- import { LoginInformation } from './codeartifact';
4
- import { parallelShell } from './parallel-shell';
5
- import { UsageDir } from './usage-dir';
6
- import { writeFile } from '../files';
7
- import { shell } from '../shell';
8
-
9
- export async function pypiLogin(login: LoginInformation, usageDir: UsageDir) {
10
- // Write pip config file and set environment var
11
- await writeFile(path.join(usageDir.directory, 'pip.conf'), [
12
- '[global]',
13
- `index-url = https://aws:${login.authToken}@${login.pypiEndpoint.replace(/^https:\/\//, '')}simple/`,
14
- ].join('\n'));
15
- await usageDir.addToEnv({
16
- PIP_CONFIG_FILE: `${usageDir.directory}/pip.conf`,
17
- });
18
- }
19
-
20
- export async function uploadPythonPackages(packages: string[], login: LoginInformation) {
21
- await shell(['pip', 'install', 'twine'], { show: 'error' });
22
-
23
- // Even though twine supports uploading all packages in one go, we have to upload them
24
- // individually since CodeArtifact does not support Twine's `--skip-existing`. Fun beans.
25
- await parallelShell(packages, async (pkg, output) => {
26
- console.log(`⏳ ${pkg}`);
27
-
28
- await shell(['twine', 'upload', '--verbose', pkg], {
29
- modEnv: {
30
- TWINE_USERNAME: 'aws',
31
- TWINE_PASSWORD: login.authToken,
32
- TWINE_REPOSITORY_URL: login.pypiEndpoint,
33
- },
34
- show: 'error',
35
- outputs: [output],
36
- });
37
-
38
- console.log(`✅ ${pkg}`);
39
- }, (pkg, output) => {
40
- if (output.toString().includes('This package is configured to block new versions') || output.toString().includes('409 Conflict')) {
41
- console.log(`❌ ${pkg}: already exists. Skipped.`);
42
- return 'skip';
43
- }
44
- if (output.includes('429 Too Many Requests ')) {
45
- console.log(`♻️ ${pkg}: 429 Too Many Requests. Retrying.`);
46
- return 'retry';
47
- }
48
- return 'fail';
49
- });
50
- }
@@ -1,99 +0,0 @@
1
- import * as path from 'path';
2
- import * as fs from 'fs-extra';
3
- import { copyDirectoryContents, homeDir, loadLines, updateIniKey, writeLines } from '../files';
4
-
5
- export const DEFAULT_USAGE_DIR = path.join(homeDir(), '.codeartifact/usage');
6
-
7
- /**
8
- * The usage directory is where we write per-session config files to access the CodeArtifact repository.
9
- *
10
- * Some config files may be written in a system-global location, but they will not be active unless the
11
- * contents of this directory have been sourced/copied into the current terminal.
12
- *
13
- * CONTRACT
14
- *
15
- * There are two special entries:
16
- *
17
- * - `env`, a file with `key=value` entries for environment variables to set.
18
- * - `cwd/`, a directory with files that need to be copied into the current directory before each command.
19
- *
20
- * Other than these, code may write tempfiles to this directory if it wants, but there is no meaning
21
- * implied for other files.
22
- */
23
- export class UsageDir {
24
- public static default() {
25
- return new UsageDir(DEFAULT_USAGE_DIR);
26
- }
27
-
28
- public readonly envFile: string;
29
- public readonly cwdDir: string;
30
-
31
- private constructor(public readonly directory: string) {
32
- this.envFile = path.join(this.directory, 'env');
33
- this.cwdDir = path.join(this.directory, 'cwd');
34
- }
35
-
36
- public async clean() {
37
- await fs.rm(this.directory, { recursive: true, force: true });
38
- await fs.mkdirp(path.join(this.directory, 'cwd'));
39
- await fs.writeFile(path.join(this.directory, 'env'), '', { encoding: 'utf-8' });
40
-
41
- await this.addToEnv({
42
- CWD_FILES_DIR: path.join(this.directory, 'cwd'),
43
- });
44
-
45
- // Write a bash helper to load these settings
46
- await fs.writeFile(path.join(this.directory, 'activate.bash'), [
47
- `while read -u10 line; do [[ -z $line ]] || export "$line"; done 10<${this.directory}/env`,
48
- 'cp -R $CWD_FILES_DIR/ .', // Copy files from directory even if it is empty
49
- ].join('\n'), { encoding: 'utf-8' });
50
- }
51
-
52
- public async addToEnv(settings: Record<string, string>) {
53
- const lines = await loadLines(this.envFile);
54
- for (const [k, v] of Object.entries(settings)) {
55
- updateIniKey(lines, k, v);
56
- }
57
- await writeLines(this.envFile, lines);
58
- }
59
-
60
- public async currentEnv(): Promise<Record<string, string>> {
61
- const lines = await loadLines(this.envFile);
62
-
63
- const splitter = /^([a-zA-Z0-9_-]+)\s*=\s*(.*)$/;
64
-
65
- const ret: Record<string, string> = {};
66
- for (const line of lines) {
67
- const m = line.match(splitter);
68
- if (m) {
69
- ret[m[1]] = m[2];
70
- }
71
- }
72
- return ret;
73
- }
74
-
75
- public cwdFile(filename: string) {
76
- return path.join(this.cwdDir, filename);
77
- }
78
-
79
- public async activateInCurrentProcess() {
80
- for (const [k, v] of Object.entries(await this.currentEnv())) {
81
- process.env[k] = v;
82
- }
83
-
84
- await copyDirectoryContents(this.cwdDir, '.');
85
- }
86
-
87
- public async copyCwdFileHere(...filenames: string[]) {
88
- for (const file of filenames) {
89
- await fs.copyFile(path.join(this.cwdDir, file), file);
90
- }
91
- }
92
-
93
- public advertise() {
94
- // eslint-disable-next-line no-console
95
- console.log('To activate these settings in the current terminal:');
96
- // eslint-disable-next-line no-console
97
- console.log(` source ${this.directory}/activate.bash`);
98
- }
99
- }
package/lib/with-aws.ts DELETED
@@ -1,111 +0,0 @@
1
- import { AtmosphereClient } from '@cdklabs/cdk-atmosphere-client';
2
- import { AwsClients } from './aws';
3
- import { TestContext } from './integ-test';
4
- import { ResourcePool } from './resource-pool';
5
- import { DisableBootstrapContext } from './with-cdk-app';
6
-
7
- export function atmosphereEnabled(): boolean {
8
- const enabled = process.env.CDK_INTEG_ATMOSPHERE_ENABLED;
9
- return enabled === 'true' || enabled === '1';
10
- }
11
-
12
- export function atmosphereEndpoint(): string {
13
- const value = process.env.CDK_INTEG_ATMOSPHERE_ENDPOINT;
14
- if (!value) {
15
- throw new Error('CDK_INTEG_ATMOSPHERE_ENDPOINT is not defined');
16
- }
17
- return value;
18
- }
19
-
20
- export function atmospherePool() {
21
- const value = process.env.CDK_INTEG_ATMOSPHERE_POOL;
22
- if (!value) {
23
- throw new Error('CDK_INTEG_ATMOSPHERE_POOL is not defined');
24
- }
25
- return value;
26
- }
27
-
28
- export type AwsContext = { readonly aws: AwsClients };
29
-
30
- /**
31
- * Higher order function to execute a block with an AWS client setup
32
- *
33
- * Allocate the next region from the REGION pool and dispose it afterwards.
34
- */
35
- export function withAws<A extends TestContext>(
36
- block: (context: A & AwsContext & DisableBootstrapContext) => Promise<void>,
37
- disableBootstrap: boolean = false,
38
- ): (context: A) => Promise<void> {
39
- return async (context: A) => {
40
- if (atmosphereEnabled()) {
41
- const atmosphere = new AtmosphereClient(atmosphereEndpoint());
42
- const allocation = await atmosphere.acquire({ pool: atmospherePool(), requester: context.name, timeoutSeconds: 60 * 30 });
43
- const aws = await AwsClients.forIdentity(allocation.environment.region, {
44
- accessKeyId: allocation.credentials.accessKeyId,
45
- secretAccessKey: allocation.credentials.secretAccessKey,
46
- sessionToken: allocation.credentials.sessionToken,
47
- accountId: allocation.environment.account,
48
- }, context.output);
49
-
50
- await sanityCheck(aws);
51
-
52
- let outcome = 'success';
53
- try {
54
- return await block({ ...context, disableBootstrap, aws });
55
- } catch (e: any) {
56
- outcome = 'failure';
57
- throw e;
58
- } finally {
59
- await atmosphere.release(allocation.id, outcome);
60
- }
61
- } else {
62
- return regionPool().using(async (region) => {
63
- const aws = await AwsClients.forRegion(region, context.output);
64
- await sanityCheck(aws);
65
-
66
- return block({ ...context, disableBootstrap, aws });
67
- });
68
- }
69
- };
70
- }
71
-
72
- let _regionPool: undefined | ResourcePool;
73
- export function regionPool(): ResourcePool {
74
- if (_regionPool !== undefined) {
75
- return _regionPool;
76
- }
77
-
78
- const REGIONS = process.env.AWS_REGIONS
79
- ? process.env.AWS_REGIONS.split(',')
80
- : [process.env.AWS_REGION ?? process.env.AWS_DEFAULT_REGION ?? 'us-east-1'];
81
-
82
- _regionPool = ResourcePool.withResources('aws_regions', REGIONS);
83
- return _regionPool;
84
- }
85
-
86
- /**
87
- * Perform a one-time quick sanity check that the AWS clients have properly configured credentials
88
- *
89
- * If we don't do this, calls are going to fail and they'll be retried and everything will take
90
- * forever before the user notices a simple misconfiguration.
91
- *
92
- * We can't check for the presence of environment variables since credentials could come from
93
- * anywhere, so do simple account retrieval.
94
- *
95
- * Only do it once per process.
96
- */
97
- async function sanityCheck(aws: AwsClients) {
98
- if (sanityChecked === undefined) {
99
- try {
100
- await aws.account();
101
- sanityChecked = true;
102
- } catch (e: any) {
103
- sanityChecked = false;
104
- throw new Error(`AWS credentials probably not configured, got error: ${e.message}`);
105
- }
106
- }
107
- if (!sanityChecked) {
108
- throw new Error('AWS credentials probably not configured, see previous error');
109
- }
110
- }
111
- let sanityChecked: boolean | undefined;