@aws-cdk-testing/cli-integ 3.5.0 → 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.
- package/lib/aws.js +6 -9
- package/lib/cli/query-github.js +2 -3
- package/lib/cli/run-suite.js +2 -3
- package/lib/cli/stage-distribution.js +4 -4
- package/lib/eventually.js +3 -3
- package/lib/files.js +2 -3
- package/lib/github.js +5 -6
- package/lib/integ-test.js +58 -3
- package/lib/package-sources/release-source.d.ts +1 -1
- package/lib/package-sources/release-source.js +2 -3
- package/lib/package-sources/repo-source.d.ts +1 -1
- package/lib/package-sources/repo-source.js +1 -1
- package/lib/package-sources/repo-tools/npm.js +4 -5
- package/lib/package-sources/subprocess.d.ts +1 -1
- package/lib/package-sources/subprocess.js +1 -1
- package/lib/process.js +5 -6
- package/lib/proxy.d.ts +1 -1
- package/lib/proxy.js +2 -2
- package/lib/resource-pool.js +5 -3
- package/lib/shell.d.ts +3 -3
- package/lib/shell.js +8 -12
- package/lib/staging/codeartifact.js +8 -11
- package/lib/staging/maven.d.ts +2 -2
- package/lib/staging/maven.js +3 -5
- package/lib/staging/npm.d.ts +2 -2
- package/lib/staging/npm.js +1 -1
- package/lib/staging/nuget.d.ts +2 -2
- package/lib/staging/nuget.js +1 -1
- package/lib/staging/parallel-shell.js +2 -2
- package/lib/staging/pypi.d.ts +2 -2
- package/lib/staging/pypi.js +1 -1
- package/lib/with-aws.d.ts +2 -2
- package/lib/with-aws.js +5 -4
- package/lib/with-cdk-app.d.ts +7 -5
- package/lib/with-cdk-app.js +28 -33
- package/lib/with-cli-lib.d.ts +4 -3
- package/lib/with-cli-lib.js +1 -1
- package/lib/with-packages.d.ts +1 -1
- package/lib/with-packages.js +1 -1
- package/lib/with-sam.d.ts +3 -3
- package/lib/with-sam.js +4 -7
- package/lib/with-temporary-directory.d.ts +1 -1
- package/lib/with-temporary-directory.js +1 -1
- package/lib/xpmutex.js +5 -3
- package/npm-shrinkwrap.json +8722 -0
- package/package.json +11 -7
- package/resources/cdk-apps/refactoring/cdk.json +7 -0
- package/resources/cdk-apps/refactoring/refactoring.js +18 -0
- package/test-reports/junit.xml +15 -0
- package/tests/cli-integ-tests/cdk-assets/cdk-assets-uses-profile.integtest.js +11 -11
- package/tests/cli-integ-tests/cdk-assets/smoketest.integtest.js +9 -9
- package/tests/cli-integ-tests/cdk-bootstrap-add-tags.integtest.js +2 -3
- package/tests/cli-integ-tests/cdk-bootstrap-can-add-tags-then-update-tags-during-re-bootstrap.integtest.js +2 -3
- package/tests/cli-integ-tests/cdk-bootstrap-can-bootstrap-without-execution.integtest.js +2 -3
- package/tests/cli-integ-tests/cdk-bootstrap-can-create-a-legacy-bootstrap-stack-with---public-access-block-configuration-false.integtest.js +2 -3
- package/tests/cli-integ-tests/cdk-bootstrap-can-create-multiple-legacy-bootstrap-stacks.integtest.js +2 -3
- package/tests/cli-integ-tests/cdk-bootstrap-can-remove-custompermissionsboundary.integtest.js +4 -6
- package/tests/cli-integ-tests/cdk-bootstrap-can-remove-trusted-account.integtest.js +2 -3
- package/tests/cli-integ-tests/cdk-bootstrap-create-ecr-with-tag-immutability-to-set-on.integtest.js +4 -5
- package/tests/cli-integ-tests/cdk-bootstrap-switch-on-termination-protection.integtest.js +2 -3
- package/tests/cli-integ-tests/cdk-ci-true-output-to-stdout.integtest.js +1 -1
- package/tests/cli-integ-tests/cdk-deploy---method-direct.integtest.js +2 -3
- package/tests/cli-integ-tests/cdk-deploy-and-test-stack-with-lambda-asset.integtest.js +3 -4
- package/tests/cli-integ-tests/cdk-deploy-deletes-all-notification-arns-when-empty-array-is-passed.integtest.js +3 -4
- package/tests/cli-integ-tests/cdk-deploy-preserves-existing-notification-arns-when-not-specified.integtest.js +2 -3
- package/tests/cli-integ-tests/cdk-deploy-with-import-existing-resources-true.integtest.js +2 -3
- package/tests/cli-integ-tests/cdk-deploy-with-notification-arn-as-flag.integtest.js +2 -3
- package/tests/cli-integ-tests/cdk-deploy-with-notification-arn-as-prop-and-flag.integtest.js +2 -3
- package/tests/cli-integ-tests/cdk-deploy-with-notification-arn-as-prop.integtest.js +2 -3
- package/tests/cli-integ-tests/cdk-deploy-with-parameters-multi.integtest.js +3 -4
- package/tests/cli-integ-tests/cdk-deploy-with-parameters.integtest.js +2 -3
- package/tests/cli-integ-tests/cdk-deploy-without-execute-a-named-change-set.integtest.js +2 -3
- package/tests/cli-integ-tests/cdk-deploy-without-import-existing-resources.integtest.js +2 -3
- package/tests/cli-integ-tests/cdk-deploy.integtest.js +2 -3
- package/tests/cli-integ-tests/cdk-destroy-interactive.integtest.js +6 -7
- package/tests/cli-integ-tests/cdk-fast-deploy.integtest.js +4 -5
- package/tests/cli-integ-tests/cdk-gc-garbage-collection-untags-in-use-s3-objects.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-hotswap-deployment-for-ecs-service-waits-for-deployment-to-complete.integtest.js +6 -5
- package/tests/cli-integ-tests/cdk-hotswap-deployment-supports-appsync-apis-with-many-functions.integtest.js +2 -3
- package/tests/cli-integ-tests/cdk-hotswap-deployment-supports-ecs-service.integtest.js +3 -4
- package/tests/cli-integ-tests/cdk-hotswap-deployment-supports-fn::importvalue-intrinsic.integtest.js +3 -4
- package/tests/cli-integ-tests/cdk-hotswap-deployment-supports-lambda-functions-description-and-environment-variables.integtest.js +3 -4
- package/tests/cli-integ-tests/cdk-hotswap-ecs-deployment-respects-properties-override.integtest.js +5 -6
- package/tests/cli-integ-tests/cdk-import-interactive.integtest.js +5 -6
- package/tests/cli-integ-tests/cdk-lib-cli-lib-deploy.integtest.js +2 -3
- 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
- package/tests/cli-integ-tests/cdk-migrate/cdk-migrate--from-stack-creates-deployable-app-csharp.integtest.js +1 -1
- package/tests/cli-integ-tests/cdk-migrate/cdk-migrate--from-stack-creates-deployable-app-java.integtest.js +1 -1
- package/tests/cli-integ-tests/cdk-migrate/cdk-migrate--from-stack-creates-deployable-app-python.integtest.js +1 -1
- package/tests/cli-integ-tests/cdk-migrate/cdk-migrate--from-stack-creates-deployable-app-typescript.integtest.js +1 -1
- package/tests/cli-integ-tests/cdk-migrate/cdk-migrate-deploys-successfully-csharp.integtest.js +1 -1
- package/tests/cli-integ-tests/cdk-migrate/cdk-migrate-deploys-successfully-java.integtest.js +1 -1
- package/tests/cli-integ-tests/cdk-migrate/cdk-migrate-deploys-successfully-python.integtest.js +1 -1
- package/tests/cli-integ-tests/cdk-migrate/cdk-migrate-deploys-successfully-typescript.integtest.js +1 -1
- package/tests/cli-integ-tests/cdk-migrate/cdk-migrate-generates-migrate.json.integtest.js +1 -1
- package/tests/cli-integ-tests/cdk-migrate/testcase.d.ts +1 -1
- package/tests/cli-integ-tests/cdk-migrate/testcase.js +4 -6
- package/tests/cli-integ-tests/cdk-nested-stack-with-parameters.integtest.js +2 -3
- package/tests/cli-integ-tests/cdk-refactor-dry-run.integtest.d.ts +1 -0
- package/tests/cli-integ-tests/cdk-refactor-dry-run.integtest.js +41 -0
- package/tests/cli-integ-tests/cdk-requests-go-through-a-proxy-when-configured.integtest.js +2 -3
- package/tests/cli-integ-tests/cdk-stack-in-update_rollback_complete-state-can-be-updated.integtest.js +5 -6
- package/tests/cli-integ-tests/cdk-test-migrate-deployment-for-app-with-localfile-source-in-migrate.json.integtest.js +4 -4
- 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
- package/tests/cli-integ-tests/proxy.integtest.js +2 -3
- package/tests/init-go/init-go.integtest.js +2 -3
- package/tests/init-typescript-app/init-typescript-app.integtest.js +1 -1
- package/tests/tool-integrations/amplify.integtest.js +4 -4
- package/tests/tool-integrations/with-tool-context.d.ts +5 -5
- package/tests/tool-integrations/with-tool-context.js +1 -1
- package/.eslintrc.js +0 -9
- package/lib/aws.ts +0 -303
- package/lib/cli/query-github.ts +0 -56
- package/lib/cli/run-suite.ts +0 -153
- package/lib/cli/stage-distribution.ts +0 -262
- package/lib/cli/test-root.ts +0 -3
- package/lib/corking.ts +0 -33
- package/lib/eventually.ts +0 -42
- package/lib/files.ts +0 -80
- package/lib/github.ts +0 -43
- package/lib/index.ts +0 -13
- package/lib/integ-test.ts +0 -110
- package/lib/lists.ts +0 -9
- package/lib/memoize.ts +0 -14
- package/lib/npm.ts +0 -41
- package/lib/package-sources/release-source.ts +0 -82
- package/lib/package-sources/repo-source.ts +0 -112
- package/lib/package-sources/repo-tools/npm.ts +0 -48
- package/lib/package-sources/source.ts +0 -35
- package/lib/package-sources/subprocess.ts +0 -15
- package/lib/process.ts +0 -154
- package/lib/proxy.ts +0 -64
- package/lib/resource-pool.ts +0 -140
- package/lib/resources.ts +0 -4
- package/lib/shell.ts +0 -331
- package/lib/staging/codeartifact.ts +0 -387
- package/lib/staging/maven.ts +0 -95
- package/lib/staging/npm.ts +0 -62
- package/lib/staging/nuget.ts +0 -75
- package/lib/staging/parallel-shell.ts +0 -51
- package/lib/staging/pypi.ts +0 -50
- package/lib/staging/usage-dir.ts +0 -99
- package/lib/with-aws.ts +0 -111
- package/lib/with-cdk-app.ts +0 -847
- package/lib/with-cli-lib.ts +0 -150
- package/lib/with-packages.ts +0 -15
- package/lib/with-sam.ts +0 -295
- package/lib/with-temporary-directory.ts +0 -35
- package/lib/with-timeout.ts +0 -33
- package/lib/xpmutex.ts +0 -218
- 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
- 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
- package/tests/cli-integ-tests/cdk---exclusively-selects-only-selected-stack.integtest.ts +0 -29
- package/tests/cli-integ-tests/cdk-assets/cdk-assets-uses-profile.integtest.ts +0 -92
- package/tests/cli-integ-tests/cdk-assets/smoketest.integtest.ts +0 -82
- package/tests/cli-integ-tests/cdk-automatic-ordering-with-concurrency.integtest.ts +0 -15
- package/tests/cli-integ-tests/cdk-automatic-ordering.integtest.ts +0 -15
- package/tests/cli-integ-tests/cdk-automatic-rollback-if-paused-and---no-rollback-is-removed-from-flags.integtest.ts +0 -40
- package/tests/cli-integ-tests/cdk-automatic-rollback-if-paused-and-change-contains-a-replacement.integtest.ts +0 -40
- package/tests/cli-integ-tests/cdk-automatic-rollback-if-replacement-and---no-rollback-is-removed-from-flags.integtest.ts +0 -29
- package/tests/cli-integ-tests/cdk-bootstrap-a-customized-template-vendor-will-not-overwrite-the-default-template.integtest.ts +0 -42
- package/tests/cli-integ-tests/cdk-bootstrap-add-tags.integtest.ts +0 -26
- package/tests/cli-integ-tests/cdk-bootstrap-can-add-tags-then-update-tags-during-re-bootstrap.integtest.ts +0 -28
- package/tests/cli-integ-tests/cdk-bootstrap-can-and-deploy-if-omitting-execution-policies.integtest.ts +0 -21
- package/tests/cli-integ-tests/cdk-bootstrap-can-bootstrap-without-execution.integtest.ts +0 -22
- package/tests/cli-integ-tests/cdk-bootstrap-can-create-a-legacy-bootstrap-stack-with---public-access-block-configuration-false.integtest.ts +0 -21
- package/tests/cli-integ-tests/cdk-bootstrap-can-create-multiple-legacy-bootstrap-stacks.integtest.ts +0 -27
- package/tests/cli-integ-tests/cdk-bootstrap-can-deploy-modern-synthesized-stack-even-if-bootstrap-stack-name-is-unknown.integtest.ts +0 -24
- package/tests/cli-integ-tests/cdk-bootstrap-can-deploy-with-session-tags-on-the-deploy.integtest.ts +0 -25
- package/tests/cli-integ-tests/cdk-bootstrap-can-deploy-without-execution-role-and-with-session-tags-on-deploy-role.integtest.ts +0 -22
- package/tests/cli-integ-tests/cdk-bootstrap-can-dump-the-template.integtest.ts +0 -32
- package/tests/cli-integ-tests/cdk-bootstrap-can-remove-custompermissionsboundary.integtest.ts +0 -77
- package/tests/cli-integ-tests/cdk-bootstrap-can-remove-trusted-account.integtest.ts +0 -30
- package/tests/cli-integ-tests/cdk-bootstrap-can-use-the-custom-permissions-boundary-(with-slashes)-to-bootstrap.integtest.ts +0 -15
- package/tests/cli-integ-tests/cdk-bootstrap-can-use-the-custom-permissions-boundary-to-bootstrap.integtest.ts +0 -15
- package/tests/cli-integ-tests/cdk-bootstrap-can-use-the-default-permissions-boundary-to-bootstrap.integtest.ts +0 -15
- package/tests/cli-integ-tests/cdk-bootstrap-create-ecr-with-tag-immutability-to-set-on.integtest.ts +0 -34
- package/tests/cli-integ-tests/cdk-bootstrap-deploy-new-style-synthesis-to-new-style-bootstrap-(with-docker-image).integtest.ts +0 -22
- package/tests/cli-integ-tests/cdk-bootstrap-deploy-new-style-synthesis-to-new-style-bootstrap.integtest.ts +0 -22
- package/tests/cli-integ-tests/cdk-bootstrap-deploy-old-style-synthesis-to-new-style-bootstrap.integtest.ts +0 -21
- package/tests/cli-integ-tests/cdk-bootstrap-switch-on-termination-protection.integtest.ts +0 -24
- package/tests/cli-integ-tests/cdk-bootstrap-upgrade-legacy-bootstrap-stack-to-new-bootstrap-stack-while-in-use.integtest.ts +0 -47
- package/tests/cli-integ-tests/cdk-can-still-load-old-assemblies.integtest.ts +0 -57
- 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
- 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
- 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
- package/tests/cli-integ-tests/cdk-cdk-diff---security-only---fail-exits-when-security-changes-are-present.integtest.ts +0 -14
- package/tests/cli-integ-tests/cdk-cdk-diff---security-only---fail-exits-when-security-diff-for-sso-access-control-config.integtest.ts +0 -13
- package/tests/cli-integ-tests/cdk-cdk-diff---security-only---fail-exits-when-security-diff-for-sso-assignment.integtest.ts +0 -13
- 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
- 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
- package/tests/cli-integ-tests/cdk-cdk-diff---security-only-successfully-outputs-sso-access-control-information.integtest.ts +0 -35
- package/tests/cli-integ-tests/cdk-cdk-diff---security-only-successfully-outputs-sso-assignment-information.integtest.ts +0 -37
- package/tests/cli-integ-tests/cdk-cdk-diff---security-only-successfully-outputs-sso-permission-set-with-managed-policy-information.integtest.ts +0 -35
- package/tests/cli-integ-tests/cdk-cdk-diff---security-only-successfully-outputs-sso-permission-set-without-managed-policy-information.integtest.ts +0 -37
- package/tests/cli-integ-tests/cdk-cdk-diff-doesnt-show-resource-metadata-changes.integtest.ts +0 -23
- package/tests/cli-integ-tests/cdk-cdk-diff-shows-resource-metadata-changes-with---no-change-set.integtest.ts +0 -23
- 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
- package/tests/cli-integ-tests/cdk-cdk-diff-with-large-changeset-does-not-fail.integtest.ts +0 -28
- package/tests/cli-integ-tests/cdk-cdk-diff.integtest.ts +0 -18
- package/tests/cli-integ-tests/cdk-cdk-ls---show-dependencies---json---long.integtest.ts +0 -50
- package/tests/cli-integ-tests/cdk-cdk-ls---show-dependencies---json.integtest.ts +0 -95
- package/tests/cli-integ-tests/cdk-cdk-ls.integtest.ts +0 -36
- package/tests/cli-integ-tests/cdk-cdk-notices-are-displayed-correctly.integtest.ts +0 -42
- package/tests/cli-integ-tests/cdk-cdk-notices-with---unacknowledged.integtest.ts +0 -14
- package/tests/cli-integ-tests/cdk-cdk-synth-add-the-metadata-properties-expected-by-sam.integtest.ts +0 -126
- package/tests/cli-integ-tests/cdk-cdk-synth-bundled-functions-as-expected.integtest.ts +0 -80
- package/tests/cli-integ-tests/cdk-cdk-synth.integtest.ts +0 -53
- package/tests/cli-integ-tests/cdk-ci-output-to-stderr.integtest.ts +0 -19
- package/tests/cli-integ-tests/cdk-ci-true-output-to-stdout.integtest.ts +0 -28
- package/tests/cli-integ-tests/cdk-construct-with-builtin-lambda-function.integtest.ts +0 -14
- package/tests/cli-integ-tests/cdk-context-in-stage-propagates-to-top.integtest.ts +0 -20
- package/tests/cli-integ-tests/cdk-context-setting.integtest.ts +0 -33
- package/tests/cli-integ-tests/cdk-deploy---method-direct.integtest.ts +0 -23
- package/tests/cli-integ-tests/cdk-deploy-all-concurrently.integtest.ts +0 -17
- package/tests/cli-integ-tests/cdk-deploy-all.integtest.ts +0 -14
- package/tests/cli-integ-tests/cdk-deploy-and-test-stack-with-lambda-asset.integtest.ts +0 -31
- package/tests/cli-integ-tests/cdk-deploy-deletes-all-notification-arns-when-empty-array-is-passed.integtest.ts +0 -50
- package/tests/cli-integ-tests/cdk-deploy-no-stacks-error.integtest.ts +0 -18
- package/tests/cli-integ-tests/cdk-deploy-no-stacks-with---ignore-no-stacks.integtest.ts +0 -17
- package/tests/cli-integ-tests/cdk-deploy-preserves-existing-notification-arns-when-not-specified.integtest.ts +0 -51
- package/tests/cli-integ-tests/cdk-deploy-stack-with-docker-asset.integtest.ts +0 -11
- package/tests/cli-integ-tests/cdk-deploy-stack-with-lambda-asset-to-object-lock-enabled-asset-bucket.integtest.ts +0 -42
- package/tests/cli-integ-tests/cdk-deploy-stack-without-resource.integtest.ts +0 -32
- package/tests/cli-integ-tests/cdk-deploy-wildcard-with-outputs.integtest.ts +0 -28
- package/tests/cli-integ-tests/cdk-deploy-with-import-existing-resources-true.integtest.ts +0 -29
- package/tests/cli-integ-tests/cdk-deploy-with-method-direct-and-import-existing-resources-fails.integtest.ts +0 -17
- package/tests/cli-integ-tests/cdk-deploy-with-notification-arn-as-flag.integtest.ts +0 -36
- package/tests/cli-integ-tests/cdk-deploy-with-notification-arn-as-prop-and-flag.integtest.ts +0 -45
- package/tests/cli-integ-tests/cdk-deploy-with-notification-arn-as-prop.integtest.ts +0 -37
- package/tests/cli-integ-tests/cdk-deploy-with-parameters-multi.integtest.ts +0 -33
- package/tests/cli-integ-tests/cdk-deploy-with-parameters.integtest.ts +0 -26
- package/tests/cli-integ-tests/cdk-deploy-with-role.integtest.ts +0 -119
- package/tests/cli-integ-tests/cdk-deploy-with-wildcard-and-parameters.integtest.ts +0 -22
- package/tests/cli-integ-tests/cdk-deploy-without-execute-a-named-change-set.integtest.ts +0 -36
- package/tests/cli-integ-tests/cdk-deploy-without-import-existing-resources.integtest.ts +0 -28
- package/tests/cli-integ-tests/cdk-deploy.integtest.ts +0 -20
- package/tests/cli-integ-tests/cdk-destroy-interactive.integtest.ts +0 -36
- package/tests/cli-integ-tests/cdk-doubly-nested-stack.integtest.ts +0 -12
- package/tests/cli-integ-tests/cdk-enablediffnofail.integtest.ts +0 -44
- package/tests/cli-integ-tests/cdk-failed-deploy-does-not-hang.integtest.ts +0 -12
- package/tests/cli-integ-tests/cdk-fast-deploy.integtest.ts +0 -41
- package/tests/cli-integ-tests/cdk-gc-garbage-collection-deletes-unused-ecr-images.integtest.ts +0 -48
- package/tests/cli-integ-tests/cdk-gc-garbage-collection-deletes-unused-s3-objects.integtest.ts +0 -51
- package/tests/cli-integ-tests/cdk-gc-garbage-collection-keeps-in-use-ecr-images.integtest.ts +0 -48
- package/tests/cli-integ-tests/cdk-gc-garbage-collection-keeps-in-use-s3-objects.integtest.ts +0 -52
- package/tests/cli-integ-tests/cdk-gc-garbage-collection-tags-unused-ecr-images.integtest.ts +0 -47
- package/tests/cli-integ-tests/cdk-gc-garbage-collection-tags-unused-s3-objects.integtest.ts +0 -63
- package/tests/cli-integ-tests/cdk-gc-garbage-collection-untags-in-use-ecr-images.integtest.ts +0 -55
- package/tests/cli-integ-tests/cdk-gc-garbage-collection-untags-in-use-s3-objects.integtest.ts +0 -63
- package/tests/cli-integ-tests/cdk-generating-and-loading-assembly.integtest.ts +0 -52
- package/tests/cli-integ-tests/cdk-hotswap-deployment-for-ecs-service-detects-failed-deployment-and-errors.integtest.ts +0 -29
- package/tests/cli-integ-tests/cdk-hotswap-deployment-for-ecs-service-waits-for-deployment-to-complete.integtest.ts +0 -45
- package/tests/cli-integ-tests/cdk-hotswap-deployment-supports-appsync-apis-with-many-functions.integtest.ts +0 -36
- package/tests/cli-integ-tests/cdk-hotswap-deployment-supports-ecs-service.integtest.ts +0 -41
- package/tests/cli-integ-tests/cdk-hotswap-deployment-supports-fn::importvalue-intrinsic.integtest.ts +0 -53
- package/tests/cli-integ-tests/cdk-hotswap-deployment-supports-lambda-functions-description-and-environment-variables.integtest.ts +0 -43
- package/tests/cli-integ-tests/cdk-hotswap-ecs-deployment-respects-properties-override.integtest.ts +0 -59
- package/tests/cli-integ-tests/cdk-iam-diff.integtest.ts +0 -23
- package/tests/cli-integ-tests/cdk-import-interactive.integtest.ts +0 -57
- package/tests/cli-integ-tests/cdk-lib-cli-lib-deploy.integtest.ts +0 -32
- package/tests/cli-integ-tests/cdk-lib-cli-lib-list.integtest.ts +0 -12
- package/tests/cli-integ-tests/cdk-lib-cli-lib-synth.integtest.ts +0 -27
- 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
- package/tests/cli-integ-tests/cdk-migrate/cdk-migrate--from-stack-creates-deployable-app-csharp.integtest.ts +0 -13
- package/tests/cli-integ-tests/cdk-migrate/cdk-migrate--from-stack-creates-deployable-app-java.integtest.ts +0 -14
- package/tests/cli-integ-tests/cdk-migrate/cdk-migrate--from-stack-creates-deployable-app-python.integtest.ts +0 -13
- package/tests/cli-integ-tests/cdk-migrate/cdk-migrate--from-stack-creates-deployable-app-typescript.integtest.ts +0 -13
- package/tests/cli-integ-tests/cdk-migrate/cdk-migrate-deploys-successfully-csharp.integtest.ts +0 -15
- package/tests/cli-integ-tests/cdk-migrate/cdk-migrate-deploys-successfully-java.integtest.ts +0 -15
- package/tests/cli-integ-tests/cdk-migrate/cdk-migrate-deploys-successfully-python.integtest.ts +0 -15
- package/tests/cli-integ-tests/cdk-migrate/cdk-migrate-deploys-successfully-typescript.integtest.ts +0 -15
- package/tests/cli-integ-tests/cdk-migrate/cdk-migrate-generates-migrate.json.integtest.ts +0 -20
- package/tests/cli-integ-tests/cdk-migrate/testcase.ts +0 -69
- package/tests/cli-integ-tests/cdk-nested-stack-with-parameters.integtest.ts +0 -28
- package/tests/cli-integ-tests/cdk-requests-go-through-a-proxy-when-configured.integtest.ts +0 -39
- package/tests/cli-integ-tests/cdk-sam-can-locally-test-the-synthesized-cdk-application.integtest.ts +0 -25
- package/tests/cli-integ-tests/cdk-security-related-changes-without-a-cli-are-expected-to-fail.integtest.ts +0 -30
- package/tests/cli-integ-tests/cdk-skips-notice-refresh.integtest.ts +0 -26
- package/tests/cli-integ-tests/cdk-ssm-parameter-provider-error.integtest.ts +0 -18
- package/tests/cli-integ-tests/cdk-stack-in-update_rollback_complete-state-can-be-updated.integtest.ts +0 -59
- package/tests/cli-integ-tests/cdk-stage-with-bundled-lambda-function.integtest.ts +0 -13
- package/tests/cli-integ-tests/cdk-synth---quiet-can-be-specified-in-cdk.json.integtest.ts +0 -20
- package/tests/cli-integ-tests/cdk-synthing-a-stage-with-errors-can-be-suppressed.integtest.ts +0 -15
- package/tests/cli-integ-tests/cdk-synthing-a-stage-with-errors-leads-to-failure.integtest.ts +0 -18
- package/tests/cli-integ-tests/cdk-templates-on-disk-contain-metadata-resource.integtest.ts +0 -25
- package/tests/cli-integ-tests/cdk-termination-protection.integtest.ts +0 -19
- package/tests/cli-integ-tests/cdk-test-cdk-rollback---force.integtest.ts +0 -48
- package/tests/cli-integ-tests/cdk-test-cdk-rollback.integtest.ts +0 -38
- package/tests/cli-integ-tests/cdk-test-migrate-deployment-for-app-with-localfile-source-in-migrate.json.integtest.ts +0 -56
- package/tests/cli-integ-tests/cdk-test-resource-import-with-construct-that-requires-bundling.integtest.ts +0 -74
- package/tests/cli-integ-tests/cdk-test-resource-import.integtest.ts +0 -64
- package/tests/cli-integ-tests/cdk-two-ways-of-showing-the-version.integtest.ts +0 -14
- 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
- package/tests/cli-integ-tests/cdk-vpc-lookup.integtest.ts +0 -26
- package/tests/cli-integ-tests/proxy.integtest.ts +0 -168
- package/tests/init-csharp/init-csharp.integtest.ts +0 -15
- package/tests/init-fsharp/init-fsharp.integtest.ts +0 -15
- package/tests/init-go/init-go.integtest.ts +0 -28
- package/tests/init-java/init-java.integtest.ts +0 -14
- package/tests/init-javascript/init-javascript.integtest.ts +0 -58
- package/tests/init-python/init-python.integtest.ts +0 -20
- package/tests/init-typescript-app/init-typescript-app.integtest.ts +0 -67
- package/tests/init-typescript-lib/init-typescript-lib.integtest.ts +0 -13
- package/tests/tool-integrations/amplify.integtest.ts +0 -117
- package/tests/tool-integrations/with-tool-context.ts +0 -14
- package/tests/uberpackage/uberpackage.integtest.ts +0 -11
package/lib/shell.ts
DELETED
|
@@ -1,331 +0,0 @@
|
|
|
1
|
-
import * as child_process from 'child_process';
|
|
2
|
-
import * as fs from 'fs';
|
|
3
|
-
import * as os from 'os';
|
|
4
|
-
import * as path from 'path';
|
|
5
|
-
import { TestContext } from './integ-test';
|
|
6
|
-
import { Process } from './process';
|
|
7
|
-
import { TemporaryDirectoryContext } from './with-temporary-directory';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* A shell command that does what you want
|
|
11
|
-
*
|
|
12
|
-
* Is platform-aware, handles errors nicely.
|
|
13
|
-
*/
|
|
14
|
-
export async function shell(command: string[], options: ShellOptions = {}): Promise<string> {
|
|
15
|
-
if (options.modEnv && options.env) {
|
|
16
|
-
throw new Error('Use either env or modEnv but not both');
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const outputs = new Set(options.outputs);
|
|
20
|
-
const writeToOutputs = (x: string) => {
|
|
21
|
-
for (const outputStream of outputs) {
|
|
22
|
-
outputStream.write(x);
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
// Always output the command
|
|
27
|
-
writeToOutputs(`💻 ${command.join(' ')}\n`);
|
|
28
|
-
const show = options.show ?? 'always';
|
|
29
|
-
|
|
30
|
-
const env = options.env ?? (options.modEnv ? { ...process.env, ...options.modEnv } : process.env);
|
|
31
|
-
const tty = options.interact && options.interact.length > 0;
|
|
32
|
-
|
|
33
|
-
// Coerce to `any` because `ShellOptions` contains custom properties
|
|
34
|
-
// that don't exist in the underlying interfaces. We could either rebuild each options map,
|
|
35
|
-
// or just pass through and let the underlying implemenation ignore what it doesn't know about.
|
|
36
|
-
// We choose the lazy one.
|
|
37
|
-
const spawnOptions = { ...options, env } as any;
|
|
38
|
-
|
|
39
|
-
const child = tty
|
|
40
|
-
? Process.spawnTTY(command[0], command.slice(1), spawnOptions)
|
|
41
|
-
: Process.spawn(command[0], command.slice(1), spawnOptions)
|
|
42
|
-
|
|
43
|
-
// copy because we will be shifting it
|
|
44
|
-
const remainingInteractions = [...(options.interact ?? [])];
|
|
45
|
-
|
|
46
|
-
return new Promise<string>((resolve, reject) => {
|
|
47
|
-
const stdout = new Array<Buffer>();
|
|
48
|
-
const stderr = new Array<Buffer>();
|
|
49
|
-
|
|
50
|
-
const lastLine = new LastLine();
|
|
51
|
-
|
|
52
|
-
child.onStdout(chunk => {
|
|
53
|
-
if (show === 'always') {
|
|
54
|
-
writeToOutputs(chunk.toString('utf-8'));
|
|
55
|
-
}
|
|
56
|
-
stdout.push(chunk);
|
|
57
|
-
lastLine.append(chunk.toString('utf-8'));
|
|
58
|
-
|
|
59
|
-
const interaction = remainingInteractions[0];
|
|
60
|
-
if (interaction) {
|
|
61
|
-
|
|
62
|
-
if (interaction.prompt.test(lastLine.get())) {
|
|
63
|
-
|
|
64
|
-
// subprocess expects a user input now.
|
|
65
|
-
// first, shift the interactions to ensure the same interaction is not reused
|
|
66
|
-
remainingInteractions.shift();
|
|
67
|
-
|
|
68
|
-
// then, reset the last line to prevent repeated matches caused by tty echoing
|
|
69
|
-
lastLine.reset();
|
|
70
|
-
|
|
71
|
-
// now write the input with a slight delay to ensure
|
|
72
|
-
// the child process has already started reading.
|
|
73
|
-
setTimeout(() => {
|
|
74
|
-
child.writeStdin(interaction.input + (interaction.end ?? os.EOL));
|
|
75
|
-
}, 500);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
if (tty && options.captureStderr === false) {
|
|
83
|
-
// in a tty stderr goes to the same fd as stdout
|
|
84
|
-
throw new Error(`Cannot disable 'captureStderr' in tty`);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
if (!tty) {
|
|
88
|
-
// in a tty stderr goes to the same fd as stdout, so onStdout
|
|
89
|
-
// is sufficient.
|
|
90
|
-
child.onStderr(chunk => {
|
|
91
|
-
if (show === 'always') {
|
|
92
|
-
writeToOutputs(chunk.toString('utf-8'));
|
|
93
|
-
}
|
|
94
|
-
if (options.captureStderr ?? true) {
|
|
95
|
-
stderr.push(chunk);
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
child.onError(reject);
|
|
101
|
-
|
|
102
|
-
child.onExit(code => {
|
|
103
|
-
const stderrOutput = Buffer.concat(stderr).toString('utf-8');
|
|
104
|
-
const stdoutOutput = Buffer.concat(stdout).toString('utf-8');
|
|
105
|
-
const out = (options.onlyStderr ? stderrOutput : stdoutOutput + stderrOutput).trim();
|
|
106
|
-
|
|
107
|
-
const logAndreject = (error: Error) => {
|
|
108
|
-
if (show === 'error') {
|
|
109
|
-
writeToOutputs(`${out}\n`);
|
|
110
|
-
}
|
|
111
|
-
reject(error);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
if (remainingInteractions.length !== 0) {
|
|
115
|
-
// regardless of the exit code, if we didn't consume all expected interactions we probably
|
|
116
|
-
// did somethiing wrong.
|
|
117
|
-
logAndreject(new Error(`Expected more user interactions but subprocess exited with ${code}`));
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
if (code === 0 || options.allowErrExit) {
|
|
122
|
-
resolve(out);
|
|
123
|
-
} else {
|
|
124
|
-
logAndreject(new Error(`'${command.join(' ')}' exited with error code ${code}.`));
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* Models a single user interaction with the shell.
|
|
132
|
-
*/
|
|
133
|
-
export interface UserInteraction {
|
|
134
|
-
/**
|
|
135
|
-
* The prompt to expect. Regex matched against the last line in
|
|
136
|
-
* the output before the prompt is displayed.
|
|
137
|
-
*
|
|
138
|
-
* Most commonly this would be a simple string to match for inclusion.
|
|
139
|
-
*
|
|
140
|
-
* Examples:
|
|
141
|
-
*
|
|
142
|
-
* - Process Output: "Hey there! Are you sure?"
|
|
143
|
-
* Prompt: /Are you sure?/
|
|
144
|
-
* Match (Yes/No): Yes
|
|
145
|
-
* Reason: "Hey there! Are you sure?" ~ /Are you sure?/
|
|
146
|
-
*
|
|
147
|
-
* - Process Output: "Hey there!\nAre you sure?"
|
|
148
|
-
* Prompt: /Are you sure?/
|
|
149
|
-
* Match (Yes/No): Yes
|
|
150
|
-
* Reason: "Are you sure?" ~ /Are you sure?/
|
|
151
|
-
*
|
|
152
|
-
* - Process Output: "Are you sure?\n(remember this is destructive)"
|
|
153
|
-
* Prompt: /Are you sure?/
|
|
154
|
-
* Match (Yes/No): No
|
|
155
|
-
* Reason: "(remember this is destructive)" ≄ /Are you sure?/
|
|
156
|
-
*
|
|
157
|
-
* - Process Output: "Are you sure?\n(remember this is destructive)"
|
|
158
|
-
* Prompt: /remember this is destructive/
|
|
159
|
-
* Match (Yes/No): Yes
|
|
160
|
-
* Reason: "(remember this is destructive)" ~ /remember this is destructive/
|
|
161
|
-
*
|
|
162
|
-
*/
|
|
163
|
-
readonly prompt: RegExp;
|
|
164
|
-
/**
|
|
165
|
-
* The input to provide.
|
|
166
|
-
*/
|
|
167
|
-
readonly input: string;
|
|
168
|
-
|
|
169
|
-
/**
|
|
170
|
-
* The string to signal the end of input.
|
|
171
|
-
*
|
|
172
|
-
* @default os.EOL
|
|
173
|
-
*/
|
|
174
|
-
readonly end?: string;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
export interface ShellOptions extends child_process.SpawnOptions {
|
|
178
|
-
/**
|
|
179
|
-
* Properties to add to 'env'
|
|
180
|
-
*/
|
|
181
|
-
readonly modEnv?: Record<string, string | undefined>;
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* Don't fail when exiting with an error
|
|
185
|
-
*
|
|
186
|
-
* @default false
|
|
187
|
-
*/
|
|
188
|
-
readonly allowErrExit?: boolean;
|
|
189
|
-
|
|
190
|
-
/**
|
|
191
|
-
* Whether to capture stderr
|
|
192
|
-
*
|
|
193
|
-
* @default true
|
|
194
|
-
*/
|
|
195
|
-
readonly captureStderr?: boolean;
|
|
196
|
-
|
|
197
|
-
/**
|
|
198
|
-
* Pass output here
|
|
199
|
-
*/
|
|
200
|
-
readonly outputs?: NodeJS.WritableStream[];
|
|
201
|
-
|
|
202
|
-
/**
|
|
203
|
-
* Only return stderr. For example, this is used to validate
|
|
204
|
-
* that when CI=true, all logs are sent to stdout.
|
|
205
|
-
*
|
|
206
|
-
* @default false
|
|
207
|
-
*/
|
|
208
|
-
readonly onlyStderr?: boolean;
|
|
209
|
-
|
|
210
|
-
/**
|
|
211
|
-
* Don't log to stdout
|
|
212
|
-
*
|
|
213
|
-
* @default always
|
|
214
|
-
*/
|
|
215
|
-
readonly show?: 'always' | 'never' | 'error';
|
|
216
|
-
|
|
217
|
-
/**
|
|
218
|
-
* Provide user interaction to respond to shell prompts.
|
|
219
|
-
*
|
|
220
|
-
* Order and count should correspond to the expected prompts issued by the subprocess.
|
|
221
|
-
*/
|
|
222
|
-
readonly interact?: UserInteraction[];
|
|
223
|
-
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
export class ShellHelper {
|
|
227
|
-
public static fromContext(context: TestContext & TemporaryDirectoryContext) {
|
|
228
|
-
return new ShellHelper(context.integTestDir, context.output);
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
constructor(
|
|
232
|
-
private readonly _cwd: string,
|
|
233
|
-
private readonly _output: NodeJS.WritableStream) { }
|
|
234
|
-
|
|
235
|
-
public async shell(command: string[], options: Omit<ShellOptions, 'cwd' | 'outputs'> = {}): Promise<string> {
|
|
236
|
-
return shell(command, {
|
|
237
|
-
outputs: [this._output],
|
|
238
|
-
cwd: this._cwd,
|
|
239
|
-
...options,
|
|
240
|
-
modEnv: {
|
|
241
|
-
// give every shell its own docker config directory
|
|
242
|
-
// so that parallel runs don't interfere with each other.
|
|
243
|
-
DOCKER_CONFIG: path.join(this._cwd, '.docker'),
|
|
244
|
-
...options.modEnv,
|
|
245
|
-
},
|
|
246
|
-
});
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
/**
|
|
251
|
-
* rm -rf reimplementation, don't want to depend on an NPM package for this
|
|
252
|
-
*
|
|
253
|
-
* Returns `true` if everything got deleted, or `false` if some files could
|
|
254
|
-
* not be deleted due to permissions issues.
|
|
255
|
-
*/
|
|
256
|
-
export function rimraf(fsPath: string): boolean {
|
|
257
|
-
try {
|
|
258
|
-
let success = true;
|
|
259
|
-
const isDir = fs.lstatSync(fsPath).isDirectory();
|
|
260
|
-
|
|
261
|
-
if (isDir) {
|
|
262
|
-
for (const file of fs.readdirSync(fsPath)) {
|
|
263
|
-
success &&= rimraf(path.join(fsPath, file));
|
|
264
|
-
}
|
|
265
|
-
fs.rmdirSync(fsPath);
|
|
266
|
-
} else {
|
|
267
|
-
fs.unlinkSync(fsPath);
|
|
268
|
-
}
|
|
269
|
-
return success;
|
|
270
|
-
} catch (e: any) {
|
|
271
|
-
// Can happen if some files got generated inside a Docker container and are now inadvertently owned by `root`.
|
|
272
|
-
// We can't ever clean those up anymore, but since it only happens inside GitHub Actions containers we also don't care too much.
|
|
273
|
-
if (e.code === 'EACCES' || e.code === 'ENOTEMPTY') { return false; }
|
|
274
|
-
|
|
275
|
-
// Already gone
|
|
276
|
-
if (e.code === 'ENOENT') { return true; }
|
|
277
|
-
|
|
278
|
-
throw e;
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
export function addToShellPath(x: string) {
|
|
283
|
-
const parts = process.env.PATH?.split(':') ?? [];
|
|
284
|
-
|
|
285
|
-
if (!parts.includes(x)) {
|
|
286
|
-
parts.unshift(x);
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
process.env.PATH = parts.join(':');
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
/**
|
|
293
|
-
* Accumulate text since the last line break (or beginning of string) it has seen in the chunks.
|
|
294
|
-
*
|
|
295
|
-
* Examples:
|
|
296
|
-
*
|
|
297
|
-
* - Chunks: ['one\n', 'two\n', three']
|
|
298
|
-
* - Last Line: 'three'
|
|
299
|
-
*
|
|
300
|
-
* - Chunks: ['one', 'two', '\nthree']
|
|
301
|
-
* - Last Line: 'three'
|
|
302
|
-
*
|
|
303
|
-
* - Chunks: ['one', 'two']
|
|
304
|
-
* - Last Line: 'onetwo'
|
|
305
|
-
*
|
|
306
|
-
* - Chunks: ['one', 'two', '\nthree', 'four']
|
|
307
|
-
* - Last Line: 'threefour'
|
|
308
|
-
*/
|
|
309
|
-
class LastLine {
|
|
310
|
-
|
|
311
|
-
private lastLine: string = '';
|
|
312
|
-
|
|
313
|
-
public append(chunk: string): void {
|
|
314
|
-
const lines = chunk.split(os.EOL);
|
|
315
|
-
if (lines.length === 1) {
|
|
316
|
-
// chunk doesn't contain a new line so just append
|
|
317
|
-
this.lastLine += lines[0];
|
|
318
|
-
} else {
|
|
319
|
-
// chunk contains multiple lines so just override with the last one
|
|
320
|
-
this.lastLine = lines[lines.length - 1];
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
public get(): string {
|
|
325
|
-
return this.lastLine;
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
public reset() {
|
|
329
|
-
this.lastLine = '';
|
|
330
|
-
}
|
|
331
|
-
}
|
|
@@ -1,387 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
AssociateExternalConnectionCommand,
|
|
3
|
-
CodeartifactClient,
|
|
4
|
-
CreateDomainCommand,
|
|
5
|
-
CreateRepositoryCommand,
|
|
6
|
-
DeleteRepositoryCommand,
|
|
7
|
-
DescribeDomainCommand,
|
|
8
|
-
DescribeRepositoryCommand,
|
|
9
|
-
GetAuthorizationTokenCommand,
|
|
10
|
-
GetRepositoryEndpointCommand,
|
|
11
|
-
ListPackagesCommand,
|
|
12
|
-
ListPackagesRequest,
|
|
13
|
-
ListRepositoriesCommand,
|
|
14
|
-
ListTagsForResourceCommand,
|
|
15
|
-
PutPackageOriginConfigurationCommand,
|
|
16
|
-
} from '@aws-sdk/client-codeartifact';
|
|
17
|
-
import { sleep } from '../aws';
|
|
18
|
-
|
|
19
|
-
const COLLECT_BY_TAG = 'collect-by';
|
|
20
|
-
const REPO_LIFETIME_MS = 24 * 3600 * 1000; // One day
|
|
21
|
-
|
|
22
|
-
export class TestRepository {
|
|
23
|
-
public static readonly DEFAULT_DOMAIN = 'test-cdk';
|
|
24
|
-
|
|
25
|
-
public static async newRandom() {
|
|
26
|
-
const qualifier = Math.random()
|
|
27
|
-
.toString(36)
|
|
28
|
-
.replace(/[^a-z0-9]+/g, '');
|
|
29
|
-
|
|
30
|
-
const repo = new TestRepository(`test-${qualifier}`);
|
|
31
|
-
await repo.prepare();
|
|
32
|
-
return repo;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
public static async newWithName(name: string) {
|
|
36
|
-
const repo = new TestRepository(name);
|
|
37
|
-
await repo.prepare();
|
|
38
|
-
return repo;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
public static existing(repositoryName: string) {
|
|
42
|
-
return new TestRepository(repositoryName);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Garbage collect repositories
|
|
47
|
-
*/
|
|
48
|
-
public static async gc() {
|
|
49
|
-
if (!(await TestRepository.existing('*dummy*').domainExists())) {
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
const codeArtifact = new CodeartifactClient();
|
|
54
|
-
|
|
55
|
-
let nextToken: string | undefined;
|
|
56
|
-
do {
|
|
57
|
-
const page = await codeArtifact.send(
|
|
58
|
-
new ListRepositoriesCommand({
|
|
59
|
-
nextToken: nextToken,
|
|
60
|
-
}),
|
|
61
|
-
);
|
|
62
|
-
|
|
63
|
-
for (const repo of page.repositories ?? []) {
|
|
64
|
-
const tags = await codeArtifact.send(
|
|
65
|
-
new ListTagsForResourceCommand({
|
|
66
|
-
resourceArn: repo.arn!,
|
|
67
|
-
}),
|
|
68
|
-
);
|
|
69
|
-
const collectable = tags?.tags?.find((t) => t.key === COLLECT_BY_TAG && Number(t.value) < Date.now());
|
|
70
|
-
if (collectable) {
|
|
71
|
-
// eslint-disable-next-line no-console
|
|
72
|
-
console.log('Deleting', repo.name);
|
|
73
|
-
await codeArtifact.send(
|
|
74
|
-
new DeleteRepositoryCommand({
|
|
75
|
-
domain: repo.domainName!,
|
|
76
|
-
repository: repo.name!,
|
|
77
|
-
}),
|
|
78
|
-
);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
nextToken = page.nextToken;
|
|
83
|
-
} while (nextToken);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
public readonly npmUpstream = 'npm-upstream';
|
|
87
|
-
public readonly pypiUpstream = 'pypi-upstream';
|
|
88
|
-
public readonly nugetUpstream = 'nuget-upstream';
|
|
89
|
-
public readonly mavenUpstream = 'maven-upstream';
|
|
90
|
-
public readonly domain = TestRepository.DEFAULT_DOMAIN;
|
|
91
|
-
|
|
92
|
-
private readonly codeArtifact = new CodeartifactClient();
|
|
93
|
-
|
|
94
|
-
private _loginInformation: LoginInformation | undefined;
|
|
95
|
-
|
|
96
|
-
private constructor(public readonly repositoryName: string) {}
|
|
97
|
-
|
|
98
|
-
public async prepare() {
|
|
99
|
-
await this.ensureDomain();
|
|
100
|
-
await this.ensureUpstreams();
|
|
101
|
-
|
|
102
|
-
await this.ensureRepository(this.repositoryName, {
|
|
103
|
-
description: 'Testing repository',
|
|
104
|
-
upstreams: [this.npmUpstream, this.pypiUpstream, this.nugetUpstream, this.mavenUpstream],
|
|
105
|
-
tags: {
|
|
106
|
-
[COLLECT_BY_TAG]: `${Date.now() + REPO_LIFETIME_MS}`,
|
|
107
|
-
},
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
public async loginInformation(): Promise<LoginInformation> {
|
|
112
|
-
if (this._loginInformation) {
|
|
113
|
-
return this._loginInformation;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
this._loginInformation = {
|
|
117
|
-
authToken: (
|
|
118
|
-
await this.codeArtifact.send(
|
|
119
|
-
new GetAuthorizationTokenCommand({
|
|
120
|
-
domain: this.domain,
|
|
121
|
-
durationSeconds: 12 * 3600,
|
|
122
|
-
}),
|
|
123
|
-
)
|
|
124
|
-
).authorizationToken!,
|
|
125
|
-
repositoryName: this.repositoryName,
|
|
126
|
-
|
|
127
|
-
npmEndpoint: (
|
|
128
|
-
await this.codeArtifact.send(
|
|
129
|
-
new GetRepositoryEndpointCommand({
|
|
130
|
-
domain: this.domain,
|
|
131
|
-
repository: this.repositoryName,
|
|
132
|
-
format: 'npm',
|
|
133
|
-
}),
|
|
134
|
-
)
|
|
135
|
-
).repositoryEndpoint!,
|
|
136
|
-
|
|
137
|
-
mavenEndpoint: (
|
|
138
|
-
await this.codeArtifact.send(
|
|
139
|
-
new GetRepositoryEndpointCommand({
|
|
140
|
-
domain: this.domain,
|
|
141
|
-
repository: this.repositoryName,
|
|
142
|
-
format: 'maven',
|
|
143
|
-
}),
|
|
144
|
-
)
|
|
145
|
-
).repositoryEndpoint!,
|
|
146
|
-
|
|
147
|
-
nugetEndpoint: (
|
|
148
|
-
await this.codeArtifact.send(
|
|
149
|
-
new GetRepositoryEndpointCommand({
|
|
150
|
-
domain: this.domain,
|
|
151
|
-
repository: this.repositoryName,
|
|
152
|
-
format: 'nuget',
|
|
153
|
-
}),
|
|
154
|
-
)
|
|
155
|
-
).repositoryEndpoint!,
|
|
156
|
-
|
|
157
|
-
pypiEndpoint: (
|
|
158
|
-
await this.codeArtifact.send(
|
|
159
|
-
new GetRepositoryEndpointCommand({
|
|
160
|
-
domain: this.domain,
|
|
161
|
-
repository: this.repositoryName,
|
|
162
|
-
format: 'pypi',
|
|
163
|
-
}),
|
|
164
|
-
)
|
|
165
|
-
).repositoryEndpoint!,
|
|
166
|
-
};
|
|
167
|
-
return this._loginInformation;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
public async delete() {
|
|
171
|
-
try {
|
|
172
|
-
await this.codeArtifact.send(
|
|
173
|
-
new DeleteRepositoryCommand({
|
|
174
|
-
domain: this.domain,
|
|
175
|
-
repository: this.repositoryName,
|
|
176
|
-
}),
|
|
177
|
-
);
|
|
178
|
-
|
|
179
|
-
// eslint-disable-next-line no-console
|
|
180
|
-
console.log('Deleted', this.repositoryName);
|
|
181
|
-
} catch (e: any) {
|
|
182
|
-
if (e.name !== 'ResourceNotFoundException') {
|
|
183
|
-
throw e;
|
|
184
|
-
}
|
|
185
|
-
// Okay
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
/**
|
|
190
|
-
* List all packages and mark them as "allow upstream versions".
|
|
191
|
-
*
|
|
192
|
-
* If we don't do this and we publish `foo@2.3.4-rc.0`, then we can't
|
|
193
|
-
* download `foo@2.3.0` anymore because by default CodeArtifact will
|
|
194
|
-
* block different versions from the same package.
|
|
195
|
-
*/
|
|
196
|
-
public async markAllUpstreamAllow() {
|
|
197
|
-
for await (const pkg of this.listPackages({ upstream: 'BLOCK' })) {
|
|
198
|
-
await retryThrottled(() =>
|
|
199
|
-
this.codeArtifact.send(
|
|
200
|
-
new PutPackageOriginConfigurationCommand({
|
|
201
|
-
domain: this.domain,
|
|
202
|
-
repository: this.repositoryName,
|
|
203
|
-
|
|
204
|
-
format: pkg.format!,
|
|
205
|
-
package: pkg.package!,
|
|
206
|
-
namespace: pkg.namespace!,
|
|
207
|
-
restrictions: {
|
|
208
|
-
publish: 'ALLOW',
|
|
209
|
-
upstream: 'ALLOW',
|
|
210
|
-
},
|
|
211
|
-
}),
|
|
212
|
-
),
|
|
213
|
-
);
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
private async ensureDomain() {
|
|
218
|
-
if (await this.domainExists()) {
|
|
219
|
-
return;
|
|
220
|
-
}
|
|
221
|
-
await this.codeArtifact.send(
|
|
222
|
-
new CreateDomainCommand({
|
|
223
|
-
domain: this.domain,
|
|
224
|
-
tags: [{ key: 'testing', value: 'true' }],
|
|
225
|
-
}),
|
|
226
|
-
);
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
private async ensureUpstreams() {
|
|
230
|
-
await this.ensureRepository(this.npmUpstream, {
|
|
231
|
-
description: 'The upstream repository for NPM',
|
|
232
|
-
external: 'public:npmjs',
|
|
233
|
-
});
|
|
234
|
-
await this.ensureRepository(this.mavenUpstream, {
|
|
235
|
-
description: 'The upstream repository for Maven',
|
|
236
|
-
external: 'public:maven-central',
|
|
237
|
-
});
|
|
238
|
-
await this.ensureRepository(this.nugetUpstream, {
|
|
239
|
-
description: 'The upstream repository for NuGet',
|
|
240
|
-
external: 'public:nuget-org',
|
|
241
|
-
});
|
|
242
|
-
await this.ensureRepository(this.pypiUpstream, {
|
|
243
|
-
description: 'The upstream repository for PyPI',
|
|
244
|
-
external: 'public:pypi',
|
|
245
|
-
});
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
private async ensureRepository(
|
|
249
|
-
name: string,
|
|
250
|
-
options?: {
|
|
251
|
-
readonly description?: string;
|
|
252
|
-
readonly external?: string;
|
|
253
|
-
readonly upstreams?: string[];
|
|
254
|
-
readonly tags?: Record<string, string>;
|
|
255
|
-
},
|
|
256
|
-
) {
|
|
257
|
-
if (await this.repositoryExists(name)) {
|
|
258
|
-
return;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
await this.codeArtifact.send(
|
|
262
|
-
new CreateRepositoryCommand({
|
|
263
|
-
domain: this.domain,
|
|
264
|
-
repository: name,
|
|
265
|
-
description: options?.description,
|
|
266
|
-
upstreams: options?.upstreams?.map((repositoryName) => ({ repositoryName })),
|
|
267
|
-
tags: options?.tags ? Object.entries(options.tags).map(([key, value]) => ({ key, value })) : undefined,
|
|
268
|
-
}),
|
|
269
|
-
);
|
|
270
|
-
|
|
271
|
-
if (options?.external) {
|
|
272
|
-
const externalConnection = options.external;
|
|
273
|
-
await retry(() =>
|
|
274
|
-
this.codeArtifact.send(
|
|
275
|
-
new AssociateExternalConnectionCommand({
|
|
276
|
-
domain: this.domain,
|
|
277
|
-
repository: name,
|
|
278
|
-
externalConnection,
|
|
279
|
-
}),
|
|
280
|
-
),
|
|
281
|
-
);
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
private async domainExists() {
|
|
286
|
-
try {
|
|
287
|
-
await this.codeArtifact.send(new DescribeDomainCommand({ domain: this.domain }));
|
|
288
|
-
return true;
|
|
289
|
-
} catch (e: any) {
|
|
290
|
-
if (e.name !== 'ResourceNotFoundException') {
|
|
291
|
-
throw e;
|
|
292
|
-
}
|
|
293
|
-
return false;
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
private async repositoryExists(name: string) {
|
|
298
|
-
try {
|
|
299
|
-
await this.codeArtifact.send(new DescribeRepositoryCommand({ domain: this.domain, repository: name }));
|
|
300
|
-
return true;
|
|
301
|
-
} catch (e: any) {
|
|
302
|
-
if (e.name !== 'ResourceNotFoundException') {
|
|
303
|
-
throw e;
|
|
304
|
-
}
|
|
305
|
-
return false;
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
private async *listPackages(filter: Pick<ListPackagesRequest, 'upstream' | 'publish' | 'format'> = {}) {
|
|
310
|
-
let response = await retryThrottled(() =>
|
|
311
|
-
this.codeArtifact.send(
|
|
312
|
-
new ListPackagesCommand({
|
|
313
|
-
domain: this.domain,
|
|
314
|
-
repository: this.repositoryName,
|
|
315
|
-
...filter,
|
|
316
|
-
}),
|
|
317
|
-
),
|
|
318
|
-
);
|
|
319
|
-
|
|
320
|
-
while (true) {
|
|
321
|
-
for (const p of response.packages ?? []) {
|
|
322
|
-
yield p;
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
if (!response.nextToken) {
|
|
326
|
-
break;
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
response = await retryThrottled(() =>
|
|
330
|
-
this.codeArtifact.send(
|
|
331
|
-
new ListPackagesCommand({
|
|
332
|
-
domain: this.domain,
|
|
333
|
-
repository: this.repositoryName,
|
|
334
|
-
...filter,
|
|
335
|
-
nextToken: response.nextToken,
|
|
336
|
-
}),
|
|
337
|
-
),
|
|
338
|
-
);
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
async function retry<A>(block: () => Promise<A>) {
|
|
344
|
-
let attempts = 3;
|
|
345
|
-
while (true) {
|
|
346
|
-
try {
|
|
347
|
-
return await block();
|
|
348
|
-
} catch (e: any) {
|
|
349
|
-
if (attempts-- === 0) {
|
|
350
|
-
throw e;
|
|
351
|
-
}
|
|
352
|
-
// eslint-disable-next-line no-console
|
|
353
|
-
console.debug(e.message);
|
|
354
|
-
await sleep(500);
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
async function retryThrottled<A>(block: () => Promise<A>) {
|
|
360
|
-
let time = 100;
|
|
361
|
-
let attempts = 15;
|
|
362
|
-
while (true) {
|
|
363
|
-
try {
|
|
364
|
-
return await block();
|
|
365
|
-
} catch (e: any) {
|
|
366
|
-
// eslint-disable-next-line no-console
|
|
367
|
-
console.debug(e.message);
|
|
368
|
-
if (e.name !== 'ThrottlingException') {
|
|
369
|
-
throw e;
|
|
370
|
-
}
|
|
371
|
-
if (attempts-- === 0) {
|
|
372
|
-
throw e;
|
|
373
|
-
}
|
|
374
|
-
await sleep(Math.floor(Math.random() * time));
|
|
375
|
-
time *= 2;
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
export interface LoginInformation {
|
|
381
|
-
readonly authToken: string;
|
|
382
|
-
readonly repositoryName: string;
|
|
383
|
-
readonly npmEndpoint: string;
|
|
384
|
-
readonly mavenEndpoint: string;
|
|
385
|
-
readonly nugetEndpoint: string;
|
|
386
|
-
readonly pypiEndpoint: string;
|
|
387
|
-
}
|