@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
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import * as os from 'os';
|
|
2
|
-
import * as path from 'path';
|
|
3
|
-
import * as fs from 'fs-extra';
|
|
4
|
-
import { IPackageSourceSetup, IPackageSource } from './source';
|
|
5
|
-
import { copyDirectoryContents } from '../files';
|
|
6
|
-
import { shell, rimraf, addToShellPath } from '../shell';
|
|
7
|
-
|
|
8
|
-
export class ReleasePackageSourceSetup implements IPackageSourceSetup {
|
|
9
|
-
readonly name = 'release';
|
|
10
|
-
readonly description: string;
|
|
11
|
-
|
|
12
|
-
private tempDir?: string;
|
|
13
|
-
|
|
14
|
-
constructor(private readonly version: string, private readonly frameworkVersion?: string) {
|
|
15
|
-
this.description = `release @ ${this.version}`;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
public async prepare(): Promise<void> {
|
|
19
|
-
this.tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'tmpcdk'));
|
|
20
|
-
fs.mkdirSync(this.tempDir, { recursive: true });
|
|
21
|
-
|
|
22
|
-
await shell(['node', require.resolve('npm'), 'install', `aws-cdk@${this.version}`], {
|
|
23
|
-
cwd: this.tempDir,
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
process.env.CDK_CLI_PATH = this.tempDir;
|
|
27
|
-
process.env.VERSION = this.version;
|
|
28
|
-
process.env.FRAMEWORK_VERSION = this.frameworkVersion ?? this.version;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
public async cleanup(): Promise<void> {
|
|
32
|
-
if (this.tempDir) {
|
|
33
|
-
rimraf(this.tempDir);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export class ReleasePackageSource implements IPackageSource {
|
|
39
|
-
private readonly cliPath: string;
|
|
40
|
-
private readonly version: string;
|
|
41
|
-
|
|
42
|
-
constructor() {
|
|
43
|
-
this.cliPath = process.env.CDK_CLI_PATH!;
|
|
44
|
-
this.version = process.env.VERSION!;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
public async makeCliAvailable() {
|
|
48
|
-
addToShellPath(path.join(this.cliPath, 'node_modules', '.bin'));
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
public assertJsiiPackagesAvailable() {
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
public async initializeDotnetPackages(currentDir: string) {
|
|
55
|
-
if (process.env.CWD_FILES_DIR) {
|
|
56
|
-
await copyDirectoryContents(process.env.CWD_FILES_DIR, currentDir);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
public majorVersion() {
|
|
61
|
-
return this.version.split('.')[0] as string;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
public requestedCliVersion() {
|
|
65
|
-
return this.version;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
public requestedFrameworkVersion() {
|
|
69
|
-
return process.env.FRAMEWORK_VERSION!;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
public requestedAlphaVersion(): string {
|
|
73
|
-
const frameworkVersion = this.requestedFrameworkVersion();
|
|
74
|
-
if (frameworkVersion.includes('-rc.')) {
|
|
75
|
-
// For a pipeline release
|
|
76
|
-
return frameworkVersion.replace(/-rc\.\d+$/, '-alpha.999');
|
|
77
|
-
} else {
|
|
78
|
-
// For a stable release
|
|
79
|
-
return `${frameworkVersion}-alpha.0`;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import * as os from 'os';
|
|
2
|
-
import * as path from 'path';
|
|
3
|
-
import * as fs from 'fs-extra';
|
|
4
|
-
import { IPackageSourceSetup, IPackageSource } from './source';
|
|
5
|
-
import { findUp } from '../files';
|
|
6
|
-
import { shell, addToShellPath } from '../shell';
|
|
7
|
-
|
|
8
|
-
export class RepoPackageSourceSetup implements IPackageSourceSetup {
|
|
9
|
-
readonly name = 'repo';
|
|
10
|
-
readonly description: string;
|
|
11
|
-
|
|
12
|
-
constructor(private readonly repoRoot: string) {
|
|
13
|
-
this.description = `repo(${this.repoRoot})`;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
public async prepare(): Promise<void> {
|
|
17
|
-
if (!await fs.pathExists(path.join(this.repoRoot, 'package.json')) || !await fs.pathExists(path.join(this.repoRoot, 'yarn.lock'))) {
|
|
18
|
-
throw new Error(`${this.repoRoot}: does not look like the repository root`);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
process.env.REPO_ROOT = this.repoRoot;
|
|
22
|
-
process.env.REPO_PACKAGE_MAP = await writePackageMap(this.repoRoot);
|
|
23
|
-
addToShellPath(path.resolve(__dirname, 'repo-tools'));
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
public async cleanup(): Promise<void> {
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export class RepoPackageSource implements IPackageSource {
|
|
31
|
-
private readonly repoRoot: string;
|
|
32
|
-
|
|
33
|
-
constructor() {
|
|
34
|
-
this.repoRoot = process.env.REPO_ROOT as string;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
public async makeCliAvailable() {
|
|
38
|
-
addToShellPath(path.join(this.repoRoot, 'packages', 'aws-cdk', 'bin'));
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
public assertJsiiPackagesAvailable() {
|
|
42
|
-
throw new Error('jsii client packages are not available when using REPO source');
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
public async initializeDotnetPackages() {
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
public majorVersion() {
|
|
49
|
-
const releaseJson = fs.readJsonSync(path.resolve(this.repoRoot, 'release.json'));
|
|
50
|
-
return releaseJson.majorVersion;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
public requestedCliVersion(): string {
|
|
54
|
-
return '*';
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
public requestedFrameworkVersion(): string {
|
|
58
|
-
return '*';
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
public requestedAlphaVersion(): string {
|
|
62
|
-
return '*';
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
async function writePackageMap(repoRoot: string): Promise<string> {
|
|
67
|
-
const packages = await findYarnPackages(repoRoot);
|
|
68
|
-
const fileName = path.join(os.tmpdir(), 'package-map.json');
|
|
69
|
-
await fs.writeJson(fileName, packages);
|
|
70
|
-
return fileName;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Cache monorepo discovery results, we only want to do this once per run
|
|
75
|
-
*/
|
|
76
|
-
const YARN_MONOREPO_CACHE: Record<string, any> = {};
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Return a { name -> directory } packages found in a Yarn monorepo
|
|
80
|
-
*
|
|
81
|
-
* Cached in YARN_MONOREPO_CACHE.
|
|
82
|
-
*/
|
|
83
|
-
export async function findYarnPackages(root: string): Promise<Record<string, string>> {
|
|
84
|
-
if (!(root in YARN_MONOREPO_CACHE)) {
|
|
85
|
-
const outputDataString: string = JSON.parse(await shell(['yarn', 'workspaces', '--json', 'info'], {
|
|
86
|
-
captureStderr: false,
|
|
87
|
-
cwd: root,
|
|
88
|
-
show: 'error',
|
|
89
|
-
})).data;
|
|
90
|
-
const output: YarnWorkspacesOutput = JSON.parse(outputDataString);
|
|
91
|
-
|
|
92
|
-
const ret: Record<string, string> = {};
|
|
93
|
-
for (const [k, v] of Object.entries(output)) {
|
|
94
|
-
ret[k] = path.join(root, v.location);
|
|
95
|
-
}
|
|
96
|
-
YARN_MONOREPO_CACHE[root] = ret;
|
|
97
|
-
}
|
|
98
|
-
return YARN_MONOREPO_CACHE[root];
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Find the root directory of the repo from the current directory
|
|
103
|
-
*/
|
|
104
|
-
export async function autoFindRoot() {
|
|
105
|
-
const found = findUp('release.json');
|
|
106
|
-
if (!found) {
|
|
107
|
-
throw new Error(`Could not determine repository root: 'release.json' not found from ${process.cwd()}`);
|
|
108
|
-
}
|
|
109
|
-
return path.dirname(found);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
type YarnWorkspacesOutput = Record<string, { location: string }>;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import * as child_process from 'child_process';
|
|
2
|
-
import * as fs from 'fs-extra';
|
|
3
|
-
|
|
4
|
-
let argv = process.argv.slice(2);
|
|
5
|
-
|
|
6
|
-
// eslint-disable-next-line no-console
|
|
7
|
-
console.log('fake npm');
|
|
8
|
-
|
|
9
|
-
if (argv[0] === 'install') {
|
|
10
|
-
if (!process.env.REPO_PACKAGE_MAP) {
|
|
11
|
-
throw new Error('REPO_PACKAGE_MAP not set');
|
|
12
|
-
}
|
|
13
|
-
const repoPackageMap = fs.readJsonSync(process.env.REPO_PACKAGE_MAP, { encoding: 'utf-8' });
|
|
14
|
-
|
|
15
|
-
// Replace paths in the 'package.json' in the current directory
|
|
16
|
-
if (fs.pathExistsSync('package.json')) {
|
|
17
|
-
const packageJson = fs.readJsonSync('package.json', { encoding: 'utf-8' });
|
|
18
|
-
for (const deps of [packageJson.dependencies ?? {}, packageJson.devDependencies ?? {}]) {
|
|
19
|
-
for (const [name, version] of Object.entries(deps)) {
|
|
20
|
-
deps[name] = repoPackageMap[name] ?? version;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
fs.writeJsonSync('package.json', packageJson, { encoding: 'utf-8' });
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
// Replace package names on the command line
|
|
27
|
-
argv = argv.map(x => repoPackageMap[x] ?? x);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
////////////////////////////////////////////////////////////////////////
|
|
31
|
-
// Shell out to original npm
|
|
32
|
-
|
|
33
|
-
const child = child_process.spawn('node', [require.resolve('npm'), ...argv], {
|
|
34
|
-
shell: false,
|
|
35
|
-
stdio: ['ignore', 'inherit', 'inherit'],
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
child.once('error', e => {
|
|
39
|
-
// eslint-disable-next-line no-console
|
|
40
|
-
console.error(e);
|
|
41
|
-
process.exitCode = 1;
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
child.once('close', code => {
|
|
45
|
-
if (code) {
|
|
46
|
-
process.exitCode = code;
|
|
47
|
-
}
|
|
48
|
-
});
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
export interface IPackageSourceSetup {
|
|
2
|
-
readonly name: string;
|
|
3
|
-
readonly description: string;
|
|
4
|
-
|
|
5
|
-
prepare(): Promise<void>;
|
|
6
|
-
cleanup(): Promise<void>;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export interface IPackageSource {
|
|
10
|
-
makeCliAvailable(): Promise<void>;
|
|
11
|
-
|
|
12
|
-
assertJsiiPackagesAvailable(): void;
|
|
13
|
-
majorVersion(): string;
|
|
14
|
-
|
|
15
|
-
initializeDotnetPackages(targetDir: string): Promise<void>;
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* CLI version
|
|
19
|
-
*/
|
|
20
|
-
requestedCliVersion(): string;
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Framework version if it's different than the CLI version
|
|
24
|
-
*
|
|
25
|
-
* Not all tests will respect this.
|
|
26
|
-
*/
|
|
27
|
-
requestedFrameworkVersion(): string;
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Versions of alpha packages if different than the CLI version
|
|
31
|
-
*
|
|
32
|
-
* Not all tests will respect this.
|
|
33
|
-
*/
|
|
34
|
-
requestedAlphaVersion(): string;
|
|
35
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { ReleasePackageSource } from './release-source';
|
|
2
|
-
import { RepoPackageSource } from './repo-source';
|
|
3
|
-
import { IPackageSourceSetup, IPackageSource } from './source';
|
|
4
|
-
|
|
5
|
-
export function serializeForSubprocess(s: IPackageSourceSetup) {
|
|
6
|
-
process.env.PACKAGE_SOURCE = s.name;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export function packageSourceInSubprocess(): IPackageSource {
|
|
10
|
-
switch (process.env.PACKAGE_SOURCE) {
|
|
11
|
-
case 'repo': return new RepoPackageSource();
|
|
12
|
-
case 'release': return new ReleasePackageSource();
|
|
13
|
-
default: throw new Error(`Unrecognized package source: ${process.env.PACKAGE_SOURCE}`);
|
|
14
|
-
}
|
|
15
|
-
}
|
package/lib/process.ts
DELETED
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
import * as child from 'child_process';
|
|
2
|
-
import { Readable, Writable } from 'stream';
|
|
3
|
-
import * as pty from 'node-pty';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* IProcess provides an interface to work with a subprocess.
|
|
7
|
-
*/
|
|
8
|
-
export interface IProcess {
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Register a callback to be invoked when a chunk is written to stdout.
|
|
12
|
-
*/
|
|
13
|
-
onStdout(callback: (chunk: Buffer) => void): void;
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Register a callback to be invoked when a chunk is written to stderr.
|
|
17
|
-
*/
|
|
18
|
-
onStderr(callback: (chunk: Buffer) => void): void;
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Register a callback to be invoked when the process exists.
|
|
22
|
-
*/
|
|
23
|
-
onExit(callback: (exitCode: number) => void): void;
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Register a callback to be invoked if the process failed to start.
|
|
27
|
-
*/
|
|
28
|
-
onError(callback: (error: Error) => void): void;
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Write the process stdin stream.
|
|
32
|
-
*/
|
|
33
|
-
writeStdin(data: string): void;
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Singal that no more data will be written to stdin. In non tty process you must
|
|
37
|
-
* call this method to make sure the process exits.
|
|
38
|
-
*
|
|
39
|
-
* @param delay - optional delay in milliseconds before the signal is sent.
|
|
40
|
-
*
|
|
41
|
-
*/
|
|
42
|
-
endStdin(delay?: number): void;
|
|
43
|
-
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
export class Process {
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Spawn a process with a TTY attached.
|
|
50
|
-
*/
|
|
51
|
-
public static spawnTTY(command: string, args: string[], options: pty.IPtyForkOptions | pty.IWindowsPtyForkOptions = {}): IProcess {
|
|
52
|
-
|
|
53
|
-
const process = pty.spawn(command, args, {
|
|
54
|
-
name: 'xterm-color',
|
|
55
|
-
...options,
|
|
56
|
-
})
|
|
57
|
-
return new PtyProcess(process);
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Spawn a process without a forcing a TTY.
|
|
63
|
-
*/
|
|
64
|
-
public static spawn(command: string, args: string[], options: child.SpawnOptions = {}): IProcess {
|
|
65
|
-
|
|
66
|
-
const process = child.spawn(command, args, {
|
|
67
|
-
shell: true,
|
|
68
|
-
stdio: ['ignore', 'pipe', 'pipe'],
|
|
69
|
-
...options,
|
|
70
|
-
});
|
|
71
|
-
return new NonPtyProcess(process);
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
class PtyProcess implements IProcess {
|
|
78
|
-
|
|
79
|
-
public constructor(private readonly process: pty.IPty) {}
|
|
80
|
-
|
|
81
|
-
public endStdin(_?: number): void {
|
|
82
|
-
// not needed because all streams are the same in tty.
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
public onError(_: (error: Error) => void): void {
|
|
86
|
-
// not needed because the pty.spawn will simply fail in this case.
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
public onStdout(callback: (chunk: Buffer) => void): void {
|
|
90
|
-
this.process.onData((e) => callback(Buffer.from(e)));
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
public onStderr(_callback: (chunk: Buffer) => void): void {
|
|
94
|
-
// https://github.com/microsoft/node-pty/issues/71
|
|
95
|
-
throw new Error(`Cannot register callback for 'stderr'. A tty does not have separate output and error channels`);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
public onExit(callback: (exitCode: number) => void): void {
|
|
99
|
-
this.process.onExit((e) => { callback(e.exitCode) });
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
public writeStdin(data: string): void {
|
|
104
|
-
// in a pty all streams are the same
|
|
105
|
-
this.process.write(data)
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
class NonPtyProcess implements IProcess {
|
|
111
|
-
|
|
112
|
-
public constructor(private readonly process: child.ChildProcess) {}
|
|
113
|
-
|
|
114
|
-
public onError(callback: (error: Error) => void): void {
|
|
115
|
-
this.process.once('error', callback);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
public onStdout(callback: (chunk: Buffer) => void): void {
|
|
119
|
-
this.assertDefined('stdout', this.process.stdout);
|
|
120
|
-
this.process.stdout.on('data', callback);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
public onStderr(callback: (chunk: Buffer) => void): void {
|
|
124
|
-
this.assertDefined('stderr', this.process.stderr);
|
|
125
|
-
this.process.stderr.on('data', callback);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
public onExit(callback: (exitCode: number) => void): void {
|
|
129
|
-
this.process.on('close', callback);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
public writeStdin(content: string): void {
|
|
133
|
-
this.assertDefined('stdin', this.process.stdin);
|
|
134
|
-
this.process.stdin.write(content);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
public endStdin(delay?: number): void {
|
|
138
|
-
if (this.process.stdin == null) {
|
|
139
|
-
throw new Error('No stdin defined for process');
|
|
140
|
-
}
|
|
141
|
-
if (delay) {
|
|
142
|
-
setTimeout(() => this.process.stdin!.end(), delay);
|
|
143
|
-
} else {
|
|
144
|
-
this.process.stdin!.end();
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
public assertDefined(name: 'stdin' | 'stdout' | 'stderr', stream?: Readable | Writable | undefined | null): asserts stream {
|
|
149
|
-
if (stream == null) {
|
|
150
|
-
throw new Error(`No ${name} defined for child process`);
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
};
|
package/lib/proxy.ts
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { promises as fs } from 'fs';
|
|
2
|
-
import * as querystring from 'node:querystring';
|
|
3
|
-
import * as os from 'os';
|
|
4
|
-
import * as path from 'path';
|
|
5
|
-
import * as mockttp from 'mockttp';
|
|
6
|
-
import { CompletedRequest } from 'mockttp';
|
|
7
|
-
|
|
8
|
-
export async function startProxyServer(certDirRoot?: string): Promise<ProxyServer> {
|
|
9
|
-
const certDir = await fs.mkdtemp(path.join(certDirRoot ?? os.tmpdir(), 'cdk-'));
|
|
10
|
-
const certPath = path.join(certDir, 'cert.pem');
|
|
11
|
-
const keyPath = path.join(certDir, 'key.pem');
|
|
12
|
-
|
|
13
|
-
// Set up key and certificate
|
|
14
|
-
const { key, cert } = await mockttp.generateCACertificate();
|
|
15
|
-
await fs.writeFile(keyPath, key);
|
|
16
|
-
await fs.writeFile(certPath, cert);
|
|
17
|
-
|
|
18
|
-
const server = mockttp.getLocal({
|
|
19
|
-
https: { keyPath: keyPath, certPath: certPath },
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
// We don't need to modify any request, so the proxy
|
|
23
|
-
// passes through all requests to the target host.
|
|
24
|
-
const endpoint = await server
|
|
25
|
-
.forAnyRequest()
|
|
26
|
-
.thenPassThrough();
|
|
27
|
-
|
|
28
|
-
const port = 9000 + Math.floor(Math.random() * 10000);
|
|
29
|
-
|
|
30
|
-
// server.enableDebug();
|
|
31
|
-
await server.start(port);
|
|
32
|
-
|
|
33
|
-
return {
|
|
34
|
-
certPath,
|
|
35
|
-
keyPath,
|
|
36
|
-
server,
|
|
37
|
-
url: server.url,
|
|
38
|
-
port: server.port,
|
|
39
|
-
getSeenRequests: () => endpoint.getSeenRequests(),
|
|
40
|
-
async stop() {
|
|
41
|
-
await server.stop();
|
|
42
|
-
await fs.rm(certDir, { recursive: true, force: true });
|
|
43
|
-
},
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export interface ProxyServer {
|
|
48
|
-
readonly certPath: string;
|
|
49
|
-
readonly keyPath: string;
|
|
50
|
-
readonly server: mockttp.Mockttp;
|
|
51
|
-
readonly url: string;
|
|
52
|
-
readonly port: number;
|
|
53
|
-
|
|
54
|
-
getSeenRequests(): Promise<CompletedRequest[]>;
|
|
55
|
-
stop(): Promise<void>;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export function awsActionsFromRequests(requests: CompletedRequest[]): string[] {
|
|
59
|
-
return [...new Set(requests
|
|
60
|
-
.map(req => req.body.buffer.toString('utf-8'))
|
|
61
|
-
.map(body => querystring.decode(body))
|
|
62
|
-
.map(x => x.Action as string)
|
|
63
|
-
.filter(action => action != null))];
|
|
64
|
-
}
|
package/lib/resource-pool.ts
DELETED
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
import { ILock, XpMutex, XpMutexPool } from './xpmutex';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* A class that holds a pool of resources and gives them out and returns them on-demand
|
|
5
|
-
*
|
|
6
|
-
* The resources will be given out front to back, when they are returned
|
|
7
|
-
* the most recently returned version will be given out again (for best
|
|
8
|
-
* cache coherency).
|
|
9
|
-
*
|
|
10
|
-
* If there are multiple consumers waiting for a resource, consumers are serviced
|
|
11
|
-
* in FIFO order for most fairness.
|
|
12
|
-
*/
|
|
13
|
-
export class ResourcePool<A extends string=string> {
|
|
14
|
-
public static withResources<A extends string>(name: string, resources: A[]) {
|
|
15
|
-
const pool = XpMutexPool.fromName(name);
|
|
16
|
-
return new ResourcePool(pool, resources);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
private readonly resources: ReadonlyArray<A>;
|
|
20
|
-
private readonly mutexes: Record<string, XpMutex> = {};
|
|
21
|
-
private readonly locks: Record<string, ILock | undefined> = {};
|
|
22
|
-
|
|
23
|
-
private constructor(private readonly pool: XpMutexPool, resources: A[]) {
|
|
24
|
-
if (resources.length === 0) {
|
|
25
|
-
throw new Error('Must have at least one resource in the pool');
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// Shuffle to reduce contention
|
|
29
|
-
resources = [...resources];
|
|
30
|
-
fisherYatesShuffle(resources);
|
|
31
|
-
this.resources = resources;
|
|
32
|
-
|
|
33
|
-
for (const res of resources) {
|
|
34
|
-
this.mutexes[res] = this.pool.mutex(res);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Take one value from the resource pool
|
|
40
|
-
*
|
|
41
|
-
* If no such value is currently available, wait until it is.
|
|
42
|
-
*/
|
|
43
|
-
public async take(): Promise<ILease<A>> {
|
|
44
|
-
while (true) {
|
|
45
|
-
// Start a wait on the unlock now -- if the unlock signal comes after
|
|
46
|
-
// we try to acquire but before we start the wait, we might miss it.
|
|
47
|
-
//
|
|
48
|
-
// (The timeout is in case the unlock signal doesn't come for whatever reason).
|
|
49
|
-
const wait = this.pool.awaitUnlock(10_000);
|
|
50
|
-
|
|
51
|
-
// Try all mutexes, we might need to reacquire an expired lock
|
|
52
|
-
for (const res of this.resources) {
|
|
53
|
-
const lease = await this.tryObtainLease(res);
|
|
54
|
-
if (lease) {
|
|
55
|
-
// Ignore the wait (count as handled)
|
|
56
|
-
wait.then(() => {}, () => {});
|
|
57
|
-
return lease;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// None available, wait until one gets unlocked then try again
|
|
62
|
-
await wait;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Execute a block using a single resource from the pool
|
|
68
|
-
*/
|
|
69
|
-
public async using<B>(block: (x: A) => B | Promise<B>): Promise<B> {
|
|
70
|
-
const lease = await this.take();
|
|
71
|
-
try {
|
|
72
|
-
return await block(lease.value);
|
|
73
|
-
} finally {
|
|
74
|
-
await lease.dispose();
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
private async tryObtainLease(value: A) {
|
|
79
|
-
const lock = await this.mutexes[value].tryAcquire();
|
|
80
|
-
if (!lock) {
|
|
81
|
-
return undefined;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
this.locks[value] = lock;
|
|
85
|
-
return this.makeLease(value);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
private makeLease(value: A): ILease<A> {
|
|
89
|
-
let disposed = false;
|
|
90
|
-
return {
|
|
91
|
-
value,
|
|
92
|
-
dispose: async () => {
|
|
93
|
-
if (disposed) {
|
|
94
|
-
throw new Error('Calling dispose() on an already-disposed lease.');
|
|
95
|
-
}
|
|
96
|
-
disposed = true;
|
|
97
|
-
return this.returnValue(value);
|
|
98
|
-
},
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* When a value is returned:
|
|
104
|
-
*
|
|
105
|
-
* - If someone's waiting for it, give it to them
|
|
106
|
-
* - Otherwise put it back into the pool
|
|
107
|
-
*/
|
|
108
|
-
private async returnValue(value: string) {
|
|
109
|
-
const lock = this.locks[value];
|
|
110
|
-
delete this.locks[value];
|
|
111
|
-
await lock?.release();
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* A single value taken from the pool
|
|
117
|
-
*/
|
|
118
|
-
export interface ILease<A> {
|
|
119
|
-
/**
|
|
120
|
-
* The value obtained by the lease
|
|
121
|
-
*/
|
|
122
|
-
readonly value: A;
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* Return the leased value to the pool
|
|
126
|
-
*/
|
|
127
|
-
dispose(): Promise<void>;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* Shuffle an array in-place
|
|
132
|
-
*/
|
|
133
|
-
function fisherYatesShuffle<A>(xs: A[]) {
|
|
134
|
-
for (let i = xs.length - 1; i >= 1; i--) {
|
|
135
|
-
const j = Math.floor(Math.random() * i);
|
|
136
|
-
const h = xs[j];
|
|
137
|
-
xs[j] = xs[i];
|
|
138
|
-
xs[i] = h;
|
|
139
|
-
}
|
|
140
|
-
}
|
package/lib/resources.ts
DELETED