diff --git a/codebuild_specs/aggregate_e2e_reports.yml b/codebuild_specs/aggregate_e2e_reports.yml index 81fb6670fd2..5ad4191d63a 100644 --- a/codebuild_specs/aggregate_e2e_reports.yml +++ b/codebuild_specs/aggregate_e2e_reports.yml @@ -10,9 +10,13 @@ phases: - ts-node ./wait-for-all-codebuild.ts $CODEBUILD_RESOLVED_SOURCE_VERSION ../$WAIT_FOR_IDS_FILE_PATH $PROJECT_NAME - cd .. - source ./shared-scripts.sh && _downloadReportsFromS3 $CODEBUILD_SOURCE_VERSION + - mkdir artifacts && echo "empty artifact" > artifacts/empty-artifact.txt reports: e2e-reports: files: - '*.xml' file-format: 'JUNITXML' base-directory: '$CODEBUILD_SRC_DIR/aggregate_reports' +artifacts: + files: + - 'artifacts/*' diff --git a/codebuild_specs/cleanup_resources.yml b/codebuild_specs/cleanup_resources.yml index 552912cfc6c..d9d143c3410 100644 --- a/codebuild_specs/cleanup_resources.yml +++ b/codebuild_specs/cleanup_resources.yml @@ -4,7 +4,8 @@ env: phases: build: commands: - - echo cleanup running + - npm install -g ts-node + - source ./shared-scripts.sh && _cleanUpResources artifacts: files: - 'shared-scripts.sh' diff --git a/codebuild_specs/e2e_workflow_base.yml b/codebuild_specs/e2e_workflow_base.yml index 88d189e79b6..8ea26066071 100644 --- a/codebuild_specs/e2e_workflow_base.yml +++ b/codebuild_specs/e2e_workflow_base.yml @@ -136,3 +136,7 @@ batch: compute-type: BUILD_GENERAL1_LARGE depend-on: - upb + - identifier: cleanup_resources + buildspec: codebuild_specs/cleanup_resources.yml + depend-on: + - aggregate_e2e_reports diff --git a/codebuild_specs/e2e_workflow_generated.yml b/codebuild_specs/e2e_workflow_generated.yml index 2ff2ec984b1..319fd3c2dd1 100644 --- a/codebuild_specs/e2e_workflow_generated.yml +++ b/codebuild_specs/e2e_workflow_generated.yml @@ -136,12 +136,16 @@ batch: compute-type: BUILD_GENERAL1_LARGE depend-on: - upb + - identifier: cleanup_resources + buildspec: codebuild_specs/cleanup_resources.yml + depend-on: + - aggregate_e2e_reports - identifier: l_diagnose_hooks_a_mock_api buildspec: codebuild_specs/run_e2e_tests_linux.yml env: variables: TEST_SUITE: src/__tests__/diagnose.test.ts|src/__tests__/hooks-a.test.ts|src/__tests__/mock-api.test.ts - CLI_REGION: ap-southeast-2 + CLI_REGION: ap-southeast-1 depend-on: - upb - identifier: l_analytics_kinesis_analytics_pinpoint_flutter_analytics_pinpoint_js @@ -149,7 +153,7 @@ batch: env: variables: TEST_SUITE: src/__tests__/analytics-kinesis.test.ts|src/__tests__/analytics-pinpoint-flutter.test.ts|src/__tests__/analytics-pinpoint-js.test.ts - CLI_REGION: eu-central-1 + CLI_REGION: ap-southeast-2 depend-on: - upb - identifier: l_auth_2a_auth_2b_auth_2d @@ -157,7 +161,7 @@ batch: env: variables: TEST_SUITE: src/__tests__/auth_2a.test.ts|src/__tests__/auth_2b.test.ts|src/__tests__/auth_2d.test.ts - CLI_REGION: ap-northeast-1 + CLI_REGION: eu-central-1 depend-on: - upb - identifier: l_auth_2f_notifications_lifecycle_notifications_analytics_compatibility_in_app_1 @@ -165,7 +169,7 @@ batch: env: variables: TEST_SUITE: src/__tests__/auth_2f.test.ts|src/__tests__/notifications-lifecycle.test.ts|src/__tests__/notifications-analytics-compatibility-in-app-1.test.ts - CLI_REGION: us-east-1 + CLI_REGION: eu-central-1 depend-on: - upb - identifier: l_notifications_analytics_compatibility_sms_2_analytics_2_global_sandbox_c @@ -173,7 +177,7 @@ batch: env: variables: TEST_SUITE: src/__tests__/notifications-analytics-compatibility-sms-2.test.ts|src/__tests__/analytics-2.test.ts|src/__tests__/global_sandbox-c.test.ts - CLI_REGION: eu-west-2 + CLI_REGION: us-east-1 depend-on: - upb - identifier: l_hooks_b_notifications_analytics_compatibility_sms_1_plugin @@ -181,7 +185,7 @@ batch: env: variables: TEST_SUITE: src/__tests__/hooks-b.test.ts|src/__tests__/notifications-analytics-compatibility-sms-1.test.ts|src/__tests__/plugin.test.ts - CLI_REGION: ap-northeast-1 + CLI_REGION: eu-west-2 depend-on: - upb - identifier: l_studio_modelgen_custom_transformers_notifications_in_app_messaging_env_1 @@ -189,7 +193,7 @@ batch: env: variables: TEST_SUITE: src/__tests__/studio-modelgen.test.ts|src/__tests__/graphql-v2/custom-transformers.test.ts|src/__tests__/notifications-in-app-messaging-env-1.test.ts - CLI_REGION: ap-southeast-2 + CLI_REGION: eu-central-1 depend-on: - upb - identifier: l_notifications_sms_pull_pull_auth_10 @@ -197,7 +201,7 @@ batch: env: variables: TEST_SUITE: src/__tests__/notifications-sms-pull.test.ts|src/__tests__/pull.test.ts|src/__tests__/auth_10.test.ts - CLI_REGION: ap-southeast-2 + CLI_REGION: us-west-2 depend-on: - upb - identifier: l_container_hosting_init_b_notifications_apns @@ -213,7 +217,7 @@ batch: env: variables: TEST_SUITE: src/__tests__/notifications-fcm.test.ts|src/__tests__/notifications-in-app-messaging-env-2.test.ts|src/__tests__/with-babel-config.test.ts - CLI_REGION: eu-west-2 + CLI_REGION: us-west-2 depend-on: - upb - identifier: l_amplify_configure_env_2_init_d @@ -221,7 +225,7 @@ batch: env: variables: TEST_SUITE: src/__tests__/amplify-configure.test.ts|src/__tests__/env-2.test.ts|src/__tests__/init_d.test.ts - CLI_REGION: us-east-1 + CLI_REGION: us-west-2 depend-on: - upb - identifier: l_init_f_auth_5d_configure_project @@ -229,7 +233,7 @@ batch: env: variables: TEST_SUITE: src/__tests__/init_f.test.ts|src/__tests__/auth_5d.test.ts|src/__tests__/configure-project.test.ts - CLI_REGION: eu-west-2 + CLI_REGION: ap-southeast-2 depend-on: - upb - identifier: l_git_clone_attach_init_c_layer_4 @@ -237,7 +241,7 @@ batch: env: variables: TEST_SUITE: src/__tests__/git-clone-attach.test.ts|src/__tests__/init_c.test.ts|src/__tests__/layer-4.test.ts - CLI_REGION: us-west-2 + CLI_REGION: eu-west-2 depend-on: - upb - identifier: l_function_2c_function_3b_function_4 @@ -245,7 +249,7 @@ batch: env: variables: TEST_SUITE: src/__tests__/function_2c.test.ts|src/__tests__/function_3b.test.ts|src/__tests__/function_4.test.ts - CLI_REGION: us-east-2 + CLI_REGION: us-west-2 depend-on: - upb - identifier: l_interactions_schema_model_a_tags @@ -261,7 +265,7 @@ batch: env: variables: TEST_SUITE: src/__tests__/auth_1a.test.ts|src/__tests__/auth-trigger.test.ts|src/__tests__/custom_policies_function.test.ts - CLI_REGION: us-east-2 + CLI_REGION: eu-central-1 depend-on: - upb - identifier: l_function_6_storage_2_export @@ -269,7 +273,7 @@ batch: env: variables: TEST_SUITE: src/__tests__/function_6.test.ts|src/__tests__/storage-2.test.ts|src/__tests__/export.test.ts - CLI_REGION: us-east-2 + CLI_REGION: ap-northeast-1 depend-on: - upb - identifier: l_iam_permissions_boundary_node_function_notifications_sms @@ -277,7 +281,7 @@ batch: env: variables: TEST_SUITE: src/__tests__/iam-permissions-boundary.test.ts|src/__tests__/migration/node.function.test.ts|src/__tests__/notifications-sms.test.ts - CLI_REGION: eu-central-1 + CLI_REGION: ap-southeast-1 depend-on: - upb - identifier: l_schema_auth_4b_schema_model_e_schema_versioned @@ -285,7 +289,7 @@ batch: env: variables: TEST_SUITE: src/__tests__/schema-auth-4b.test.ts|src/__tests__/schema-model-e.test.ts|src/__tests__/schema-versioned.test.ts - CLI_REGION: ap-southeast-1 + CLI_REGION: ap-northeast-1 depend-on: - upb - identifier: l_auth_1c_auth_5e_auth_8b @@ -293,7 +297,7 @@ batch: env: variables: TEST_SUITE: src/__tests__/auth_1c.test.ts|src/__tests__/auth_5e.test.ts|src/__tests__/auth_8b.test.ts - CLI_REGION: eu-west-2 + CLI_REGION: ap-southeast-1 depend-on: - upb - identifier: l_geo_add_b_s3_sse_schema_auth_4a @@ -301,7 +305,7 @@ batch: env: variables: TEST_SUITE: src/__tests__/geo-add-b.test.ts|src/__tests__/s3-sse.test.ts|src/__tests__/schema-auth-4a.test.ts - CLI_REGION: eu-central-1 + CLI_REGION: us-west-2 depend-on: - upb - identifier: l_schema_model_b_schema_model_d_auth_5f @@ -309,7 +313,7 @@ batch: env: variables: TEST_SUITE: src/__tests__/schema-model-b.test.ts|src/__tests__/schema-model-d.test.ts|src/__tests__/auth_5f.test.ts - CLI_REGION: us-east-1 + CLI_REGION: eu-west-2 depend-on: - upb - identifier: l_env_4_frontend_config_drift_schema_auth_4d @@ -317,7 +321,7 @@ batch: env: variables: TEST_SUITE: src/__tests__/env-4.test.ts|src/__tests__/frontend_config_drift.test.ts|src/__tests__/schema-auth-4d.test.ts - CLI_REGION: us-east-1 + CLI_REGION: eu-central-1 depend-on: - upb - identifier: l_schema_auth_6a_schema_data_access_patterns_schema_model_c @@ -325,7 +329,7 @@ batch: env: variables: TEST_SUITE: src/__tests__/schema-auth-6a.test.ts|src/__tests__/schema-data-access-patterns.test.ts|src/__tests__/schema-model-c.test.ts - CLI_REGION: eu-central-1 + CLI_REGION: us-east-1 depend-on: - upb - identifier: l_schema_predictions_model_migration_auth_3c @@ -333,7 +337,7 @@ batch: env: variables: TEST_SUITE: src/__tests__/schema-predictions.test.ts|src/__tests__/transformer-migrations/model-migration.test.ts|src/__tests__/auth_3c.test.ts - CLI_REGION: eu-central-1 + CLI_REGION: us-east-1 depend-on: - upb - identifier: l_auth_4c_auth_5a_auth_5c @@ -341,7 +345,7 @@ batch: env: variables: TEST_SUITE: src/__tests__/auth_4c.test.ts|src/__tests__/auth_5a.test.ts|src/__tests__/auth_5c.test.ts - CLI_REGION: eu-central-1 + CLI_REGION: us-east-2 depend-on: - upb - identifier: l_env_1_geo_add_a_init_a @@ -349,7 +353,7 @@ batch: env: variables: TEST_SUITE: src/__tests__/env-1.test.ts|src/__tests__/geo-add-a.test.ts|src/__tests__/init_a.test.ts - CLI_REGION: ap-northeast-1 + CLI_REGION: ap-southeast-1 depend-on: - upb - identifier: l_schema_auth_4c_schema_auth_5c_auth_5b @@ -357,7 +361,7 @@ batch: env: variables: TEST_SUITE: src/__tests__/schema-auth-4c.test.ts|src/__tests__/schema-auth-5c.test.ts|src/__tests__/auth_5b.test.ts - CLI_REGION: us-west-2 + CLI_REGION: us-east-2 depend-on: - upb - identifier: l_auth_9_custom_resources_env_5 @@ -365,7 +369,7 @@ batch: env: variables: TEST_SUITE: src/__tests__/auth_9.test.ts|src/__tests__/custom_resources.test.ts|src/__tests__/env-5.test.ts - CLI_REGION: us-east-2 + CLI_REGION: us-east-1 depend-on: - upb - identifier: l_function_10_function_9c_function_permissions @@ -373,7 +377,7 @@ batch: env: variables: TEST_SUITE: src/__tests__/function_10.test.ts|src/__tests__/function_9c.test.ts|src/__tests__/function-permissions.test.ts - CLI_REGION: us-west-2 + CLI_REGION: ap-northeast-1 depend-on: - upb - identifier: l_geo_import_1a_geo_import_2_global_sandbox_b @@ -381,7 +385,7 @@ batch: env: variables: TEST_SUITE: src/__tests__/geo-import-1a.test.ts|src/__tests__/geo-import-2.test.ts|src/__tests__/global_sandbox-b.test.ts - CLI_REGION: eu-west-2 + CLI_REGION: us-east-2 depend-on: - upb - identifier: l_schema_auth_5d_schema_auth_6b_schema_auth_8c @@ -389,7 +393,7 @@ batch: env: variables: TEST_SUITE: src/__tests__/schema-auth-5d.test.ts|src/__tests__/schema-auth-6b.test.ts|src/__tests__/schema-auth-8c.test.ts - CLI_REGION: eu-west-2 + CLI_REGION: us-east-2 depend-on: - upb - identifier: l_auth_3a_auth_3b_auth_4a @@ -397,7 +401,7 @@ batch: env: variables: TEST_SUITE: src/__tests__/auth_3a.test.ts|src/__tests__/auth_3b.test.ts|src/__tests__/auth_4a.test.ts - CLI_REGION: eu-central-1 + CLI_REGION: us-east-1 depend-on: - upb - identifier: l_auth_7a_auth_8c_feature_flags @@ -405,7 +409,7 @@ batch: env: variables: TEST_SUITE: src/__tests__/auth_7a.test.ts|src/__tests__/auth_8c.test.ts|src/__tests__/feature-flags.test.ts - CLI_REGION: us-east-1 + CLI_REGION: us-east-2 depend-on: - upb - identifier: l_geo_import_1b_global_sandbox_a_init_e @@ -413,7 +417,7 @@ batch: env: variables: TEST_SUITE: src/__tests__/geo-import-1b.test.ts|src/__tests__/global_sandbox-a.test.ts|src/__tests__/init_e.test.ts - CLI_REGION: us-east-1 + CLI_REGION: us-west-2 depend-on: - upb - identifier: l_notifications_analytics_compatibility_in_app_2_schema_auth_11_c_schema_auth_2b @@ -421,7 +425,7 @@ batch: env: variables: TEST_SUITE: src/__tests__/notifications-analytics-compatibility-in-app-2.test.ts|src/__tests__/schema-auth-11-c.test.ts|src/__tests__/schema-auth-2b.test.ts - CLI_REGION: ap-southeast-1 + CLI_REGION: eu-west-2 depend-on: - upb - identifier: l_schema_auth_6c_schema_auth_6d_schema_auth_7c @@ -429,7 +433,7 @@ batch: env: variables: TEST_SUITE: src/__tests__/schema-auth-6c.test.ts|src/__tests__/schema-auth-6d.test.ts|src/__tests__/schema-auth-7c.test.ts - CLI_REGION: eu-central-1 + CLI_REGION: us-west-2 depend-on: - upb - identifier: l_schema_auth_8a_function_migration_api_10 @@ -437,7 +441,7 @@ batch: env: variables: TEST_SUITE: src/__tests__/schema-auth-8a.test.ts|src/__tests__/transformer-migrations/function-migration.test.ts|src/__tests__/api_10.test.ts - CLI_REGION: eu-central-1 + CLI_REGION: eu-west-2 depend-on: - upb - identifier: l_api_7_export_pull_a_function_9a @@ -445,7 +449,7 @@ batch: env: variables: TEST_SUITE: src/__tests__/api_7.test.ts|src/__tests__/export-pull-a.test.ts|src/__tests__/function_9a.test.ts - CLI_REGION: eu-west-2 + CLI_REGION: us-east-2 depend-on: - upb - identifier: l_geo_headless_api_key_migration5_schema_auth_1a @@ -453,7 +457,7 @@ batch: env: variables: TEST_SUITE: src/__tests__/geo-headless.test.ts|src/__tests__/migration/api.key.migration5.test.ts|src/__tests__/schema-auth-1a.test.ts - CLI_REGION: eu-central-1 + CLI_REGION: ap-southeast-1 depend-on: - upb - identifier: l_schema_auth_5b_schema_auth_8b_schema_auth_9_a @@ -461,7 +465,7 @@ batch: env: variables: TEST_SUITE: src/__tests__/schema-auth-5b.test.ts|src/__tests__/schema-auth-8b.test.ts|src/__tests__/schema-auth-9-a.test.ts - CLI_REGION: ap-southeast-2 + CLI_REGION: ap-southeast-1 depend-on: - upb - identifier: l_schema_auth_9_c_storage_3_auth_11 @@ -469,7 +473,7 @@ batch: env: variables: TEST_SUITE: src/__tests__/schema-auth-9-c.test.ts|src/__tests__/storage-3.test.ts|src/__tests__/auth_11.test.ts - CLI_REGION: us-east-2 + CLI_REGION: eu-west-2 depend-on: - upb - identifier: l_auth_1b_delete_geo_add_c @@ -477,7 +481,7 @@ batch: env: variables: TEST_SUITE: src/__tests__/auth_1b.test.ts|src/__tests__/delete.test.ts|src/__tests__/geo-add-c.test.ts - CLI_REGION: us-east-2 + CLI_REGION: eu-west-2 depend-on: - upb - identifier: l_geo_add_d_geo_import_3_hosting @@ -485,7 +489,7 @@ batch: env: variables: TEST_SUITE: src/__tests__/geo-add-d.test.ts|src/__tests__/geo-import-3.test.ts|src/__tests__/hosting.test.ts - CLI_REGION: eu-central-1 + CLI_REGION: us-east-2 depend-on: - upb - identifier: l_layer_3_api_connection_migration_api_key_migration3 @@ -493,7 +497,7 @@ batch: env: variables: TEST_SUITE: src/__tests__/layer-3.test.ts|src/__tests__/migration/api.connection.migration.test.ts|src/__tests__/migration/api.key.migration3.test.ts - CLI_REGION: ap-southeast-1 + CLI_REGION: us-west-2 depend-on: - upb - identifier: l_predictions_schema_auth_11_b_schema_auth_1b @@ -501,7 +505,7 @@ batch: env: variables: TEST_SUITE: src/__tests__/predictions.test.ts|src/__tests__/schema-auth-11-b.test.ts|src/__tests__/schema-auth-1b.test.ts - CLI_REGION: eu-central-1 + CLI_REGION: ap-southeast-1 depend-on: - upb - identifier: l_schema_auth_2a_schema_auth_7a_schema_auth_7b @@ -509,7 +513,7 @@ batch: env: variables: TEST_SUITE: src/__tests__/schema-auth-2a.test.ts|src/__tests__/schema-auth-7a.test.ts|src/__tests__/schema-auth-7b.test.ts - CLI_REGION: ap-southeast-1 + CLI_REGION: us-west-2 depend-on: - upb - identifier: l_schema_auth_9_b_schema_iterative_rollback_1_predictions_migration @@ -517,7 +521,7 @@ batch: env: variables: TEST_SUITE: src/__tests__/schema-auth-9-b.test.ts|src/__tests__/schema-iterative-rollback-1.test.ts|src/__tests__/transformer-migrations/predictions-migration.test.ts - CLI_REGION: ap-southeast-1 + CLI_REGION: ap-northeast-1 depend-on: - upb - identifier: l_api_6a_auth_7b_export_pull_b @@ -525,7 +529,7 @@ batch: env: variables: TEST_SUITE: src/__tests__/api_6a.test.ts|src/__tests__/auth_7b.test.ts|src/__tests__/export-pull-b.test.ts - CLI_REGION: eu-central-1 + CLI_REGION: ap-southeast-1 depend-on: - upb - identifier: l_function_3a_init_special_case_http_migration @@ -533,7 +537,7 @@ batch: env: variables: TEST_SUITE: src/__tests__/function_3a.test.ts|src/__tests__/init-special-case.test.ts|src/__tests__/transformer-migrations/http-migration.test.ts - CLI_REGION: eu-west-2 + CLI_REGION: ap-northeast-1 depend-on: - upb - identifier: l_schema_auth_12_schema_auth_3_schema_function_2 @@ -541,7 +545,7 @@ batch: env: variables: TEST_SUITE: src/__tests__/schema-auth-12.test.ts|src/__tests__/schema-auth-3.test.ts|src/__tests__/schema-function-2.test.ts - CLI_REGION: us-west-2 + CLI_REGION: ap-southeast-2 depend-on: - upb - identifier: l_auth_4b_auth_8a_export_pull_d @@ -549,7 +553,7 @@ batch: env: variables: TEST_SUITE: src/__tests__/auth_4b.test.ts|src/__tests__/auth_8a.test.ts|src/__tests__/export-pull-d.test.ts - CLI_REGION: us-east-2 + CLI_REGION: ap-southeast-1 depend-on: - upb - identifier: l_schema_auth_5a_schema_iterative_rollback_2_schema_iterative_update_3 @@ -557,7 +561,7 @@ batch: env: variables: TEST_SUITE: src/__tests__/schema-auth-5a.test.ts|src/__tests__/schema-iterative-rollback-2.test.ts|src/__tests__/schema-iterative-update-3.test.ts - CLI_REGION: eu-central-1 + CLI_REGION: us-east-1 depend-on: - upb - identifier: l_auth_migration_api_2a_api_2b @@ -565,7 +569,7 @@ batch: env: variables: TEST_SUITE: src/__tests__/transformer-migrations/auth-migration.test.ts|src/__tests__/api_2a.test.ts|src/__tests__/api_2b.test.ts - CLI_REGION: us-east-1 + CLI_REGION: ap-southeast-2 depend-on: - upb - identifier: l_api_6c_api_9a_auth_12 @@ -581,7 +585,7 @@ batch: env: variables: TEST_SUITE: src/__tests__/auth_2g.test.ts|src/__tests__/auth_2h.test.ts|src/__tests__/auth_5g.test.ts - CLI_REGION: ap-southeast-2 + CLI_REGION: ap-southeast-1 depend-on: - upb - identifier: l_hosted_ui_user_groups_s3_access_user_groups @@ -589,7 +593,7 @@ batch: env: variables: TEST_SUITE: src/__tests__/auth/hosted-ui.test.ts|src/__tests__/auth/user-groups-s3-access.test.ts|src/__tests__/auth/user-groups.test.ts - CLI_REGION: eu-central-1 + CLI_REGION: us-west-2 depend-on: - upb - identifier: l_build_function_custom_resource_with_storage_dynamodb_simulator @@ -605,7 +609,7 @@ batch: env: variables: TEST_SUITE: src/__tests__/export-pull-c.test.ts|src/__tests__/function_12.test.ts|src/__tests__/function_13.test.ts - CLI_REGION: eu-central-1 + CLI_REGION: eu-west-2 depend-on: - upb - identifier: l_function_14_function_15_function_2d @@ -613,7 +617,7 @@ batch: env: variables: TEST_SUITE: src/__tests__/function_14.test.ts|src/__tests__/function_15.test.ts|src/__tests__/function_2d.test.ts - CLI_REGION: ap-southeast-2 + CLI_REGION: us-east-1 depend-on: - upb - identifier: l_general_config_headless_init_help_hooks_c @@ -621,7 +625,7 @@ batch: env: variables: TEST_SUITE: src/__tests__/general-config/general-config-headless-init.test.ts|src/__tests__/help.test.ts|src/__tests__/hooks-c.test.ts - CLI_REGION: eu-west-2 + CLI_REGION: us-east-1 depend-on: - upb - identifier: l_init_force_push_interactions_1_interactions_2 @@ -637,7 +641,7 @@ batch: env: variables: TEST_SUITE: src/__tests__/minify-cloudformation.test.ts|src/__tests__/notifications-multi-env.test.ts|src/__tests__/notifications-sms-update.test.ts - CLI_REGION: ap-southeast-1 + CLI_REGION: ap-southeast-2 depend-on: - upb - identifier: l_opensearch_simulator_parameter_store_1_parameter_store_2 @@ -645,7 +649,7 @@ batch: env: variables: TEST_SUITE: src/__tests__/opensearch-simulator/opensearch-simulator.test.ts|src/__tests__/parameter-store-1.test.ts|src/__tests__/parameter-store-2.test.ts - CLI_REGION: ap-northeast-1 + CLI_REGION: us-east-2 depend-on: - upb - identifier: l_android_analytics_pinpoint_config_android_notifications_pinpoint_config_flutter_analytics_pinpoint_config @@ -653,7 +657,7 @@ batch: env: variables: TEST_SUITE: src/__tests__/pinpoint/android-analytics-pinpoint-config.test.ts|src/__tests__/pinpoint/android-notifications-pinpoint-config.test.ts|src/__tests__/pinpoint/flutter-analytics-pinpoint-config.test.ts - CLI_REGION: us-east-1 + CLI_REGION: eu-west-2 depend-on: - upb - identifier: l_flutter_notifications_pinpoint_config_ios_analytics_pinpoint_config_ios_notifications_pinpoint_config @@ -661,7 +665,7 @@ batch: env: variables: TEST_SUITE: src/__tests__/pinpoint/flutter-notifications-pinpoint-config.test.ts|src/__tests__/pinpoint/ios-analytics-pinpoint-config.test.ts|src/__tests__/pinpoint/ios-notifications-pinpoint-config.test.ts - CLI_REGION: us-west-2 + CLI_REGION: ap-southeast-2 depend-on: - upb - identifier: l_javascript_analytics_pinpoint_config_javascript_notifications_pinpoint_config_pr_previews_multi_env_1 @@ -669,7 +673,7 @@ batch: env: variables: TEST_SUITE: src/__tests__/pinpoint/javascript-analytics-pinpoint-config.test.ts|src/__tests__/pinpoint/javascript-notifications-pinpoint-config.test.ts|src/__tests__/pr-previews-multi-env-1.test.ts - CLI_REGION: eu-west-2 + CLI_REGION: ap-northeast-1 depend-on: - upb - identifier: l_pull_2_push_smoketest @@ -677,7 +681,7 @@ batch: env: variables: TEST_SUITE: src/__tests__/pull-2.test.ts|src/__tests__/push.test.ts|src/__tests__/smoketest.test.ts - CLI_REGION: us-west-2 + CLI_REGION: eu-west-2 depend-on: - upb - identifier: l_S3server_api_8_function_8 @@ -685,7 +689,7 @@ batch: env: variables: TEST_SUITE: src/__tests__/storage-simulator/S3server.test.ts|src/__tests__/api_8.test.ts|src/__tests__/function_8.test.ts - CLI_REGION: ap-southeast-1 + CLI_REGION: eu-west-2 depend-on: - upb - identifier: l_schema_iterative_update_locking_api_lambda_auth_2_layer_2 @@ -693,7 +697,7 @@ batch: env: variables: TEST_SUITE: src/__tests__/schema-iterative-update-locking.test.ts|src/__tests__/graphql-v2/api_lambda_auth_2.test.ts|src/__tests__/layer-2.test.ts - CLI_REGION: ap-southeast-1 + CLI_REGION: ap-northeast-1 depend-on: - upb - identifier: l_schema_auth_13_function_5_schema_iterative_update_1 @@ -701,7 +705,7 @@ batch: env: variables: TEST_SUITE: src/__tests__/schema-auth-13.test.ts|src/__tests__/function_5.test.ts|src/__tests__/schema-iterative-update-1.test.ts - CLI_REGION: ap-southeast-2 + CLI_REGION: us-east-1 depend-on: - upb - identifier: l_auth_6_function_2a_schema_connection_2 @@ -709,7 +713,7 @@ batch: env: variables: TEST_SUITE: src/__tests__/auth_6.test.ts|src/__tests__/function_2a.test.ts|src/__tests__/schema-connection-2.test.ts - CLI_REGION: us-east-1 + CLI_REGION: ap-southeast-2 depend-on: - upb - identifier: l_schema_function_1_api_9b_custom_policies_container @@ -717,7 +721,7 @@ batch: env: variables: TEST_SUITE: src/__tests__/schema-function-1.test.ts|src/__tests__/api_9b.test.ts|src/__tests__/custom_policies_container.test.ts - CLI_REGION: ap-northeast-1 + CLI_REGION: eu-central-1 depend-on: - upb - identifier: l_function_9b_schema_iterative_update_2_storage_1a @@ -725,7 +729,7 @@ batch: env: variables: TEST_SUITE: src/__tests__/function_9b.test.ts|src/__tests__/schema-iterative-update-2.test.ts|src/__tests__/storage-1a.test.ts - CLI_REGION: eu-west-2 + CLI_REGION: us-east-2 depend-on: - upb - identifier: l_storage_1b_function_11_function_2b @@ -733,7 +737,7 @@ batch: env: variables: TEST_SUITE: src/__tests__/storage-1b.test.ts|src/__tests__/function_11.test.ts|src/__tests__/function_2b.test.ts - CLI_REGION: eu-west-2 + CLI_REGION: ap-southeast-2 depend-on: - upb - identifier: l_function_7_api_connection_migration2_api_4 @@ -741,7 +745,7 @@ batch: env: variables: TEST_SUITE: src/__tests__/function_7.test.ts|src/__tests__/migration/api.connection.migration2.test.ts|src/__tests__/api_4.test.ts - CLI_REGION: ap-northeast-1 + CLI_REGION: us-east-1 depend-on: - upb - identifier: l_containers_api_secrets_storage_4_schema_auth_10 @@ -749,7 +753,7 @@ batch: env: variables: TEST_SUITE: src/__tests__/containers-api-secrets.test.ts|src/__tests__/storage-4.test.ts|src/__tests__/schema-auth-10.test.ts - CLI_REGION: us-east-1 + CLI_REGION: us-east-2 depend-on: - upb - identifier: l_geo_multi_env_searchable_datastore_resolvers @@ -757,7 +761,7 @@ batch: env: variables: TEST_SUITE: src/__tests__/geo-multi-env.test.ts|src/__tests__/graphql-v2/searchable-datastore.test.ts|src/__tests__/resolvers.test.ts - CLI_REGION: ap-northeast-1 + CLI_REGION: us-east-1 depend-on: - upb - identifier: l_schema_key_api_5_apigw @@ -765,7 +769,7 @@ batch: env: variables: TEST_SUITE: src/__tests__/schema-key.test.ts|src/__tests__/api_5.test.ts|src/__tests__/apigw.test.ts - CLI_REGION: us-east-1 + CLI_REGION: ap-southeast-2 depend-on: - upb - identifier: l_api_lambda_auth_1_api_key_migration2_schema_searchable @@ -773,7 +777,7 @@ batch: env: variables: TEST_SUITE: src/__tests__/graphql-v2/api_lambda_auth_1.test.ts|src/__tests__/migration/api.key.migration2.test.ts|src/__tests__/schema-searchable.test.ts - CLI_REGION: eu-west-2 + CLI_REGION: ap-southeast-1 depend-on: - upb - identifier: l_api_key_migration1_schema_auth_14_api_3 @@ -781,7 +785,7 @@ batch: env: variables: TEST_SUITE: src/__tests__/migration/api.key.migration1.test.ts|src/__tests__/schema-auth-14.test.ts|src/__tests__/api_3.test.ts - CLI_REGION: ap-southeast-1 + CLI_REGION: us-west-2 depend-on: - upb - identifier: l_api_6b_api_1_layer_1 @@ -789,7 +793,7 @@ batch: env: variables: TEST_SUITE: src/__tests__/api_6b.test.ts|src/__tests__/api_1.test.ts|src/__tests__/layer-1.test.ts - CLI_REGION: ap-southeast-1 + CLI_REGION: us-east-2 depend-on: - upb - identifier: l_api_key_migration4_schema_iterative_update_4_function_1 @@ -797,7 +801,7 @@ batch: env: variables: TEST_SUITE: src/__tests__/migration/api.key.migration4.test.ts|src/__tests__/schema-iterative-update-4.test.ts|src/__tests__/function_1.test.ts - CLI_REGION: ap-southeast-2 + CLI_REGION: ap-northeast-1 depend-on: - upb - identifier: l_storage_5 @@ -815,7 +819,7 @@ batch: variables: compute-type: BUILD_GENERAL1_SMALL TEST_SUITE: src/__tests__/datastore-modelgen.test.ts - CLI_REGION: eu-west-2 + CLI_REGION: us-east-1 DISABLE_COVERAGE: 1 depend-on: - upb @@ -825,7 +829,7 @@ batch: variables: compute-type: BUILD_GENERAL1_SMALL TEST_SUITE: src/__tests__/amplify-app.test.ts - CLI_REGION: us-east-1 + CLI_REGION: us-east-2 DISABLE_COVERAGE: 1 depend-on: - upb @@ -835,7 +839,7 @@ batch: variables: compute-type: BUILD_GENERAL1_SMALL TEST_SUITE: src/__tests__/auth_2c.test.ts - CLI_REGION: ap-southeast-1 + CLI_REGION: us-west-2 depend-on: - upb - identifier: l_auth_2e @@ -844,7 +848,7 @@ batch: variables: compute-type: BUILD_GENERAL1_SMALL TEST_SUITE: src/__tests__/auth_2e.test.ts - CLI_REGION: ap-southeast-1 + CLI_REGION: eu-west-2 depend-on: - upb - identifier: l_uibuilder @@ -853,7 +857,7 @@ batch: variables: compute-type: BUILD_GENERAL1_SMALL TEST_SUITE: src/__tests__/uibuilder.test.ts - CLI_REGION: ap-southeast-2 + CLI_REGION: eu-central-1 depend-on: - upb - identifier: l_geo_remove_3 @@ -862,7 +866,7 @@ batch: variables: compute-type: BUILD_GENERAL1_SMALL TEST_SUITE: src/__tests__/geo-remove-3.test.ts - CLI_REGION: ap-northeast-1 + CLI_REGION: us-east-2 depend-on: - upb - identifier: l_geo_add_f @@ -871,7 +875,7 @@ batch: variables: compute-type: BUILD_GENERAL1_SMALL TEST_SUITE: src/__tests__/geo-add-f.test.ts - CLI_REGION: us-west-2 + CLI_REGION: us-east-1 depend-on: - upb - identifier: l_geo_add_e @@ -880,7 +884,7 @@ batch: variables: compute-type: BUILD_GENERAL1_SMALL TEST_SUITE: src/__tests__/geo-add-e.test.ts - CLI_REGION: ap-northeast-1 + CLI_REGION: ap-southeast-1 depend-on: - upb - identifier: l_import_dynamodb_2c @@ -889,7 +893,7 @@ batch: variables: compute-type: BUILD_GENERAL1_SMALL TEST_SUITE: src/__tests__/import_dynamodb_2c.test.ts - CLI_REGION: eu-west-2 + CLI_REGION: ap-southeast-2 depend-on: - upb - identifier: l_env_3 @@ -907,7 +911,7 @@ batch: variables: compute-type: BUILD_GENERAL1_SMALL TEST_SUITE: src/__tests__/geo-remove-2.test.ts - CLI_REGION: ap-southeast-1 + CLI_REGION: eu-central-1 depend-on: - upb - identifier: l_notifications_in_app_messaging @@ -916,7 +920,7 @@ batch: variables: compute-type: BUILD_GENERAL1_SMALL TEST_SUITE: src/__tests__/notifications-in-app-messaging.test.ts - CLI_REGION: us-west-2 + CLI_REGION: us-east-2 depend-on: - upb - identifier: l_import_auth_2a @@ -934,7 +938,7 @@ batch: variables: compute-type: BUILD_GENERAL1_SMALL TEST_SUITE: src/__tests__/import_auth_1a.test.ts - CLI_REGION: us-east-1 + CLI_REGION: eu-west-2 depend-on: - upb - identifier: l_import_auth_2b @@ -943,7 +947,7 @@ batch: variables: compute-type: BUILD_GENERAL1_SMALL TEST_SUITE: src/__tests__/import_auth_2b.test.ts - CLI_REGION: ap-southeast-2 + CLI_REGION: us-east-2 depend-on: - upb - identifier: l_import_s3_2a @@ -961,7 +965,7 @@ batch: variables: compute-type: BUILD_GENERAL1_SMALL TEST_SUITE: src/__tests__/import_s3_2c.test.ts - CLI_REGION: eu-west-2 + CLI_REGION: us-east-2 depend-on: - upb - identifier: l_import_auth_1b @@ -970,7 +974,7 @@ batch: variables: compute-type: BUILD_GENERAL1_SMALL TEST_SUITE: src/__tests__/import_auth_1b.test.ts - CLI_REGION: ap-northeast-1 + CLI_REGION: ap-southeast-2 depend-on: - upb - identifier: l_schema_auth_11_a @@ -979,7 +983,7 @@ batch: variables: compute-type: BUILD_GENERAL1_SMALL TEST_SUITE: src/__tests__/schema-auth-11-a.test.ts - CLI_REGION: us-east-2 + CLI_REGION: ap-southeast-1 depend-on: - upb - identifier: l_geo_update_1 @@ -988,7 +992,7 @@ batch: variables: compute-type: BUILD_GENERAL1_SMALL TEST_SUITE: src/__tests__/geo-update-1.test.ts - CLI_REGION: ap-southeast-2 + CLI_REGION: us-east-1 depend-on: - upb - identifier: l_geo_update_2 @@ -997,7 +1001,7 @@ batch: variables: compute-type: BUILD_GENERAL1_SMALL TEST_SUITE: src/__tests__/geo-update-2.test.ts - CLI_REGION: ap-southeast-1 + CLI_REGION: ap-southeast-2 depend-on: - upb - identifier: l_import_s3_3 @@ -1006,7 +1010,7 @@ batch: variables: compute-type: BUILD_GENERAL1_SMALL TEST_SUITE: src/__tests__/import_s3_3.test.ts - CLI_REGION: us-west-2 + CLI_REGION: eu-west-2 depend-on: - upb - identifier: l_import_dynamodb_2b @@ -1015,7 +1019,7 @@ batch: variables: compute-type: BUILD_GENERAL1_SMALL TEST_SUITE: src/__tests__/import_dynamodb_2b.test.ts - CLI_REGION: us-west-2 + CLI_REGION: ap-southeast-2 depend-on: - upb - identifier: l_hostingPROD @@ -1024,7 +1028,7 @@ batch: variables: compute-type: BUILD_GENERAL1_SMALL TEST_SUITE: src/__tests__/hostingPROD.test.ts - CLI_REGION: eu-west-2 + CLI_REGION: us-west-2 depend-on: - upb - identifier: l_import_s3_2b @@ -1033,7 +1037,7 @@ batch: variables: compute-type: BUILD_GENERAL1_SMALL TEST_SUITE: src/__tests__/import_s3_2b.test.ts - CLI_REGION: ap-southeast-1 + CLI_REGION: eu-west-2 depend-on: - upb - identifier: l_containers_api_1 @@ -1042,7 +1046,7 @@ batch: variables: compute-type: BUILD_GENERAL1_SMALL TEST_SUITE: src/__tests__/containers-api-1.test.ts - CLI_REGION: ap-southeast-2 + CLI_REGION: eu-west-2 depend-on: - upb - identifier: l_schema_auth_15 @@ -1051,7 +1055,7 @@ batch: variables: compute-type: BUILD_GENERAL1_SMALL TEST_SUITE: src/__tests__/schema-auth-15.test.ts - CLI_REGION: us-west-2 + CLI_REGION: eu-central-1 depend-on: - upb - identifier: l_schema_connection_1 @@ -1060,7 +1064,7 @@ batch: variables: compute-type: BUILD_GENERAL1_SMALL TEST_SUITE: src/__tests__/schema-connection-1.test.ts - CLI_REGION: ap-northeast-1 + CLI_REGION: eu-west-2 depend-on: - upb - identifier: l_import_auth_3 @@ -1069,7 +1073,7 @@ batch: variables: compute-type: BUILD_GENERAL1_SMALL TEST_SUITE: src/__tests__/import_auth_3.test.ts - CLI_REGION: eu-central-1 + CLI_REGION: ap-southeast-1 depend-on: - upb - identifier: l_import_dynamodb_2a @@ -1078,7 +1082,7 @@ batch: variables: compute-type: BUILD_GENERAL1_SMALL TEST_SUITE: src/__tests__/import_dynamodb_2a.test.ts - CLI_REGION: eu-west-2 + CLI_REGION: ap-southeast-2 depend-on: - upb - identifier: l_containers_api_2 @@ -1087,7 +1091,7 @@ batch: variables: compute-type: BUILD_GENERAL1_SMALL TEST_SUITE: src/__tests__/containers-api-2.test.ts - CLI_REGION: eu-west-2 + CLI_REGION: ap-northeast-1 depend-on: - upb - identifier: l_import_s3_1 @@ -1096,7 +1100,7 @@ batch: variables: compute-type: BUILD_GENERAL1_SMALL TEST_SUITE: src/__tests__/import_s3_1.test.ts - CLI_REGION: eu-central-1 + CLI_REGION: ap-southeast-1 USE_PARENT_ACCOUNT: 1 depend-on: - upb @@ -1106,7 +1110,7 @@ batch: variables: compute-type: BUILD_GENERAL1_SMALL TEST_SUITE: src/__tests__/transformer-migrations/searchable-migration.test.ts - CLI_REGION: us-east-2 + CLI_REGION: us-east-1 USE_PARENT_ACCOUNT: 1 depend-on: - upb @@ -1116,7 +1120,7 @@ batch: variables: compute-type: BUILD_GENERAL1_SMALL TEST_SUITE: src/__tests__/geo-remove-1.test.ts - CLI_REGION: us-west-2 + CLI_REGION: ap-northeast-1 depend-on: - upb - identifier: l_import_dynamodb_1 @@ -1125,7 +1129,7 @@ batch: variables: compute-type: BUILD_GENERAL1_SMALL TEST_SUITE: src/__tests__/import_dynamodb_1.test.ts - CLI_REGION: eu-central-1 + CLI_REGION: eu-west-2 USE_PARENT_ACCOUNT: 1 depend-on: - upb @@ -1136,7 +1140,7 @@ batch: image: $WINDOWS_IMAGE_2019 variables: TEST_SUITE: src/__tests__/analytics-kinesis.test.ts|src/__tests__/analytics-pinpoint-flutter.test.ts|src/__tests__/analytics-pinpoint-js.test.ts - CLI_REGION: ap-southeast-2 + CLI_REGION: eu-west-2 depend-on: - build_windows - upb @@ -1147,7 +1151,7 @@ batch: image: $WINDOWS_IMAGE_2019 variables: TEST_SUITE: src/__tests__/auth_2a.test.ts|src/__tests__/auth_2b.test.ts|src/__tests__/auth_2d.test.ts - CLI_REGION: eu-west-2 + CLI_REGION: ap-southeast-2 depend-on: - build_windows - upb @@ -1158,7 +1162,7 @@ batch: image: $WINDOWS_IMAGE_2019 variables: TEST_SUITE: src/__tests__/auth_2f.test.ts|src/__tests__/notifications-lifecycle.test.ts|src/__tests__/notifications-analytics-compatibility-in-app-1.test.ts - CLI_REGION: us-east-2 + CLI_REGION: us-east-1 depend-on: - build_windows - upb @@ -1169,7 +1173,7 @@ batch: image: $WINDOWS_IMAGE_2019 variables: TEST_SUITE: src/__tests__/notifications-analytics-compatibility-sms-2.test.ts|src/__tests__/analytics-2.test.ts|src/__tests__/global_sandbox-c.test.ts - CLI_REGION: eu-central-1 + CLI_REGION: us-east-2 depend-on: - build_windows - upb @@ -1191,7 +1195,7 @@ batch: image: $WINDOWS_IMAGE_2019 variables: TEST_SUITE: src/__tests__/studio-modelgen.test.ts|src/__tests__/graphql-v2/custom-transformers.test.ts|src/__tests__/notifications-in-app-messaging-env-1.test.ts - CLI_REGION: ap-southeast-2 + CLI_REGION: eu-central-1 depend-on: - build_windows - upb @@ -1202,7 +1206,7 @@ batch: image: $WINDOWS_IMAGE_2019 variables: TEST_SUITE: src/__tests__/notifications-sms-pull.test.ts|src/__tests__/auth_10.test.ts|src/__tests__/container-hosting.test.ts - CLI_REGION: eu-central-1 + CLI_REGION: ap-southeast-2 depend-on: - build_windows - upb @@ -1213,7 +1217,7 @@ batch: image: $WINDOWS_IMAGE_2019 variables: TEST_SUITE: src/__tests__/init_b.test.ts|src/__tests__/notifications-apns.test.ts|src/__tests__/notifications-fcm.test.ts - CLI_REGION: us-west-2 + CLI_REGION: us-east-1 depend-on: - build_windows - upb @@ -1224,7 +1228,7 @@ batch: image: $WINDOWS_IMAGE_2019 variables: TEST_SUITE: src/__tests__/notifications-in-app-messaging-env-2.test.ts|src/__tests__/with-babel-config.test.ts|src/__tests__/amplify-configure.test.ts - CLI_REGION: eu-west-2 + CLI_REGION: us-east-2 depend-on: - build_windows - upb @@ -1235,7 +1239,7 @@ batch: image: $WINDOWS_IMAGE_2019 variables: TEST_SUITE: src/__tests__/init_d.test.ts|src/__tests__/init_f.test.ts|src/__tests__/auth_5d.test.ts - CLI_REGION: ap-southeast-2 + CLI_REGION: ap-northeast-1 depend-on: - build_windows - upb @@ -1246,7 +1250,7 @@ batch: image: $WINDOWS_IMAGE_2019 variables: TEST_SUITE: src/__tests__/configure-project.test.ts|src/__tests__/init_c.test.ts|src/__tests__/layer-4.test.ts - CLI_REGION: us-east-2 + CLI_REGION: ap-southeast-2 depend-on: - build_windows - upb @@ -1268,7 +1272,7 @@ batch: image: $WINDOWS_IMAGE_2019 variables: TEST_SUITE: src/__tests__/tags.test.ts|src/__tests__/auth_1a.test.ts|src/__tests__/auth-trigger.test.ts - CLI_REGION: eu-central-1 + CLI_REGION: us-east-2 depend-on: - build_windows - upb @@ -1279,7 +1283,7 @@ batch: image: $WINDOWS_IMAGE_2019 variables: TEST_SUITE: src/__tests__/custom_policies_function.test.ts|src/__tests__/storage-2.test.ts|src/__tests__/iam-permissions-boundary.test.ts - CLI_REGION: ap-southeast-2 + CLI_REGION: ap-southeast-1 depend-on: - build_windows - upb @@ -1290,7 +1294,7 @@ batch: image: $WINDOWS_IMAGE_2019 variables: TEST_SUITE: src/__tests__/migration/node.function.test.ts|src/__tests__/notifications-sms.test.ts|src/__tests__/schema-auth-4b.test.ts - CLI_REGION: ap-northeast-1 + CLI_REGION: us-east-1 depend-on: - build_windows - upb @@ -1301,7 +1305,7 @@ batch: image: $WINDOWS_IMAGE_2019 variables: TEST_SUITE: src/__tests__/schema-model-e.test.ts|src/__tests__/schema-versioned.test.ts|src/__tests__/auth_1c.test.ts - CLI_REGION: ap-southeast-1 + CLI_REGION: us-east-2 depend-on: - build_windows - upb @@ -1312,7 +1316,7 @@ batch: image: $WINDOWS_IMAGE_2019 variables: TEST_SUITE: src/__tests__/auth_5e.test.ts|src/__tests__/auth_8b.test.ts|src/__tests__/geo-add-b.test.ts - CLI_REGION: eu-west-2 + CLI_REGION: us-east-1 depend-on: - build_windows - upb @@ -1323,7 +1327,7 @@ batch: image: $WINDOWS_IMAGE_2019 variables: TEST_SUITE: src/__tests__/s3-sse.test.ts|src/__tests__/schema-auth-4a.test.ts|src/__tests__/schema-model-b.test.ts - CLI_REGION: ap-southeast-2 + CLI_REGION: eu-central-1 depend-on: - build_windows - upb @@ -1334,7 +1338,7 @@ batch: image: $WINDOWS_IMAGE_2019 variables: TEST_SUITE: src/__tests__/schema-model-d.test.ts|src/__tests__/auth_5f.test.ts|src/__tests__/env-4.test.ts - CLI_REGION: ap-southeast-2 + CLI_REGION: us-east-2 depend-on: - build_windows - upb @@ -1345,7 +1349,7 @@ batch: image: $WINDOWS_IMAGE_2019 variables: TEST_SUITE: src/__tests__/frontend_config_drift.test.ts|src/__tests__/schema-auth-4d.test.ts|src/__tests__/schema-auth-6a.test.ts - CLI_REGION: eu-central-1 + CLI_REGION: us-east-1 depend-on: - build_windows - upb @@ -1356,7 +1360,7 @@ batch: image: $WINDOWS_IMAGE_2019 variables: TEST_SUITE: src/__tests__/schema-data-access-patterns.test.ts|src/__tests__/schema-model-c.test.ts|src/__tests__/schema-predictions.test.ts - CLI_REGION: ap-southeast-1 + CLI_REGION: us-west-2 depend-on: - build_windows - upb @@ -1367,7 +1371,7 @@ batch: image: $WINDOWS_IMAGE_2019 variables: TEST_SUITE: src/__tests__/transformer-migrations/model-migration.test.ts|src/__tests__/auth_3c.test.ts|src/__tests__/auth_4c.test.ts - CLI_REGION: us-west-2 + CLI_REGION: us-east-1 depend-on: - build_windows - upb @@ -1378,7 +1382,7 @@ batch: image: $WINDOWS_IMAGE_2019 variables: TEST_SUITE: src/__tests__/auth_5a.test.ts|src/__tests__/auth_5c.test.ts|src/__tests__/env-1.test.ts - CLI_REGION: eu-central-1 + CLI_REGION: ap-southeast-1 depend-on: - build_windows - upb @@ -1389,7 +1393,7 @@ batch: image: $WINDOWS_IMAGE_2019 variables: TEST_SUITE: src/__tests__/geo-add-a.test.ts|src/__tests__/init_a.test.ts|src/__tests__/schema-auth-4c.test.ts - CLI_REGION: us-east-2 + CLI_REGION: ap-northeast-1 depend-on: - build_windows - upb @@ -1411,7 +1415,7 @@ batch: image: $WINDOWS_IMAGE_2019 variables: TEST_SUITE: src/__tests__/env-5.test.ts|src/__tests__/function_10.test.ts|src/__tests__/function_9c.test.ts - CLI_REGION: ap-southeast-1 + CLI_REGION: ap-southeast-2 depend-on: - build_windows - upb @@ -1422,7 +1426,7 @@ batch: image: $WINDOWS_IMAGE_2019 variables: TEST_SUITE: src/__tests__/function-permissions.test.ts|src/__tests__/geo-import-1a.test.ts|src/__tests__/geo-import-2.test.ts - CLI_REGION: us-east-2 + CLI_REGION: us-east-1 depend-on: - build_windows - upb @@ -1433,7 +1437,7 @@ batch: image: $WINDOWS_IMAGE_2019 variables: TEST_SUITE: src/__tests__/global_sandbox-b.test.ts|src/__tests__/schema-auth-5d.test.ts|src/__tests__/schema-auth-6b.test.ts - CLI_REGION: us-east-2 + CLI_REGION: us-west-2 depend-on: - build_windows - upb @@ -1444,7 +1448,7 @@ batch: image: $WINDOWS_IMAGE_2019 variables: TEST_SUITE: src/__tests__/schema-auth-8c.test.ts|src/__tests__/auth_3a.test.ts|src/__tests__/auth_3b.test.ts - CLI_REGION: ap-northeast-1 + CLI_REGION: ap-southeast-2 depend-on: - build_windows - upb @@ -1455,7 +1459,7 @@ batch: image: $WINDOWS_IMAGE_2019 variables: TEST_SUITE: src/__tests__/auth_4a.test.ts|src/__tests__/auth_7a.test.ts|src/__tests__/auth_8c.test.ts - CLI_REGION: eu-central-1 + CLI_REGION: us-east-1 depend-on: - build_windows - upb @@ -1466,7 +1470,7 @@ batch: image: $WINDOWS_IMAGE_2019 variables: TEST_SUITE: src/__tests__/feature-flags.test.ts|src/__tests__/geo-import-1b.test.ts|src/__tests__/global_sandbox-a.test.ts - CLI_REGION: eu-west-2 + CLI_REGION: us-west-2 depend-on: - build_windows - upb @@ -1477,7 +1481,7 @@ batch: image: $WINDOWS_IMAGE_2019 variables: TEST_SUITE: src/__tests__/init_e.test.ts|src/__tests__/notifications-analytics-compatibility-in-app-2.test.ts|src/__tests__/schema-auth-11-c.test.ts - CLI_REGION: us-east-2 + CLI_REGION: eu-central-1 depend-on: - build_windows - upb @@ -1488,7 +1492,7 @@ batch: image: $WINDOWS_IMAGE_2019 variables: TEST_SUITE: src/__tests__/schema-auth-2b.test.ts|src/__tests__/schema-auth-6c.test.ts|src/__tests__/schema-auth-6d.test.ts - CLI_REGION: eu-west-2 + CLI_REGION: us-east-2 depend-on: - build_windows - upb @@ -1499,7 +1503,7 @@ batch: image: $WINDOWS_IMAGE_2019 variables: TEST_SUITE: src/__tests__/schema-auth-7c.test.ts|src/__tests__/schema-auth-8a.test.ts|src/__tests__/transformer-migrations/function-migration.test.ts - CLI_REGION: us-east-1 + CLI_REGION: us-east-2 depend-on: - build_windows - upb @@ -1510,7 +1514,7 @@ batch: image: $WINDOWS_IMAGE_2019 variables: TEST_SUITE: src/__tests__/api_10.test.ts|src/__tests__/api_7.test.ts|src/__tests__/export-pull-a.test.ts - CLI_REGION: eu-central-1 + CLI_REGION: ap-southeast-1 depend-on: - build_windows - upb @@ -1521,7 +1525,7 @@ batch: image: $WINDOWS_IMAGE_2019 variables: TEST_SUITE: src/__tests__/function_9a.test.ts|src/__tests__/geo-headless.test.ts|src/__tests__/migration/api.key.migration5.test.ts - CLI_REGION: eu-central-1 + CLI_REGION: ap-southeast-1 depend-on: - build_windows - upb @@ -1532,7 +1536,7 @@ batch: image: $WINDOWS_IMAGE_2019 variables: TEST_SUITE: src/__tests__/schema-auth-1a.test.ts|src/__tests__/schema-auth-5b.test.ts|src/__tests__/schema-auth-8b.test.ts - CLI_REGION: us-east-1 + CLI_REGION: eu-west-2 depend-on: - build_windows - upb @@ -1543,7 +1547,7 @@ batch: image: $WINDOWS_IMAGE_2019 variables: TEST_SUITE: src/__tests__/schema-auth-9-a.test.ts|src/__tests__/schema-auth-9-c.test.ts|src/__tests__/storage-3.test.ts - CLI_REGION: eu-west-2 + CLI_REGION: us-east-2 depend-on: - build_windows - upb @@ -1565,7 +1569,7 @@ batch: image: $WINDOWS_IMAGE_2019 variables: TEST_SUITE: src/__tests__/geo-add-c.test.ts|src/__tests__/geo-add-d.test.ts|src/__tests__/geo-import-3.test.ts - CLI_REGION: eu-west-2 + CLI_REGION: ap-northeast-1 depend-on: - build_windows - upb @@ -1576,7 +1580,7 @@ batch: image: $WINDOWS_IMAGE_2019 variables: TEST_SUITE: src/__tests__/hosting.test.ts|src/__tests__/layer-3.test.ts|src/__tests__/migration/api.connection.migration.test.ts - CLI_REGION: us-east-2 + CLI_REGION: ap-northeast-1 depend-on: - build_windows - upb @@ -1587,7 +1591,7 @@ batch: image: $WINDOWS_IMAGE_2019 variables: TEST_SUITE: src/__tests__/migration/api.key.migration3.test.ts|src/__tests__/predictions.test.ts|src/__tests__/schema-auth-11-b.test.ts - CLI_REGION: us-west-2 + CLI_REGION: eu-west-2 depend-on: - build_windows - upb @@ -1598,7 +1602,7 @@ batch: image: $WINDOWS_IMAGE_2019 variables: TEST_SUITE: src/__tests__/schema-auth-1b.test.ts|src/__tests__/schema-auth-2a.test.ts|src/__tests__/schema-auth-7a.test.ts - CLI_REGION: eu-central-1 + CLI_REGION: us-east-1 depend-on: - build_windows - upb @@ -1609,7 +1613,7 @@ batch: image: $WINDOWS_IMAGE_2019 variables: TEST_SUITE: src/__tests__/schema-auth-7b.test.ts|src/__tests__/schema-auth-9-b.test.ts|src/__tests__/transformer-migrations/predictions-migration.test.ts - CLI_REGION: ap-southeast-1 + CLI_REGION: ap-northeast-1 depend-on: - build_windows - upb @@ -1620,7 +1624,7 @@ batch: image: $WINDOWS_IMAGE_2019 variables: TEST_SUITE: src/__tests__/api_6a.test.ts|src/__tests__/auth_7b.test.ts|src/__tests__/export-pull-b.test.ts - CLI_REGION: ap-northeast-1 + CLI_REGION: eu-central-1 depend-on: - build_windows - upb @@ -1631,7 +1635,7 @@ batch: image: $WINDOWS_IMAGE_2019 variables: TEST_SUITE: src/__tests__/init-special-case.test.ts|src/__tests__/transformer-migrations/http-migration.test.ts|src/__tests__/schema-auth-12.test.ts - CLI_REGION: us-east-2 + CLI_REGION: eu-central-1 depend-on: - build_windows - upb @@ -1642,7 +1646,7 @@ batch: image: $WINDOWS_IMAGE_2019 variables: TEST_SUITE: src/__tests__/schema-auth-3.test.ts|src/__tests__/schema-function-2.test.ts|src/__tests__/auth_4b.test.ts - CLI_REGION: us-east-2 + CLI_REGION: us-west-2 depend-on: - build_windows - upb @@ -1653,7 +1657,7 @@ batch: image: $WINDOWS_IMAGE_2019 variables: TEST_SUITE: src/__tests__/auth_8a.test.ts|src/__tests__/export-pull-d.test.ts|src/__tests__/schema-auth-5a.test.ts - CLI_REGION: us-west-2 + CLI_REGION: ap-northeast-1 depend-on: - build_windows - upb @@ -1664,7 +1668,7 @@ batch: image: $WINDOWS_IMAGE_2019 variables: TEST_SUITE: src/__tests__/schema-iterative-update-3.test.ts|src/__tests__/transformer-migrations/auth-migration.test.ts|src/__tests__/api_2a.test.ts - CLI_REGION: ap-northeast-1 + CLI_REGION: us-east-2 depend-on: - build_windows - upb @@ -1675,7 +1679,7 @@ batch: image: $WINDOWS_IMAGE_2019 variables: TEST_SUITE: src/__tests__/api_2b.test.ts|src/__tests__/api_6c.test.ts|src/__tests__/api_9a.test.ts - CLI_REGION: ap-southeast-2 + CLI_REGION: ap-southeast-1 depend-on: - build_windows - upb @@ -1686,7 +1690,7 @@ batch: image: $WINDOWS_IMAGE_2019 variables: TEST_SUITE: src/__tests__/auth_2h.test.ts|src/__tests__/auth_5g.test.ts|src/__tests__/auth/hosted-ui.test.ts - CLI_REGION: us-west-2 + CLI_REGION: ap-northeast-1 depend-on: - build_windows - upb @@ -1697,7 +1701,7 @@ batch: image: $WINDOWS_IMAGE_2019 variables: TEST_SUITE: src/__tests__/auth/user-groups-s3-access.test.ts|src/__tests__/auth/user-groups.test.ts|src/__tests__/build-function.test.ts - CLI_REGION: eu-central-1 + CLI_REGION: us-east-1 depend-on: - build_windows - upb @@ -1708,7 +1712,7 @@ batch: image: $WINDOWS_IMAGE_2019 variables: TEST_SUITE: src/__tests__/dynamodb-simulator/dynamodb-simulator.test.ts|src/__tests__/export-pull-c.test.ts|src/__tests__/function_12.test.ts - CLI_REGION: ap-southeast-2 + CLI_REGION: us-east-1 depend-on: - build_windows - upb @@ -1719,7 +1723,7 @@ batch: image: $WINDOWS_IMAGE_2019 variables: TEST_SUITE: src/__tests__/function_13.test.ts|src/__tests__/function_14.test.ts|src/__tests__/function_2d.test.ts - CLI_REGION: ap-southeast-1 + CLI_REGION: us-west-2 depend-on: - build_windows - upb @@ -1730,7 +1734,7 @@ batch: image: $WINDOWS_IMAGE_2019 variables: TEST_SUITE: src/__tests__/general-config/general-config-headless-init.test.ts|src/__tests__/help.test.ts|src/__tests__/init-force-push.test.ts - CLI_REGION: us-east-2 + CLI_REGION: us-east-1 depend-on: - build_windows - upb @@ -1752,7 +1756,7 @@ batch: image: $WINDOWS_IMAGE_2019 variables: TEST_SUITE: src/__tests__/notifications-multi-env.test.ts|src/__tests__/notifications-sms-update.test.ts|src/__tests__/parameter-store-1.test.ts - CLI_REGION: ap-southeast-1 + CLI_REGION: us-west-2 depend-on: - build_windows - upb @@ -1763,7 +1767,7 @@ batch: image: $WINDOWS_IMAGE_2019 variables: TEST_SUITE: src/__tests__/parameter-store-2.test.ts|src/__tests__/push.test.ts|src/__tests__/api_8.test.ts - CLI_REGION: ap-northeast-1 + CLI_REGION: us-west-2 depend-on: - build_windows - upb @@ -1774,7 +1778,7 @@ batch: image: $WINDOWS_IMAGE_2019 variables: TEST_SUITE: src/__tests__/schema-iterative-update-locking.test.ts|src/__tests__/graphql-v2/api_lambda_auth_2.test.ts|src/__tests__/schema-auth-13.test.ts - CLI_REGION: us-east-1 + CLI_REGION: eu-central-1 depend-on: - build_windows - upb @@ -1785,7 +1789,7 @@ batch: image: $WINDOWS_IMAGE_2019 variables: TEST_SUITE: src/__tests__/function_5.test.ts|src/__tests__/schema-iterative-update-1.test.ts|src/__tests__/auth_6.test.ts - CLI_REGION: ap-southeast-1 + CLI_REGION: us-east-2 depend-on: - build_windows - upb @@ -1796,7 +1800,7 @@ batch: image: $WINDOWS_IMAGE_2019 variables: TEST_SUITE: src/__tests__/function_2a.test.ts|src/__tests__/schema-connection-2.test.ts|src/__tests__/schema-function-1.test.ts - CLI_REGION: us-west-2 + CLI_REGION: us-east-2 depend-on: - build_windows - upb @@ -1807,7 +1811,7 @@ batch: image: $WINDOWS_IMAGE_2019 variables: TEST_SUITE: src/__tests__/api_9b.test.ts|src/__tests__/custom_policies_container.test.ts|src/__tests__/function_9b.test.ts - CLI_REGION: ap-northeast-1 + CLI_REGION: us-east-2 depend-on: - build_windows - upb @@ -1818,7 +1822,7 @@ batch: image: $WINDOWS_IMAGE_2019 variables: TEST_SUITE: src/__tests__/schema-iterative-update-2.test.ts|src/__tests__/storage-1a.test.ts|src/__tests__/storage-1b.test.ts - CLI_REGION: eu-central-1 + CLI_REGION: us-west-2 depend-on: - build_windows - upb @@ -1829,7 +1833,7 @@ batch: image: $WINDOWS_IMAGE_2019 variables: TEST_SUITE: src/__tests__/function_11.test.ts|src/__tests__/function_2b.test.ts|src/__tests__/migration/api.connection.migration2.test.ts - CLI_REGION: us-west-2 + CLI_REGION: eu-central-1 depend-on: - build_windows - upb @@ -1840,7 +1844,7 @@ batch: image: $WINDOWS_IMAGE_2019 variables: TEST_SUITE: src/__tests__/api_4.test.ts|src/__tests__/containers-api-secrets.test.ts|src/__tests__/storage-4.test.ts - CLI_REGION: eu-central-1 + CLI_REGION: ap-northeast-1 depend-on: - build_windows - upb @@ -1851,7 +1855,7 @@ batch: image: $WINDOWS_IMAGE_2019 variables: TEST_SUITE: src/__tests__/schema-auth-10.test.ts|src/__tests__/geo-multi-env.test.ts|src/__tests__/graphql-v2/searchable-datastore.test.ts - CLI_REGION: us-east-1 + CLI_REGION: ap-northeast-1 depend-on: - build_windows - upb @@ -1862,7 +1866,7 @@ batch: image: $WINDOWS_IMAGE_2019 variables: TEST_SUITE: src/__tests__/resolvers.test.ts|src/__tests__/schema-key.test.ts|src/__tests__/api_5.test.ts - CLI_REGION: ap-southeast-1 + CLI_REGION: eu-west-2 depend-on: - build_windows - upb @@ -1873,7 +1877,7 @@ batch: image: $WINDOWS_IMAGE_2019 variables: TEST_SUITE: src/__tests__/apigw.test.ts|src/__tests__/graphql-v2/api_lambda_auth_1.test.ts|src/__tests__/migration/api.key.migration2.test.ts - CLI_REGION: eu-central-1 + CLI_REGION: ap-southeast-1 depend-on: - build_windows - upb @@ -1884,7 +1888,7 @@ batch: image: $WINDOWS_IMAGE_2019 variables: TEST_SUITE: src/__tests__/schema-searchable.test.ts|src/__tests__/migration/api.key.migration1.test.ts|src/__tests__/schema-auth-14.test.ts - CLI_REGION: us-east-2 + CLI_REGION: ap-northeast-1 depend-on: - build_windows - upb @@ -1895,7 +1899,7 @@ batch: image: $WINDOWS_IMAGE_2019 variables: TEST_SUITE: src/__tests__/api_3.test.ts|src/__tests__/api_6b.test.ts|src/__tests__/api_1.test.ts - CLI_REGION: ap-southeast-2 + CLI_REGION: us-east-2 depend-on: - build_windows - upb @@ -1906,7 +1910,7 @@ batch: image: $WINDOWS_IMAGE_2019 variables: TEST_SUITE: src/__tests__/layer-1.test.ts|src/__tests__/migration/api.key.migration4.test.ts|src/__tests__/schema-iterative-update-4.test.ts - CLI_REGION: ap-southeast-1 + CLI_REGION: ap-northeast-1 depend-on: - build_windows - upb @@ -1928,7 +1932,7 @@ batch: image: $WINDOWS_IMAGE_2019 variables: TEST_SUITE: src/__tests__/auth_2c.test.ts - CLI_REGION: ap-southeast-2 + CLI_REGION: us-west-2 depend-on: - build_windows - upb @@ -1939,7 +1943,7 @@ batch: image: $WINDOWS_IMAGE_2019 variables: TEST_SUITE: src/__tests__/auth_2e.test.ts - CLI_REGION: us-west-2 + CLI_REGION: ap-northeast-1 depend-on: - build_windows - upb @@ -1950,7 +1954,7 @@ batch: image: $WINDOWS_IMAGE_2019 variables: TEST_SUITE: src/__tests__/env-3.test.ts - CLI_REGION: us-east-1 + CLI_REGION: us-west-2 depend-on: - build_windows - upb @@ -1961,7 +1965,7 @@ batch: image: $WINDOWS_IMAGE_2019 variables: TEST_SUITE: src/__tests__/notifications-in-app-messaging.test.ts - CLI_REGION: eu-west-2 + CLI_REGION: us-east-2 depend-on: - build_windows - upb @@ -1972,7 +1976,7 @@ batch: image: $WINDOWS_IMAGE_2019 variables: TEST_SUITE: src/__tests__/schema-auth-11-a.test.ts - CLI_REGION: ap-southeast-2 + CLI_REGION: eu-west-2 depend-on: - build_windows - upb @@ -1983,7 +1987,7 @@ batch: image: $WINDOWS_IMAGE_2019 variables: TEST_SUITE: src/__tests__/import_s3_3.test.ts - CLI_REGION: ap-southeast-2 + CLI_REGION: ap-southeast-1 depend-on: - build_windows - upb @@ -2005,7 +2009,7 @@ batch: image: $WINDOWS_IMAGE_2019 variables: TEST_SUITE: src/__tests__/containers-api-1.test.ts - CLI_REGION: ap-southeast-2 + CLI_REGION: ap-southeast-1 depend-on: - build_windows - upb @@ -2049,7 +2053,7 @@ batch: image: $WINDOWS_IMAGE_2019 variables: TEST_SUITE: src/__tests__/import_s3_1.test.ts - CLI_REGION: ap-southeast-2 + CLI_REGION: us-west-2 USE_PARENT_ACCOUNT: 1 depend-on: - build_windows @@ -2061,7 +2065,7 @@ batch: image: $WINDOWS_IMAGE_2019 variables: TEST_SUITE: src/__tests__/transformer-migrations/searchable-migration.test.ts - CLI_REGION: us-west-2 + CLI_REGION: eu-central-1 USE_PARENT_ACCOUNT: 1 depend-on: - build_windows @@ -2073,7 +2077,7 @@ batch: image: $WINDOWS_IMAGE_2019 variables: TEST_SUITE: src/__tests__/geo-remove-1.test.ts - CLI_REGION: ap-southeast-2 + CLI_REGION: eu-central-1 depend-on: - build_windows - upb @@ -2084,7 +2088,7 @@ batch: image: $WINDOWS_IMAGE_2019 variables: TEST_SUITE: src/__tests__/import_dynamodb_1.test.ts - CLI_REGION: ap-southeast-1 + CLI_REGION: us-west-2 USE_PARENT_ACCOUNT: 1 depend-on: - build_windows @@ -2095,7 +2099,7 @@ batch: variables: compute-type: BUILD_GENERAL1_SMALL TEST_SUITE: src/__tests__/migration_tests/notifications-migration/notifications-migration-4.test.ts - CLI_REGION: us-east-1 + CLI_REGION: ap-southeast-2 depend-on: - upb - identifier: l_api_key_migration_v8 @@ -2104,7 +2108,7 @@ batch: variables: compute-type: BUILD_GENERAL1_SMALL TEST_SUITE: src/__tests__/migration_tests/transformer_migration/api.key.migration.test.ts - CLI_REGION: eu-central-1 + CLI_REGION: us-east-2 depend-on: - upb - identifier: l_notifications_migration_v8 @@ -2113,7 +2117,7 @@ batch: variables: compute-type: BUILD_GENERAL1_SMALL TEST_SUITE: src/__tests__/migration_tests/notifications-migration/notifications-migration.test.ts - CLI_REGION: us-west-2 + CLI_REGION: eu-central-1 depend-on: - upb - identifier: l_api_key_migration_2_v8 @@ -2140,7 +2144,7 @@ batch: variables: compute-type: BUILD_GENERAL1_SMALL TEST_SUITE: src/__tests__/update_tests/function_migration_update.test.ts - CLI_REGION: ap-northeast-1 + CLI_REGION: eu-west-2 depend-on: - upb - identifier: l_notifications_migration_3_v8 @@ -2149,7 +2153,7 @@ batch: variables: compute-type: BUILD_GENERAL1_SMALL TEST_SUITE: src/__tests__/migration_tests/notifications-migration/notifications-migration-3.test.ts - CLI_REGION: eu-central-1 + CLI_REGION: ap-southeast-2 depend-on: - upb - identifier: l_scaffold_v10 @@ -2158,7 +2162,7 @@ batch: variables: compute-type: BUILD_GENERAL1_SMALL TEST_SUITE: src/__tests__/migration_tests_v10/scaffold.test.ts - CLI_REGION: ap-northeast-1 + CLI_REGION: ap-southeast-2 depend-on: - upb - identifier: l_api_graphql_v2_migration_v10 @@ -2167,7 +2171,7 @@ batch: variables: compute-type: BUILD_GENERAL1_SMALL TEST_SUITE: src/__tests__/migration_tests_v10/api-graphql-v2.migration.test.ts - CLI_REGION: ap-northeast-1 + CLI_REGION: eu-central-1 depend-on: - upb - identifier: l_api_rest_basic_migration_v10 @@ -2176,7 +2180,7 @@ batch: variables: compute-type: BUILD_GENERAL1_SMALL TEST_SUITE: src/__tests__/migration_tests_v10/api-rest-basic.migration.test.ts - CLI_REGION: ap-southeast-1 + CLI_REGION: us-east-1 depend-on: - upb - identifier: l_api_rest_lambda_migration_v10 @@ -2185,7 +2189,7 @@ batch: variables: compute-type: BUILD_GENERAL1_SMALL TEST_SUITE: src/__tests__/migration_tests_v10/api-rest-lambda.migration.test.ts - CLI_REGION: ap-southeast-1 + CLI_REGION: us-east-1 depend-on: - upb - identifier: l_api_rest_serverless_migration_v10 @@ -2194,7 +2198,7 @@ batch: variables: compute-type: BUILD_GENERAL1_SMALL TEST_SUITE: src/__tests__/migration_tests_v10/api-rest-serverless.migration.test.ts - CLI_REGION: eu-central-1 + CLI_REGION: us-east-1 depend-on: - upb - identifier: l_auth_add_all_migration_v10 @@ -2203,7 +2207,7 @@ batch: variables: compute-type: BUILD_GENERAL1_SMALL TEST_SUITE: src/__tests__/migration_tests_v10/auth-add-all.migration.test.ts - CLI_REGION: eu-central-1 + CLI_REGION: us-east-2 depend-on: - upb - identifier: l_auth_override_migration_v10 @@ -2212,7 +2216,7 @@ batch: variables: compute-type: BUILD_GENERAL1_SMALL TEST_SUITE: src/__tests__/migration_tests_v10/auth-override.migration.test.ts - CLI_REGION: us-east-1 + CLI_REGION: ap-southeast-1 depend-on: - upb - identifier: l_custom_stack_migration_v10 @@ -2221,7 +2225,7 @@ batch: variables: compute-type: BUILD_GENERAL1_SMALL TEST_SUITE: src/__tests__/migration_tests_v10/custom-stack.migration.test.ts - CLI_REGION: us-east-2 + CLI_REGION: eu-central-1 depend-on: - upb - identifier: l_geo_migration_v10 @@ -2230,7 +2234,7 @@ batch: variables: compute-type: BUILD_GENERAL1_SMALL TEST_SUITE: src/__tests__/migration_tests_v10/geo.migration.test.ts - CLI_REGION: eu-central-1 + CLI_REGION: us-east-2 depend-on: - upb - identifier: l_git_clone_migration_tests_v10 @@ -2239,7 +2243,7 @@ batch: variables: compute-type: BUILD_GENERAL1_SMALL TEST_SUITE: src/__tests__/migration_tests_v10/git-clone-migration-tests.test.ts - CLI_REGION: us-west-2 + CLI_REGION: eu-west-2 depend-on: - upb - identifier: l_pinpoint_region_migration_v10 @@ -2257,7 +2261,7 @@ batch: variables: compute-type: BUILD_GENERAL1_SMALL TEST_SUITE: src/__tests__/migration_tests_v10/storage.migration.test.ts - CLI_REGION: ap-southeast-2 + CLI_REGION: us-west-2 depend-on: - upb - identifier: l_auth_app_client_secret_migration_v12 @@ -2266,7 +2270,7 @@ batch: variables: compute-type: BUILD_GENERAL1_SMALL TEST_SUITE: src/__tests__/migration_tests_v12/auth-app-client-secret-migration.test.ts - CLI_REGION: eu-central-1 + CLI_REGION: ap-southeast-2 depend-on: - upb - identifier: l_auth_hosted_ui_lambda_migration_v12 @@ -2275,7 +2279,7 @@ batch: variables: compute-type: BUILD_GENERAL1_SMALL TEST_SUITE: src/__tests__/migration_tests_v12/auth-hosted-ui-lambda-migration.test.ts - CLI_REGION: ap-northeast-1 + CLI_REGION: ap-southeast-2 depend-on: - upb - identifier: l_auth_lambda_callout_migration_rollback_v12 @@ -2284,7 +2288,7 @@ batch: variables: compute-type: BUILD_GENERAL1_SMALL TEST_SUITE: src/__tests__/migration_tests_v12/auth-lambda-callout-migration-rollback.test.ts - CLI_REGION: eu-central-1 + CLI_REGION: ap-southeast-2 depend-on: - upb - identifier: l_auth_lambda_callout_migration_v12 @@ -2293,7 +2297,7 @@ batch: variables: compute-type: BUILD_GENERAL1_SMALL TEST_SUITE: src/__tests__/migration_tests_v12/auth-lambda-callout-migration.test.ts - CLI_REGION: ap-northeast-1 + CLI_REGION: us-east-2 depend-on: - upb - identifier: l_auth_oauth_lambda_migration_v12 diff --git a/packages/amplify-e2e-tests/src/cleanup-codebuild-resources.ts b/packages/amplify-e2e-tests/src/cleanup-codebuild-resources.ts new file mode 100644 index 00000000000..1fa65980c8d --- /dev/null +++ b/packages/amplify-e2e-tests/src/cleanup-codebuild-resources.ts @@ -0,0 +1,1066 @@ +import { + Amplify, + AppSync, + CloudFormation, + CodeBuild, + CognitoIdentityServiceProvider, + IAM, + Organizations, + Pinpoint, + S3, + STS, +} from 'aws-sdk'; +import fs from 'fs-extra'; +import _ from 'lodash'; +import path from 'path'; + +const AWS_REGIONS_TO_RUN_TESTS = [ + 'us-east-1', + 'us-east-2', + 'us-west-2', + 'eu-west-2', + 'eu-central-1', + 'ap-northeast-1', + 'ap-southeast-1', + 'ap-southeast-2', +]; + +const AWS_REGIONS_TO_RUN_TESTS_PINPOINT = AWS_REGIONS_TO_RUN_TESTS.filter((region) => region !== 'eu-west-3'); + +// Limits are enforced per region +// we collect resources from each region & then delete as an entire batch +const DELETE_LIMITS = { + PER_REGION: { + OTHER: 25, + CFN_STACK: 50, + }, + PER_BATCH: { + OTHER: 50, + CFN_STACK: 100, + }, +}; + +const reportPath = path.normalize(path.join(__dirname, '..', 'amplify-e2e-reports', 'stale-resources.json')); + +const MULTI_JOB_APP = ''; +const ORPHAN = ''; +const UNKNOWN = ''; + +type StackInfo = { + stackName: string; + stackStatus: string; + resourcesFailedToDelete?: string[]; + tags: Record; + region: string; + cbInfo?: CodeBuild.Build; +}; + +type AmplifyAppInfo = { + appId: string; + name: string; + region: string; + backends: Record; +}; + +type S3BucketInfo = { + name?: string; + cbInfo?: CodeBuild.Build; + createTime?: Date; +}; + +type UserPoolInfo = { + name?: string; + region: string; + userPoolId?: string; +}; + +type PinpointAppInfo = { + id: string; + name?: string; + arn: string; + region: string; + cbInfo?: CodeBuild.Build; + createTime: Date; +}; + +type IamRoleInfo = { + name: string; + cbInfo?: CodeBuild.Build; + createTime: Date; +}; + +type AppSyncApiInfo = { + apiId?: string; + name?: string; + region: string; + cbInfo?: CodeBuild.Build; +}; + +type ReportEntry = { + jobId?: string; + workflowId?: string; + cbInfo?: CodeBuild.Build; + amplifyApps: AmplifyAppInfo[]; + stacks: StackInfo[]; + buckets: Record; + roles: Record; + pinpointApps: Record; + appSyncApis: Record; + userPools: Record; +}; + +type JobFilterPredicate = (job: ReportEntry) => boolean; + +type CIJobInfo = { + workflowId: string; + workflowName: string; + ciJobDetails: string; + buildStatus: string; +}; + +type AWSAccountInfo = { + accessKeyId: string; + secretAccessKey: string; + sessionToken: string; + parent: boolean; +}; + +const PINPOINT_TEST_REGEX = /integtest/; +const APPSYNC_TEST_REGEX = /integtest/; +const BUCKET_TEST_REGEX = /test/; +const IAM_TEST_REGEX = /!RotateE2eAwsToken-e2eTestContextRole|-integtest$|^amplify-|^eu-|^us-|^ap-/; +const USER_POOL_TEST_REGEX = /integtest|amplify_backend_manager/; +const STALE_DURATION_MS = 2 * 60 * 60 * 1000; // 2 hours in milliseconds + +/* + * Exit on expired token as all future requests will fail. + */ +const handleExpiredTokenException = (): void => { + console.log('Token expired. Exiting...'); + process.exit(1); +}; + +/** + * Check if a resource is stale based on its created date + * @param created + * @returns + */ +const isStale = (created: string | Date | undefined): boolean => { + let normalizedDate; + if (typeof created === 'string') { + normalizedDate = new Date(created); + } else { + normalizedDate = created; + } + const now = new Date().getTime(); + const isStale = normalizedDate ? now - normalizedDate.getTime() > STALE_DURATION_MS : false; + return isStale; +}; + +/** + * We define a resource as viable for deletion if it matches TEST_REGEX in the name, and if it is > STALE_DURATION_MS old. + */ +const testBucketStalenessFilter = (resource: S3.Bucket): boolean => { + const isTestResource = !!resource?.Name?.match(BUCKET_TEST_REGEX); + return isTestResource && isStale(resource.CreationDate); +}; + +const testRoleStalenessFilter = (resource: IAM.Role): boolean => { + const isTestResource = !!resource?.RoleName?.match(IAM_TEST_REGEX); + return isTestResource && isStale(resource.CreateDate); +}; + +const testUserPoolStalenessFilter = (resource: CognitoIdentityServiceProvider.UserPoolDescriptionType): boolean => { + const isTestResource = !!resource?.Name?.match(USER_POOL_TEST_REGEX); + return isTestResource && isStale(resource.CreationDate); +}; + +const testAppSyncApiStalenessFilter = (resource: AppSync.GraphqlApi): boolean => { + const isTestResource = !!resource?.name?.match(APPSYNC_TEST_REGEX); + const createTimeTagValue = resource?.tags?.['codebuild:create_time']; + let isStaleResource = true; + if (createTimeTagValue) { + const createTime = new Date(createTimeTagValue); + isStaleResource = isStale(createTime); + } + return isTestResource && isStaleResource; +}; + +const testPinpointAppStalenessFilter = (resource: Pinpoint.ApplicationResponse): boolean => { + const isTestResource = !!(resource.Name.match(PINPOINT_TEST_REGEX) && resource.CreationDate); + return isTestResource && isStale(resource.CreationDate); +}; + +/** + * Get all S3 buckets in the account, and filter down to the ones we consider stale. + */ +const getOrphanS3TestBuckets = async (account: AWSAccountInfo): Promise => { + const s3Client = new S3(getAWSConfig(account)); + const listBucketResponse = await s3Client.listBuckets().promise(); + const staleBuckets = listBucketResponse?.Buckets?.filter(testBucketStalenessFilter); + return staleBuckets?.map((it) => ({ name: it.Name, createTime: it.CreationDate })) ?? []; +}; + +/** + * Get all iam roles in the account, and filter down to the ones we consider stale. + */ +const getOrphanTestIamRoles = async (account: AWSAccountInfo): Promise => { + const iamClient = new IAM(getAWSConfig(account)); + const listRoleResponse = await iamClient.listRoles({ MaxItems: 1000 }).promise(); + const staleRoles = listRoleResponse.Roles.filter(testRoleStalenessFilter); + return staleRoles.map((it) => ({ name: it.RoleName, createTime: it.CreateDate })); +}; + +const getOrphanPinpointApplications = async (account: AWSAccountInfo, region: string): Promise => { + const pinpoint = new Pinpoint(getAWSConfig(account, region)); + const apps: PinpointAppInfo[] = []; + let nextToken = undefined; + + do { + const result: Pinpoint.GetAppsResponse = await pinpoint.getApps({ Token: nextToken }).promise(); + apps.push( + ...(result.ApplicationsResponse?.Item || []).filter(testPinpointAppStalenessFilter).map((it) => ({ + id: it.Id, + name: it.Name, + arn: it.Arn, + region, + createTime: new Date(it?.CreationDate ?? 'Invalid Date'), + })), + ); + + nextToken = result.ApplicationsResponse.NextToken; + } while (nextToken); + + return apps; +}; + +const getOrphanUserPools = async (account: AWSAccountInfo, region: string): Promise => { + const cognitoClient = new CognitoIdentityServiceProvider(getAWSConfig(account, region)); + const userPools = await cognitoClient.listUserPools({ MaxResults: 60 }).promise(); + const staleUserPools = userPools?.UserPools?.filter(testUserPoolStalenessFilter); + return staleUserPools?.map((it) => ({ name: it.Name, userPoolId: it.Id, region })) ?? []; +}; + +/** + * Get all AppSync Apis in the account, and filter down to the ones we consider stale. + */ +const getOrphanAppSyncApis = async (account: AWSAccountInfo, region: string): Promise => { + const appSyncClient = new AppSync(getAWSConfig(account, region)); + const listApisResponse = await appSyncClient.listGraphqlApis({ maxResults: 25 }).promise(); + const staleApis = listApisResponse?.graphqlApis?.filter(testAppSyncApiStalenessFilter); + return staleApis?.map((it) => ({ apiId: it.apiId, name: it.name, region })) ?? []; +}; + +/** + * Get the relevant AWS config object for a given account and region. + */ +const getAWSConfig = ({ accessKeyId, secretAccessKey, sessionToken }: AWSAccountInfo, region?: string) => ({ + credentials: { + accessKeyId, + secretAccessKey, + sessionToken, + }, + ...(region ? { region } : {}), + maxRetries: 10, +}); + +/** + * delete an S3 bucket, copied from amplify-e2e-core + */ +const deleteS3Bucket = async (bucket: string, providedS3Client: S3 | undefined = undefined) => { + const s3 = providedS3Client || new S3(); + let continuationToken: Pick | undefined = undefined; + const objectKeyAndVersion = []; + let truncated = true; + while (truncated) { + const results: S3.ListObjectVersionsOutput = await s3 + .listObjectVersions({ + Bucket: bucket, + ...(continuationToken ? continuationToken : {}), + }) + .promise(); + + results.Versions?.forEach(({ Key, VersionId }) => { + if (Key) { + objectKeyAndVersion.push({ Key, VersionId }); + } + }); + + results.DeleteMarkers?.forEach(({ Key, VersionId }) => { + if (Key) { + objectKeyAndVersion.push({ Key, VersionId }); + } + }); + + continuationToken = { KeyMarker: results.NextKeyMarker, VersionIdMarker: results.NextVersionIdMarker }; + truncated = !!results.IsTruncated; + } + const chunkedResult = _.chunk(objectKeyAndVersion, 1000); + const deleteReq = chunkedResult + .map((r: S3.ObjectIdentifier[]) => ({ + Bucket: bucket, + Delete: { + Objects: r, + Quiet: true, + }, + })) + .map((delParams: S3.DeleteObjectsRequest) => s3.deleteObjects(delParams).promise()); + await Promise.all(deleteReq); + await s3 + .deleteBucket({ + Bucket: bucket, + }) + .promise(); + await bucketNotExists(bucket); +}; + +/** + * Copied from amplify-e2e-core + */ +const bucketNotExists = async (bucket: string) => { + const s3 = new S3(); + const params = { + Bucket: bucket, + $waiter: { maxAttempts: 10, delay: 30 }, + }; + try { + await s3.waitFor('bucketNotExists', params).promise(); + return true; + } catch (error) { + if (error.statusCode === 200) { + return false; + } + throw error; + } +}; + +/** + * Copied from amplify-e2e-core + */ +const sleep = async (milliseconds: number): Promise => new Promise((resolve) => setTimeout(resolve, milliseconds)); + +/** + * Returns a list of Amplify Apps in the region. The apps includes information about the CircleCI build that created the app + * This is determined by looking at tags of the backend environments that are associated with the Apps + * @param account aws account to query for amplify Apps + * @param region aws region to query for amplify Apps + * @returns Promise a list of Amplify Apps in the region with build info + */ +const getAmplifyApps = async (account: AWSAccountInfo, region: string, cbClient: CodeBuild): Promise => { + if (region === 'us-east-1' && account.parent) { + return []; // temporarily disabled until us-east-1 is re-enabled for this account + } + const amplifyClient = new Amplify(getAWSConfig(account, region)); + try { + const amplifyApps = await amplifyClient.listApps({ maxResults: 25 }).promise(); // keeping it to 25 as max supported is 25 + const result: AmplifyAppInfo[] = []; + for (const app of amplifyApps.apps) { + if (!isStale(app.createTime)) { + continue; // skip + } + const backends: Record = {}; + try { + const backendEnvironments = await amplifyClient.listBackendEnvironments({ appId: app.appId, maxResults: 5 }).promise(); + for (const backendEnv of backendEnvironments.backendEnvironments) { + if (backendEnv.stackName) { + const buildInfo = await getStackDetails(backendEnv.stackName, account, region, cbClient); + if (buildInfo) { + backends[backendEnv.environmentName] = buildInfo; + } + } + } + } catch (e) { + // console.log(e); + } + result.push({ + appId: app.appId, + name: app.name, + region, + backends, + }); + } + return result; + } catch (e) { + console.log(e); + return []; + } +}; + +/** + * Return the job id looking at `codebuild:build_id` in the tags + * @param tags Tags associated with the resource + * @returns build number or undefined + */ +const getJobId = (tags: CloudFormation.Tags = []): string | undefined => { + const jobId = tags.find((tag) => tag.Key === 'codebuild:build_id')?.Value; + return jobId; +}; + +/** + * Gets details about a stack and CI job that created the stack. If a stack has status of + * `DELETE_FAILED` then it also includes the list of physical id of resources that caused + * deletion failures + * + * @param stackName name of the stack + * @param account account + * @param region region + * @returns stack details + */ +const getStackDetails = async (stackName: string, account: AWSAccountInfo, region: string, cbClient: CodeBuild): Promise => { + const cfnClient = new CloudFormation(getAWSConfig(account, region)); + const stack = await cfnClient.describeStacks({ StackName: stackName }).promise(); + const tags = stack?.Stacks?.[0].Tags ?? []; + const stackStatus = stack?.Stacks?.[0]?.StackStatus ?? 'UNDEFINED'; + let resourcesFailedToDelete: string[] = []; + if (stackStatus === 'DELETE_FAILED') { + // Todo: We need to investigate if we should go ahead and remove the resources to prevent account getting cluttered + const resources = await cfnClient.listStackResources({ StackName: stackName }).promise(); + resourcesFailedToDelete = + resources?.StackResourceSummaries?.filter((r) => r.ResourceStatus === 'DELETE_FAILED').map((r) => r.LogicalResourceId) ?? []; + } + const jobId = getJobId(tags); + return { + stackName, + stackStatus, + resourcesFailedToDelete, + region, + tags: tags.reduce((acc, tag) => ({ ...acc, [tag.Key]: tag.Value }), {}), + cbInfo: jobId ? await getCIJobDetails(jobId, cbClient) : undefined, + }; +}; + +const getStacks = async (account: AWSAccountInfo, region: string, cbClient: CodeBuild): Promise => { + const cfnClient = new CloudFormation(getAWSConfig(account, region)); + const stackStatusFilter = [ + 'CREATE_COMPLETE', + 'ROLLBACK_FAILED', + 'ROLLBACK_COMPLETE', + 'DELETE_FAILED', + 'UPDATE_COMPLETE', + 'UPDATE_ROLLBACK_FAILED', + 'UPDATE_ROLLBACK_COMPLETE', + 'IMPORT_COMPLETE', + 'IMPORT_ROLLBACK_FAILED', + 'IMPORT_ROLLBACK_COMPLETE', + ]; + const stacks = await cfnClient + .listStacks({ + StackStatusFilter: stackStatusFilter, + }) + .promise(); + // loop + let nextToken = stacks.NextToken; + while (nextToken && stacks?.StackSummaries?.length && stacks.StackSummaries.length < DELETE_LIMITS.PER_REGION.CFN_STACK) { + const nextPage = await cfnClient + .listStacks({ + StackStatusFilter: stackStatusFilter, + NextToken: nextToken, + }) + .promise(); + if (nextPage?.StackSummaries?.length) { + stacks.StackSummaries.push(...nextPage.StackSummaries); + nextToken = nextPage.NextToken; + } + } + + stacks.StackSummaries = stacks.StackSummaries || []; + + // We are interested in only the root stacks that are deployed by amplify-cli + // NOTE: every few months, we should disable the filter , and clean up all stacks (not just root stacks) + // this is because some child stacks fail to delete (but we don't let that stop us from deleting root stacks) + // eventually, we must clean up those child stacks too. + let rootStacks = stacks.StackSummaries.filter((stack) => { + const isRoot = !stack.RootId; + if (!isStale(stack.CreationTime)) { + console.log('Skipping stack because created date is:', stack.CreationTime); + } + return isRoot && isStale; + }); + if (rootStacks.length > DELETE_LIMITS.PER_REGION.CFN_STACK) { + // we can only delete 100 stacks accross all regions every batch, + // so we shouldn't take more than 50 stacks from each of those 8 regions. + // this should at least limit calls to getStackDetails below + rootStacks = rootStacks.slice(0, DELETE_LIMITS.PER_REGION.CFN_STACK); + } + const results: StackInfo[] = []; + for (const stack of rootStacks) { + try { + const details = await getStackDetails(stack.StackName, account, region, cbClient); + if (details) { + results.push(details); + } + } catch { + // don't want to barf and fail e2e tests + } + } + return results; +}; + +const getCIJobDetails = async (build_id: string, cbClient: CodeBuild): Promise => { + const batchBuilds = await cbClient.batchGetBuilds({ ids: [build_id] }).promise(); + const buildInfo = batchBuilds?.builds?.[0]; + + return buildInfo; +}; + +const getS3Buckets = async (account: AWSAccountInfo, cbClient: CodeBuild): Promise => { + const s3Client = new S3(getAWSConfig(account)); + const buckets = await s3Client.listBuckets().promise(); + if (buckets.Buckets === undefined) { + return []; + } + const result: S3BucketInfo[] = []; + for (const bucket of buckets.Buckets) { + if (!bucket.Name) { + continue; + } + try { + const bucketDetails = await s3Client.getBucketTagging({ Bucket: bucket.Name }).promise(); + const jobId = getJobId(bucketDetails.TagSet); + if (jobId) { + result.push({ + name: bucket.Name, + cbInfo: await getCIJobDetails(jobId, cbClient), + createTime: bucket.CreationDate, + }); + } + } catch (e) { + if (e.code !== 'NoSuchTagSet' && e.code !== 'NoSuchBucket') { + throw e; + } + result.push({ + name: bucket.Name, + createTime: bucket.CreationDate, + }); + } + } + return result; +}; + +/** + * extract and moves CI job details + */ +const extractCIJobInfo = (record: S3BucketInfo | StackInfo | AmplifyAppInfo): CIJobInfo => ({ + workflowId: _.get(record, ['0', 'cbInfo', 'workflows', 'workflow_id']), + workflowName: _.get(record, ['0', 'cbInfo', 'workflows', 'workflow_name']), + buildStatus: _.get(record, ['0', 'cbInfo', 'buildStatus']), + ciJobDetails: _.get(record, ['0', 'cbInfo']), +}); + +/** + * Merges stale resources and returns a list grouped by the CI jobId. Amplify Apps that don't have + * any backend environment are grouped as Orphan apps and apps that have Backend created by different CI jobs are + * grouped as MULTI_JOB_APP. Any resource that do not have a CI job is grouped under UNKNOWN + */ +const mergeResourcesByCIJob = ( + amplifyApp: AmplifyAppInfo[], + cfnStacks: StackInfo[], + s3Buckets: S3BucketInfo[], + orphanS3Buckets: S3BucketInfo[], + orphanIamRoles: IamRoleInfo[], + orphanPinpointApplications: PinpointAppInfo[], + orphanAppSyncApis: AppSyncApiInfo[], + orphanUserPools: UserPoolInfo[], +): Record => { + const result: Record = {}; + + const stacksByJobId = _.groupBy(cfnStacks, (stack: StackInfo) => _.get(stack, ['cbInfo', 'id'], UNKNOWN)); + + const bucketByJobId = _.groupBy(s3Buckets, (bucketInfo: S3BucketInfo) => _.get(bucketInfo, ['cbInfo', 'id'], UNKNOWN)); + + const amplifyAppByJobId = _.groupBy(amplifyApp, (appInfo: AmplifyAppInfo) => { + if (Object.keys(appInfo.backends).length === 0) { + return ORPHAN; + } + + const buildIds = _.groupBy(appInfo.backends, (backendInfo: StackInfo) => _.get(backendInfo, ['cbInfo', 'id'], UNKNOWN)); + if (Object.keys(buildIds).length === 1) { + return Object.keys(buildIds)[0]; + } + + return MULTI_JOB_APP; + }); + + _.mergeWith( + result, + _.pickBy(amplifyAppByJobId, (__: unknown, key: string) => key !== MULTI_JOB_APP), + (val: any, src: AmplifyAppInfo, key: string) => ({ + ...val, + ...extractCIJobInfo(src), + jobId: key, + amplifyApps: src, + }), + ); + + _.mergeWith( + result, + stacksByJobId, + (__: unknown, key: string) => key !== ORPHAN, + (val: any, src: StackInfo, key: string) => ({ + ...val, + ...extractCIJobInfo(src), + jobId: key, + stacks: src, + }), + ); + + _.mergeWith(result, bucketByJobId, (val: any, src: S3BucketInfo, key: string) => ({ + ...val, + ...extractCIJobInfo(src), + jobId: key, + buckets: src, + })); + + const orphanBuckets = { + [ORPHAN]: orphanS3Buckets, + }; + + _.mergeWith(result, orphanBuckets, (val: any, src: S3BucketInfo, key: string) => ({ + ...val, + jobId: key, + buckets: src, + })); + + const orphanIamRolesGroup = { + [ORPHAN]: orphanIamRoles, + }; + + _.mergeWith(result, orphanIamRolesGroup, (val: any, src: IamRoleInfo, key: string) => ({ + ...val, + jobId: key, + roles: src, + })); + + const orphanPinpointApps = { + [ORPHAN]: orphanPinpointApplications, + }; + + _.mergeWith(result, orphanPinpointApps, (val: any, src: PinpointAppInfo, key: string) => ({ + ...val, + jobId: key, + pinpointApps: src, + })); + + _.mergeWith( + result, + { + [ORPHAN]: orphanAppSyncApis, + }, + (val: any, src: AppSyncApiInfo, key: string) => ({ + ...val, + jobId: key, + appSyncApis: src, + }), + ); + + _.mergeWith( + result, + { + [ORPHAN]: orphanUserPools, + }, + (val: any, src: UserPoolInfo, key: string) => ({ + ...val, + jobId: key, + userPools: src, + }), + ); + + return result; +}; + +const deleteAmplifyApps = async (account: AWSAccountInfo, accountIndex: number, apps: AmplifyAppInfo[]): Promise => { + await Promise.all(apps.slice(0, DELETE_LIMITS.PER_BATCH.OTHER).map((app) => deleteAmplifyApp(account, accountIndex, app))); +}; + +const deleteAmplifyApp = async (account: AWSAccountInfo, accountIndex: number, app: AmplifyAppInfo): Promise => { + const { name, appId, region } = app; + console.log(`[ACCOUNT ${accountIndex}] Deleting App ${name}(${appId})`); + const amplifyClient = new Amplify(getAWSConfig(account, region)); + try { + await amplifyClient.deleteApp({ appId }).promise(); + } catch (e) { + console.log(`[ACCOUNT ${accountIndex}] Deleting Amplify App ${appId} failed with the following error`, e); + if (e.code === 'ExpiredTokenException') { + handleExpiredTokenException(); + } + } +}; + +const deleteIamRoles = async (account: AWSAccountInfo, accountIndex: number, roles: IamRoleInfo[]): Promise => { + await Promise.all(roles.slice(0, DELETE_LIMITS.PER_BATCH.OTHER).map((role) => deleteIamRole(account, accountIndex, role))); +}; + +const deleteIamRole = async (account: AWSAccountInfo, accountIndex: number, role: IamRoleInfo): Promise => { + const { name: roleName } = role; + try { + console.log(`[ACCOUNT ${accountIndex}] Deleting Iam Role ${roleName}`); + console.log(`Role creation time (PST): ${role.createTime.toLocaleTimeString('en-US', { timeZone: 'America/Los_Angeles' })}`); + const iamClient = new IAM(getAWSConfig(account)); + await deleteAttachedRolePolicies(account, accountIndex, roleName); + await deleteRolePolicies(account, accountIndex, roleName); + await iamClient.deleteRole({ RoleName: roleName }).promise(); + } catch (e) { + console.log(`[ACCOUNT ${accountIndex}] Deleting iam role ${roleName} failed with error ${e.message}`); + if (e.code === 'ExpiredTokenException') { + handleExpiredTokenException(); + } + } +}; + +const deleteAttachedRolePolicies = async (account: AWSAccountInfo, accountIndex: number, roleName: string): Promise => { + const iamClient = new IAM(getAWSConfig(account)); + const rolePolicies = await iamClient.listAttachedRolePolicies({ RoleName: roleName }).promise(); + if (rolePolicies?.AttachedPolicies) { + await Promise.all(rolePolicies.AttachedPolicies.map((policy) => detachIamAttachedRolePolicy(account, accountIndex, roleName, policy))); + } +}; + +const detachIamAttachedRolePolicy = async ( + account: AWSAccountInfo, + accountIndex: number, + roleName: string, + policy: IAM.AttachedPolicy, +): Promise => { + if (policy?.PolicyArn) { + try { + console.log(`[ACCOUNT ${accountIndex}] Detach Iam Attached Role Policy ${policy.PolicyName}`); + const iamClient = new IAM(getAWSConfig(account)); + await iamClient.detachRolePolicy({ RoleName: roleName, PolicyArn: policy.PolicyArn }).promise(); + } catch (e) { + console.log(`[ACCOUNT ${accountIndex}] Detach iam role policy ${policy.PolicyName} failed with error ${e.message}`); + if (e.code === 'ExpiredTokenException') { + handleExpiredTokenException(); + } + } + } +}; + +const deleteRolePolicies = async (account: AWSAccountInfo, accountIndex: number, roleName: string): Promise => { + const iamClient = new IAM(getAWSConfig(account)); + const rolePolicies = await iamClient.listRolePolicies({ RoleName: roleName }).promise(); + await Promise.all(rolePolicies.PolicyNames.map((policy) => deleteIamRolePolicy(account, accountIndex, roleName, policy))); +}; + +const deleteIamRolePolicy = async (account: AWSAccountInfo, accountIndex: number, roleName: string, policyName: string): Promise => { + try { + console.log(`[ACCOUNT ${accountIndex}] Deleting Iam Role Policy ${policyName}`); + const iamClient = new IAM(getAWSConfig(account)); + await iamClient.deleteRolePolicy({ RoleName: roleName, PolicyName: policyName }).promise(); + } catch (e) { + console.log(`[ACCOUNT ${accountIndex}] Deleting iam role policy ${policyName} failed with error ${e.message}`); + if (e.code === 'ExpiredTokenException') { + handleExpiredTokenException(); + } + } +}; + +const deleteBuckets = async (account: AWSAccountInfo, accountIndex: number, buckets: S3BucketInfo[]): Promise => { + await Promise.all(buckets.slice(0, DELETE_LIMITS.PER_BATCH.OTHER).map((bucket) => deleteBucket(account, accountIndex, bucket))); +}; + +const deleteBucket = async (account: AWSAccountInfo, accountIndex: number, bucket: S3BucketInfo): Promise => { + const { createTime, name } = bucket; + if (name) { + try { + console.log(`[ACCOUNT ${accountIndex}] Deleting S3 Bucket ${name}`); + console.log(`Bucket creation time (PST): ${createTime?.toLocaleTimeString('en-US', { timeZone: 'America/Los_Angeles' })}`); + const s3 = new S3(getAWSConfig(account)); + await deleteS3Bucket(name, s3); + } catch (e) { + console.log(`[ACCOUNT ${accountIndex}] Deleting bucket ${name} failed with error ${e.message}`); + if (e.code === 'ExpiredTokenException') { + handleExpiredTokenException(); + } + } + } +}; + +const deletePinpointApps = async (account: AWSAccountInfo, accountIndex: number, apps: PinpointAppInfo[]): Promise => { + await Promise.all(apps.slice(0, DELETE_LIMITS.PER_BATCH.OTHER).map((app) => deletePinpointApp(account, accountIndex, app))); +}; + +const deletePinpointApp = async (account: AWSAccountInfo, accountIndex: number, app: PinpointAppInfo): Promise => { + const { id, name, region } = app; + try { + console.log(`[ACCOUNT ${accountIndex}] Deleting Pinpoint App ${name}`); + console.log(`Pinpoint creation time (PST): ${app.createTime.toLocaleTimeString('en-US', { timeZone: 'America/Los_Angeles' })}`); + const pinpoint = new Pinpoint(getAWSConfig(account, region)); + await pinpoint.deleteApp({ ApplicationId: id }).promise(); + } catch (e) { + console.log(`[ACCOUNT ${accountIndex}] Deleting pinpoint app ${name} failed with error ${e.message}`); + } +}; + +const deleteAppSyncApis = async (account: AWSAccountInfo, accountIndex: number, apis: AppSyncApiInfo[]): Promise => { + await Promise.all(apis.slice(0, DELETE_LIMITS.PER_BATCH.OTHER).map((api) => deleteAppSyncApi(account, accountIndex, api))); +}; + +const deleteAppSyncApi = async (account: AWSAccountInfo, accountIndex: number, api: AppSyncApiInfo): Promise => { + const { apiId, name, region } = api; + if (apiId) { + try { + console.log(`[ACCOUNT ${accountIndex}] Deleting AppSync Api ${name}`); + const appSync = new AppSync(getAWSConfig(account, region)); + await appSync.deleteGraphqlApi({ apiId }).promise(); + } catch (e) { + console.log(`[ACCOUNT ${accountIndex}] Deleting AppSync Api ${name} failed with error ${e.message}`); + } + } +}; + +const deleteUserPools = async (account: AWSAccountInfo, accountIndex: number, userPools: UserPoolInfo[]): Promise => { + await Promise.all(userPools.slice(0, DELETE_LIMITS.PER_BATCH.OTHER).map((userPool) => deleteUserPool(account, accountIndex, userPool))); +}; + +const deleteUserPool = async (account: AWSAccountInfo, accountIndex: number, userPool: UserPoolInfo): Promise => { + const { name, region, userPoolId } = userPool; + if (!userPoolId) { + return; + } + try { + console.log(`[ACCOUNT ${accountIndex}] Deleting UserPool ${name}`); + const cognitoClient = new CognitoIdentityServiceProvider(getAWSConfig(account, region)); + const userPoolDetails = await cognitoClient.describeUserPool({ UserPoolId: userPoolId }).promise(); + if (userPoolDetails?.UserPool?.Domain) { + await cognitoClient + .deleteUserPoolDomain({ + UserPoolId: userPoolId, + Domain: userPoolDetails.UserPool.Domain, + }) + .promise(); + } + await cognitoClient.deleteUserPool({ UserPoolId: userPoolId }).promise(); + } catch (e) { + console.log(`[ACCOUNT ${accountIndex}] Deleting UserPool ${name} failed with error ${e.message}`); + } +}; + +const deleteCfnStacks = async (account: AWSAccountInfo, accountIndex: number, stacks: StackInfo[]): Promise => { + await Promise.all(stacks.slice(0, DELETE_LIMITS.PER_BATCH.CFN_STACK).map((stack) => deleteCfnStack(account, accountIndex, stack))); +}; + +const deleteCfnStack = async (account: AWSAccountInfo, accountIndex: number, stack: StackInfo): Promise => { + const { stackName, region, resourcesFailedToDelete } = stack; + const resourceToRetain = resourcesFailedToDelete?.length ? resourcesFailedToDelete : undefined; + console.log(`[ACCOUNT ${accountIndex}] Deleting CloudFormation stack ${stackName}`); + try { + const cfnClient = new CloudFormation(getAWSConfig(account, region)); + await cfnClient.deleteStack({ StackName: stackName, RetainResources: resourceToRetain }).promise(); + // we'll only wait up to a minute before moving on + await cfnClient.waitFor('stackDeleteComplete', { StackName: stackName, $waiter: { maxAttempts: 2 } }).promise(); + } catch (e) { + console.log(`Deleting CloudFormation stack ${stackName} failed with error ${e.message}`); + if (e.code === 'ExpiredTokenException') { + handleExpiredTokenException(); + } + } +}; + +const generateReport = (jobs: _.Dictionary): void => { + fs.ensureFileSync(reportPath); + fs.writeFileSync(reportPath, JSON.stringify(jobs, null, 4)); +}; + +/** + * While we basically fan-out deletes elsewhere in this script, leaving the app->cfn->bucket delete process + * serial within a given account, it's not immediately clear if this is necessary, but seems possibly valuable. + */ +const deleteResources = async ( + account: AWSAccountInfo, + accountIndex: number, + staleResources: Record, +): Promise => { + for (const jobId of Object.keys(staleResources)) { + const resources = staleResources[jobId]; + if (resources.amplifyApps) { + console.log(`Deleting up to ${DELETE_LIMITS.PER_BATCH.OTHER} of ${resources.amplifyApps.length} apps on ACCOUNT[${accountIndex}]`); + await deleteAmplifyApps(account, accountIndex, Object.values(resources.amplifyApps)); + } + + if (resources.stacks) { + console.log(`Deleting up to ${DELETE_LIMITS.PER_BATCH.CFN_STACK} of ${resources.stacks.length} stacks on ACCOUNT[${accountIndex}]`); + await deleteCfnStacks(account, accountIndex, Object.values(resources.stacks)); + } + + if (resources.buckets) { + console.log(`Deleting up to ${DELETE_LIMITS.PER_BATCH.OTHER} of ${resources.buckets.length} buckets on ACCOUNT[${accountIndex}]`); + await deleteBuckets(account, accountIndex, Object.values(resources.buckets)); + } + + if (resources.roles) { + console.log(`Deleting up to ${DELETE_LIMITS.PER_BATCH.OTHER} of ${resources.roles.length} roles on ACCOUNT[${accountIndex}]`); + await deleteIamRoles(account, accountIndex, Object.values(resources.roles)); + } + + if (resources.pinpointApps) { + console.log( + `Deleting up to ${DELETE_LIMITS.PER_BATCH.OTHER} of ${resources.pinpointApps.length} pinpoint apps on ACCOUNT[${accountIndex}]`, + ); + await deletePinpointApps(account, accountIndex, Object.values(resources.pinpointApps)); + } + + if (resources.appSyncApis) { + console.log( + `Deleting up to ${DELETE_LIMITS.PER_BATCH.OTHER} of ${resources.appSyncApis.length} appSyncApis on ACCOUNT[${accountIndex}]`, + ); + await deleteAppSyncApis(account, accountIndex, Object.values(resources.appSyncApis)); + } + + if (resources.userPools) { + console.log(`Deleting up to ${DELETE_LIMITS.PER_BATCH.OTHER} of ${resources.userPools.length} userPools on ACCOUNT[${accountIndex}]`); + await deleteUserPools(account, accountIndex, Object.values(resources.userPools)); + } + } +}; + +/** + * Retrieve the accounts to process for potential cleanup. By default we will attempt + * to get all accounts within the root account organization. + */ +const getAccountsToCleanup = async (): Promise => { + const stsRes = new STS({ + apiVersion: '2011-06-15', + accessKeyId: process.env.AWS_ACCESS_KEY_ID, + secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY, + sessionToken: process.env.AWS_SESSION_TOKEN, + }); + const parentAccountIdentity = await stsRes.getCallerIdentity().promise(); + const orgApi = new Organizations({ + apiVersion: '2016-11-28', + // the region where the organization exists + region: 'us-east-1', + }); + try { + const orgAccounts = await orgApi.listAccounts().promise(); + const allAccounts = orgAccounts.Accounts ?? []; + let nextToken = orgAccounts.NextToken; + while (nextToken) { + const nextPage = await orgApi.listAccounts({ NextToken: nextToken }).promise(); + if (!nextPage?.Accounts?.length) { + break; + } + allAccounts.push(...nextPage.Accounts); + nextToken = nextPage.NextToken; + } + const accountCredentialPromises = allAccounts.map(async (account) => { + if (account.Id === parentAccountIdentity.Account) { + return getEnvVarCredentials(); + } + const randomNumber = Math.floor(Math.random() * 100000); + const assumeRoleRes = await stsRes + .assumeRole({ + RoleArn: `arn:aws:iam::${account.Id}:role/OrganizationAccountAccessRole`, + RoleSessionName: `testSession${randomNumber}`, + // One hour + DurationSeconds: 1 * 60 * 60, + }) + .promise(); + + const accessKeyId = assumeRoleRes?.Credentials?.AccessKeyId ?? ''; + const secretAccessKey = assumeRoleRes?.Credentials?.SecretAccessKey ?? ''; + const sessionToken = assumeRoleRes?.Credentials?.SessionToken ?? ''; + + return { + accessKeyId, + secretAccessKey, + sessionToken, + parent: false, + }; + }); + return await Promise.all(accountCredentialPromises); + } catch (e) { + console.error(e); + console.log( + 'Error assuming child account role. This could be because the script is already running from within a child account. Running on current AWS account only.', + ); + + return [getEnvVarCredentials()]; + } +}; + +const getEnvVarCredentials = (): AWSAccountInfo => { + if (!process.env.AWS_ACCESS_KEY_ID || !process.env.AWS_SECRET_ACCESS_KEY || !process.env.AWS_SESSION_TOKEN) { + throw Error('Credentials are missing in environment variables'); + } + + return { + accessKeyId: process.env.AWS_ACCESS_KEY_ID, + secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY, + sessionToken: process.env.AWS_SESSION_TOKEN, + parent: true, + }; +}; + +const cleanupAccount = async (account: AWSAccountInfo, accountIndex: number, filterPredicate: JobFilterPredicate): Promise => { + const cbClient = new CodeBuild(getAWSConfig(account)); + const appPromises = AWS_REGIONS_TO_RUN_TESTS.map((region) => getAmplifyApps(account, region, cbClient)); + const stackPromises = AWS_REGIONS_TO_RUN_TESTS.map((region) => getStacks(account, region, cbClient)); + const bucketPromise = getS3Buckets(account, cbClient); + const orphanPinpointApplicationsPromise = AWS_REGIONS_TO_RUN_TESTS_PINPOINT.map((region) => + getOrphanPinpointApplications(account, region), + ); + const orphanBucketPromise = getOrphanS3TestBuckets(account); + const orphanIamRolesPromise = getOrphanTestIamRoles(account); + const orphanAppSyncApisPromise = AWS_REGIONS_TO_RUN_TESTS.map((region) => getOrphanAppSyncApis(account, region)); + const orphanUserPoolsPromise = AWS_REGIONS_TO_RUN_TESTS.map((region) => getOrphanUserPools(account, region)); + + const apps = (await Promise.all(appPromises)).flat(); + const stacks = (await Promise.all(stackPromises)).flat(); + const buckets = await bucketPromise; + const orphanBuckets = await orphanBucketPromise; + const orphanIamRoles = await orphanIamRolesPromise; + const orphanPinpointApplications = (await Promise.all(orphanPinpointApplicationsPromise)).flat(); + const orphanAppSyncApis = (await Promise.all(orphanAppSyncApisPromise)).flat(); + const orphanUserPools = (await Promise.all(orphanUserPoolsPromise)).flat(); + + const allResources = mergeResourcesByCIJob( + apps, + stacks, + buckets, + orphanBuckets, + orphanIamRoles, + orphanPinpointApplications, + orphanAppSyncApis, + orphanUserPools, + ); + // cleanup resources that are but that are definitely amplify resources + // this includes apps with names that include "test" or stacks that include both "amplify" & "test" + const testApps = allResources['']?.amplifyApps?.filter((a) => a.name.toLocaleLowerCase().includes('test')); + const testStacks = allResources['']?.stacks?.filter( + (s) => s.stackName.toLocaleLowerCase().includes('test') && s.stackName.toLocaleLowerCase().includes('amplify'), + ); + const orphanedResources = allResources['']; + orphanedResources.amplifyApps = orphanedResources.amplifyApps ?? []; + orphanedResources.stacks = orphanedResources.stacks ?? []; + orphanedResources.amplifyApps.push(...(testApps ? testApps : [])); + orphanedResources.stacks.push(...(testStacks ? testStacks : [])); + const staleResources = _.pickBy(allResources, filterPredicate); + + generateReport(staleResources); + await deleteResources(account, accountIndex, staleResources); + console.log(`[ACCOUNT ${accountIndex}] Cleanup done!`); +}; + +/** + * Execute the cleanup script. + * Cleanup will happen in parallel across all accounts within a given organization, + * based on the requested filter parameters (i.e. for a given workflow, job, or all stale resources). + * Logs are emitted for given account ids anywhere we've fanned out, but we use an indexing scheme instead + * of account ids since the logs these are written to will be effectively public. + */ +const cleanup = async (): Promise => { + const filterPredicateStaleResources = (job: ReportEntry) => job?.cbInfo?.buildStatus === 'finished' || job.jobId === ORPHAN; + const accounts = await getAccountsToCleanup(); + for (let i = 0; i < 3; ++i) { + console.log('CLEANUP ROUND: ', i + 1); + await Promise.all( + accounts.map((account, i) => { + return cleanupAccount(account, i, filterPredicateStaleResources); + }), + ); + await sleep(60 * 1000); // run again after 60 seconds + } + console.log('Done cleaning all accounts!'); +}; + +void cleanup(); diff --git a/shared-scripts.sh b/shared-scripts.sh index 0973d3a0373..52a174230fd 100644 --- a/shared-scripts.sh +++ b/shared-scripts.sh @@ -726,6 +726,16 @@ function _amplifyGeneralConfigTests { _loadTestAccountCredentials retry yarn general-config-e2e --no-cache --maxWorkers=3 --forceExit $TEST_SUITE } + + +function _cleanUpResources { + _loadTestAccountCredentials + echo "Executing resource cleanup" + cd packages/amplify-e2e-tests + yarn install + ts-node ./src/cleanup-codebuild-resources.ts + _unassumeTestAccountCredentials +} function _deploymentVerificationPostRelease { loadCache repo $CODEBUILD_SRC_DIR loadCacheFile .amplify-pkg-version $CODEBUILD_SRC_DIR/.amplify-pkg-version