From 3ca4aa99457e54a89805f86e56b475aaef531d7e Mon Sep 17 00:00:00 2001 From: MJ Zhang <0618@users.noreply.github.com> Date: Wed, 27 Mar 2024 15:20:07 -0700 Subject: [PATCH] fix: yarn modern install workspace (#13197) * fix: yarn modern install workspace * chore: update yarn.lock * chore: update yarn.lock * chore: update api * test: add yarn 3 test to standalone * Revert "test: add yarn 3 test to standalone" This reverts commit 37be610b377daf6c5416b4b2126149fa0ddffe06. * fix: build function error and add test * chore: change fs.writeFile to Sync * chore: add test to codeBuild * fix: fix pr check --------- Co-authored-by: 0.618 --- codebuild_specs/e2e_workflow_generated.yml | 248 +++++++++--------- codebuild_specs/wait_for_ids.json | 119 ++++----- packages/amplify-cli-core/API.md | 2 +- .../src/utils/packageManager.ts | 19 +- .../build-function-yarn-modern.test.ts | 37 +++ .../src/utils/legacyBuild.ts | 2 +- shared-scripts.sh | 48 ++-- 7 files changed, 267 insertions(+), 208 deletions(-) create mode 100644 packages/amplify-e2e-tests/src/__tests__/build-function-yarn-modern.test.ts diff --git a/codebuild_specs/e2e_workflow_generated.yml b/codebuild_specs/e2e_workflow_generated.yml index c9bfc560bbe..abd7e7ab42a 100644 --- a/codebuild_specs/e2e_workflow_generated.yml +++ b/codebuild_specs/e2e_workflow_generated.yml @@ -530,203 +530,202 @@ batch: TEST_SUITE: src/__tests__/auth_5g.test.ts|src/__tests__/auth/admin-api.test.ts|src/__tests__/auth/hosted-ui.test.ts depend-on: - upb - - identifier: l_user_groups_s3_access_user_groups_build_function + - identifier: l_user_groups_s3_access_user_groups_build_function_yarn_modern buildspec: codebuild_specs/run_e2e_tests_linux.yml env: 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 + TEST_SUITE: src/__tests__/auth/user-groups-s3-access.test.ts|src/__tests__/auth/user-groups.test.ts|src/__tests__/build-function-yarn-modern.test.ts depend-on: - upb - - identifier: l_custom_resource_with_storage_dynamodb_simulator_export_pull_c + - identifier: l_build_function_custom_resource_with_storage_dynamodb_simulator buildspec: codebuild_specs/run_e2e_tests_linux.yml env: variables: - TEST_SUITE: src/__tests__/custom-resource-with-storage.test.ts|src/__tests__/dynamodb-simulator/dynamodb-simulator.test.ts|src/__tests__/export-pull-c.test.ts + TEST_SUITE: src/__tests__/build-function.test.ts|src/__tests__/custom-resource-with-storage.test.ts|src/__tests__/dynamodb-simulator/dynamodb-simulator.test.ts CLI_REGION: us-west-2 depend-on: - upb - - identifier: l_function_12_function_13_function_14 + - identifier: l_export_pull_c_function_12_function_13 buildspec: codebuild_specs/run_e2e_tests_linux.yml env: variables: - TEST_SUITE: src/__tests__/function_12.test.ts|src/__tests__/function_13.test.ts|src/__tests__/function_14.test.ts + TEST_SUITE: src/__tests__/export-pull-c.test.ts|src/__tests__/function_12.test.ts|src/__tests__/function_13.test.ts depend-on: - upb - - identifier: l_function_15_function_2d_general_config_headless_init + - identifier: l_function_14_function_15_function_2d buildspec: codebuild_specs/run_e2e_tests_linux.yml env: variables: - TEST_SUITE: src/__tests__/function_15.test.ts|src/__tests__/function_2d.test.ts|src/__tests__/general-config/general-config-headless-init.test.ts + TEST_SUITE: src/__tests__/function_14.test.ts|src/__tests__/function_15.test.ts|src/__tests__/function_2d.test.ts depend-on: - upb - - identifier: l_help_hooks_c_init_force_push + - identifier: l_general_config_headless_init_help_hooks_c buildspec: codebuild_specs/run_e2e_tests_linux.yml env: variables: - TEST_SUITE: src/__tests__/help.test.ts|src/__tests__/hooks-c.test.ts|src/__tests__/init-force-push.test.ts + TEST_SUITE: src/__tests__/general-config/general-config-headless-init.test.ts|src/__tests__/help.test.ts|src/__tests__/hooks-c.test.ts depend-on: - upb - - identifier: l_interactions_1_interactions_2_minify_cloudformation + - identifier: l_init_force_push_interactions_1_interactions_2 buildspec: codebuild_specs/run_e2e_tests_linux.yml env: variables: - TEST_SUITE: src/__tests__/interactions-1.test.ts|src/__tests__/interactions-2.test.ts|src/__tests__/minify-cloudformation.test.ts + TEST_SUITE: src/__tests__/init-force-push.test.ts|src/__tests__/interactions-1.test.ts|src/__tests__/interactions-2.test.ts CLI_REGION: us-west-2 depend-on: - upb - - identifier: l_notifications_multi_env_notifications_sms_update_opensearch_simulator + - identifier: l_minify_cloudformation_notifications_multi_env_notifications_sms_update buildspec: codebuild_specs/run_e2e_tests_linux.yml env: variables: - TEST_SUITE: src/__tests__/notifications-multi-env.test.ts|src/__tests__/notifications-sms-update.test.ts|src/__tests__/opensearch-simulator/opensearch-simulator.test.ts + TEST_SUITE: src/__tests__/minify-cloudformation.test.ts|src/__tests__/notifications-multi-env.test.ts|src/__tests__/notifications-sms-update.test.ts depend-on: - upb - - identifier: l_parameter_store_1_parameter_store_2_android_analytics_pinpoint_config + - identifier: l_opensearch_simulator_parameter_store_1_parameter_store_2 buildspec: codebuild_specs/run_e2e_tests_linux.yml env: variables: - TEST_SUITE: src/__tests__/parameter-store-1.test.ts|src/__tests__/parameter-store-2.test.ts|src/__tests__/pinpoint/android-analytics-pinpoint-config.test.ts + TEST_SUITE: src/__tests__/opensearch-simulator/opensearch-simulator.test.ts|src/__tests__/parameter-store-1.test.ts|src/__tests__/parameter-store-2.test.ts depend-on: - upb - - identifier: l_android_notifications_pinpoint_config_flutter_analytics_pinpoint_config_flutter_notifications_pinpoint_config + - identifier: l_android_analytics_pinpoint_config_android_notifications_pinpoint_config_flutter_analytics_pinpoint_config buildspec: codebuild_specs/run_e2e_tests_linux.yml env: variables: - TEST_SUITE: src/__tests__/pinpoint/android-notifications-pinpoint-config.test.ts|src/__tests__/pinpoint/flutter-analytics-pinpoint-config.test.ts|src/__tests__/pinpoint/flutter-notifications-pinpoint-config.test.ts + 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 depend-on: - upb - - identifier: l_ios_analytics_pinpoint_config_ios_notifications_pinpoint_config_javascript_analytics_pinpoint_config + - identifier: l_flutter_notifications_pinpoint_config_ios_analytics_pinpoint_config_ios_notifications_pinpoint_config buildspec: codebuild_specs/run_e2e_tests_linux.yml env: variables: - TEST_SUITE: src/__tests__/pinpoint/ios-analytics-pinpoint-config.test.ts|src/__tests__/pinpoint/ios-notifications-pinpoint-config.test.ts|src/__tests__/pinpoint/javascript-analytics-pinpoint-config.test.ts + 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 depend-on: - upb - - identifier: l_javascript_notifications_pinpoint_config_pr_previews_multi_env_1_pull_2 + - identifier: l_javascript_analytics_pinpoint_config_javascript_notifications_pinpoint_config_pr_previews_multi_env_1 buildspec: codebuild_specs/run_e2e_tests_linux.yml env: variables: - TEST_SUITE: src/__tests__/pinpoint/javascript-notifications-pinpoint-config.test.ts|src/__tests__/pr-previews-multi-env-1.test.ts|src/__tests__/pull-2.test.ts + 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 depend-on: - upb - - identifier: l_push_smoketest_ios_smoketest + - identifier: l_pull_2_push_smoketest_ios buildspec: codebuild_specs/run_e2e_tests_linux.yml env: variables: - TEST_SUITE: src/__tests__/push.test.ts|src/__tests__/smoke-tests/smoketest-ios.test.ts|src/__tests__/smoke-tests/smoketest.test.ts + TEST_SUITE: src/__tests__/pull-2.test.ts|src/__tests__/push.test.ts|src/__tests__/smoke-tests/smoketest-ios.test.ts depend-on: - upb - - identifier: l_S3server_api_8_function_8 + - identifier: l_smoketest_S3server_api_8 buildspec: codebuild_specs/run_e2e_tests_linux.yml env: variables: - TEST_SUITE: src/__tests__/storage-simulator/S3server.test.ts|src/__tests__/api_8.test.ts|src/__tests__/function_8.test.ts + TEST_SUITE: src/__tests__/smoke-tests/smoketest.test.ts|src/__tests__/storage-simulator/S3server.test.ts|src/__tests__/api_8.test.ts depend-on: - upb - - identifier: l_schema_iterative_update_locking_api_lambda_auth_2_layer_2 + - identifier: l_function_8_schema_iterative_update_locking_api_lambda_auth_2 buildspec: codebuild_specs/run_e2e_tests_linux.yml 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 + TEST_SUITE: src/__tests__/function_8.test.ts|src/__tests__/schema-iterative-update-locking.test.ts|src/__tests__/graphql-v2/api_lambda_auth_2.test.ts depend-on: - upb - - identifier: l_schema_auth_13_function_5_schema_iterative_update_1 + - identifier: l_layer_2_schema_auth_13_function_5 buildspec: codebuild_specs/run_e2e_tests_linux.yml 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 + TEST_SUITE: src/__tests__/layer-2.test.ts|src/__tests__/schema-auth-13.test.ts|src/__tests__/function_5.test.ts depend-on: - upb - - identifier: l_auth_6_function_2a_schema_connection_2 + - identifier: l_schema_iterative_update_1_auth_6_function_2a buildspec: codebuild_specs/run_e2e_tests_linux.yml env: variables: - TEST_SUITE: src/__tests__/auth_6.test.ts|src/__tests__/function_2a.test.ts|src/__tests__/schema-connection-2.test.ts + TEST_SUITE: src/__tests__/schema-iterative-update-1.test.ts|src/__tests__/auth_6.test.ts|src/__tests__/function_2a.test.ts depend-on: - upb - - identifier: l_schema_function_1_api_9b_custom_policies_container + - identifier: l_schema_connection_2_schema_function_1_api_9b buildspec: codebuild_specs/run_e2e_tests_linux.yml env: variables: - TEST_SUITE: src/__tests__/schema-function-1.test.ts|src/__tests__/api_9b.test.ts|src/__tests__/custom_policies_container.test.ts + TEST_SUITE: src/__tests__/schema-connection-2.test.ts|src/__tests__/schema-function-1.test.ts|src/__tests__/api_9b.test.ts depend-on: - upb - - identifier: l_function_9b_schema_iterative_update_2_storage_1a + - identifier: l_custom_policies_container_function_9b_schema_iterative_update_2 buildspec: codebuild_specs/run_e2e_tests_linux.yml env: variables: - TEST_SUITE: src/__tests__/function_9b.test.ts|src/__tests__/schema-iterative-update-2.test.ts|src/__tests__/storage-1a.test.ts + TEST_SUITE: src/__tests__/custom_policies_container.test.ts|src/__tests__/function_9b.test.ts|src/__tests__/schema-iterative-update-2.test.ts depend-on: - upb - - identifier: l_storage_1b_function_11_function_2b + - identifier: l_storage_1a_storage_1b_function_11 buildspec: codebuild_specs/run_e2e_tests_linux.yml env: variables: - TEST_SUITE: src/__tests__/storage-1b.test.ts|src/__tests__/function_11.test.ts|src/__tests__/function_2b.test.ts + TEST_SUITE: src/__tests__/storage-1a.test.ts|src/__tests__/storage-1b.test.ts|src/__tests__/function_11.test.ts depend-on: - upb - - identifier: l_function_7_api_connection_migration2_api_4 + - identifier: l_function_2b_function_7_api_connection_migration2 buildspec: codebuild_specs/run_e2e_tests_linux.yml env: variables: - TEST_SUITE: src/__tests__/function_7.test.ts|src/__tests__/migration/api.connection.migration2.test.ts|src/__tests__/api_4.test.ts + TEST_SUITE: src/__tests__/function_2b.test.ts|src/__tests__/function_7.test.ts|src/__tests__/migration/api.connection.migration2.test.ts depend-on: - upb - - identifier: l_containers_api_secrets_storage_4_schema_auth_10 + - identifier: l_api_4_containers_api_secrets_storage_4 buildspec: codebuild_specs/run_e2e_tests_linux.yml env: variables: - TEST_SUITE: src/__tests__/containers-api-secrets.test.ts|src/__tests__/storage-4.test.ts|src/__tests__/schema-auth-10.test.ts + TEST_SUITE: src/__tests__/api_4.test.ts|src/__tests__/containers-api-secrets.test.ts|src/__tests__/storage-4.test.ts depend-on: - upb - - identifier: l_geo_multi_env_searchable_datastore_resolvers + - identifier: l_schema_auth_10_geo_multi_env_searchable_datastore buildspec: codebuild_specs/run_e2e_tests_linux.yml env: variables: - TEST_SUITE: src/__tests__/geo-multi-env.test.ts|src/__tests__/graphql-v2/searchable-datastore.test.ts|src/__tests__/resolvers.test.ts + TEST_SUITE: src/__tests__/schema-auth-10.test.ts|src/__tests__/geo-multi-env.test.ts|src/__tests__/graphql-v2/searchable-datastore.test.ts depend-on: - upb - - identifier: l_schema_key_api_5_apigw + - identifier: l_resolvers_schema_key_api_5 buildspec: codebuild_specs/run_e2e_tests_linux.yml env: variables: - TEST_SUITE: src/__tests__/schema-key.test.ts|src/__tests__/api_5.test.ts|src/__tests__/apigw.test.ts + TEST_SUITE: src/__tests__/resolvers.test.ts|src/__tests__/schema-key.test.ts|src/__tests__/api_5.test.ts depend-on: - upb - - identifier: l_api_lambda_auth_1_api_key_migration2_schema_searchable + - identifier: l_apigw_api_lambda_auth_1_api_key_migration2 buildspec: codebuild_specs/run_e2e_tests_linux.yml 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 + 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 depend-on: - upb - - identifier: l_api_key_migration1_schema_auth_14_api_3 + - identifier: l_schema_searchable_api_key_migration1_schema_auth_14 buildspec: codebuild_specs/run_e2e_tests_linux.yml 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 + TEST_SUITE: src/__tests__/schema-searchable.test.ts|src/__tests__/migration/api.key.migration1.test.ts|src/__tests__/schema-auth-14.test.ts depend-on: - upb - - identifier: l_api_6b_api_1_layer_1 + - identifier: l_api_3_api_6b_api_1 buildspec: codebuild_specs/run_e2e_tests_linux.yml env: variables: - TEST_SUITE: src/__tests__/api_6b.test.ts|src/__tests__/api_1.test.ts|src/__tests__/layer-1.test.ts + TEST_SUITE: src/__tests__/api_3.test.ts|src/__tests__/api_6b.test.ts|src/__tests__/api_1.test.ts depend-on: - upb - - identifier: l_api_key_migration4_schema_iterative_update_4_function_1 + - identifier: l_layer_1_api_key_migration4_schema_iterative_update_4 buildspec: codebuild_specs/run_e2e_tests_linux.yml 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 + TEST_SUITE: src/__tests__/layer-1.test.ts|src/__tests__/migration/api.key.migration4.test.ts|src/__tests__/schema-iterative-update-4.test.ts depend-on: - upb - - identifier: l_storage_5 + - identifier: l_function_1_storage_5 buildspec: codebuild_specs/run_e2e_tests_linux.yml env: variables: - compute-type: BUILD_GENERAL1_SMALL - TEST_SUITE: src/__tests__/storage-5.test.ts + TEST_SUITE: src/__tests__/function_1.test.ts|src/__tests__/storage-5.test.ts depend-on: - upb - identifier: l_datastore_modelgen @@ -1812,315 +1811,324 @@ batch: depend-on: - build_windows - upb - - identifier: w_user_groups_build_function + - identifier: w_user_groups_build_function_yarn_modern buildspec: codebuild_specs/run_e2e_tests_windows.yml env: type: WINDOWS_SERVER_2019_CONTAINER image: $WINDOWS_IMAGE_2019 variables: - TEST_SUITE: src/__tests__/auth/user-groups.test.ts|src/__tests__/build-function.test.ts + TEST_SUITE: src/__tests__/auth/user-groups.test.ts|src/__tests__/build-function-yarn-modern.test.ts depend-on: - build_windows - upb - - identifier: w_dynamodb_simulator_export_pull_c + - identifier: w_build_function_dynamodb_simulator buildspec: codebuild_specs/run_e2e_tests_windows.yml env: type: WINDOWS_SERVER_2019_CONTAINER image: $WINDOWS_IMAGE_2019 variables: - TEST_SUITE: src/__tests__/dynamodb-simulator/dynamodb-simulator.test.ts|src/__tests__/export-pull-c.test.ts + TEST_SUITE: src/__tests__/build-function.test.ts|src/__tests__/dynamodb-simulator/dynamodb-simulator.test.ts depend-on: - build_windows - upb - - identifier: w_function_12_function_13 + - identifier: w_export_pull_c_function_12 buildspec: codebuild_specs/run_e2e_tests_windows.yml env: type: WINDOWS_SERVER_2019_CONTAINER image: $WINDOWS_IMAGE_2019 variables: - TEST_SUITE: src/__tests__/function_12.test.ts|src/__tests__/function_13.test.ts + TEST_SUITE: src/__tests__/export-pull-c.test.ts|src/__tests__/function_12.test.ts depend-on: - build_windows - upb - - identifier: w_function_14_function_2d + - identifier: w_function_13_function_14 buildspec: codebuild_specs/run_e2e_tests_windows.yml env: type: WINDOWS_SERVER_2019_CONTAINER image: $WINDOWS_IMAGE_2019 variables: - TEST_SUITE: src/__tests__/function_14.test.ts|src/__tests__/function_2d.test.ts + TEST_SUITE: src/__tests__/function_13.test.ts|src/__tests__/function_14.test.ts depend-on: - build_windows - upb - - identifier: w_general_config_headless_init_help + - identifier: w_function_2d_general_config_headless_init buildspec: codebuild_specs/run_e2e_tests_windows.yml env: type: WINDOWS_SERVER_2019_CONTAINER image: $WINDOWS_IMAGE_2019 variables: - TEST_SUITE: src/__tests__/general-config/general-config-headless-init.test.ts|src/__tests__/help.test.ts + TEST_SUITE: src/__tests__/function_2d.test.ts|src/__tests__/general-config/general-config-headless-init.test.ts depend-on: - build_windows - upb - - identifier: w_init_force_push_interactions_1 + - identifier: w_help_init_force_push buildspec: codebuild_specs/run_e2e_tests_windows.yml env: type: WINDOWS_SERVER_2019_CONTAINER image: $WINDOWS_IMAGE_2019 variables: - TEST_SUITE: src/__tests__/init-force-push.test.ts|src/__tests__/interactions-1.test.ts - CLI_REGION: us-west-2 + TEST_SUITE: src/__tests__/help.test.ts|src/__tests__/init-force-push.test.ts depend-on: - build_windows - upb - - identifier: w_interactions_2_minify_cloudformation + - identifier: w_interactions_1_interactions_2 buildspec: codebuild_specs/run_e2e_tests_windows.yml env: type: WINDOWS_SERVER_2019_CONTAINER image: $WINDOWS_IMAGE_2019 variables: - TEST_SUITE: src/__tests__/interactions-2.test.ts|src/__tests__/minify-cloudformation.test.ts + TEST_SUITE: src/__tests__/interactions-1.test.ts|src/__tests__/interactions-2.test.ts CLI_REGION: us-west-2 depend-on: - build_windows - upb - - identifier: w_notifications_multi_env_notifications_sms_update + - identifier: w_minify_cloudformation_notifications_multi_env + buildspec: codebuild_specs/run_e2e_tests_windows.yml + env: + type: WINDOWS_SERVER_2019_CONTAINER + image: $WINDOWS_IMAGE_2019 + variables: + TEST_SUITE: src/__tests__/minify-cloudformation.test.ts|src/__tests__/notifications-multi-env.test.ts + depend-on: + - build_windows + - upb + - identifier: w_notifications_sms_update_parameter_store_1 buildspec: codebuild_specs/run_e2e_tests_windows.yml env: type: WINDOWS_SERVER_2019_CONTAINER image: $WINDOWS_IMAGE_2019 variables: - TEST_SUITE: src/__tests__/notifications-multi-env.test.ts|src/__tests__/notifications-sms-update.test.ts + TEST_SUITE: src/__tests__/notifications-sms-update.test.ts|src/__tests__/parameter-store-1.test.ts depend-on: - build_windows - upb - - identifier: w_parameter_store_1_parameter_store_2 + - identifier: w_parameter_store_2_push buildspec: codebuild_specs/run_e2e_tests_windows.yml env: type: WINDOWS_SERVER_2019_CONTAINER image: $WINDOWS_IMAGE_2019 variables: - TEST_SUITE: src/__tests__/parameter-store-1.test.ts|src/__tests__/parameter-store-2.test.ts + TEST_SUITE: src/__tests__/parameter-store-2.test.ts|src/__tests__/push.test.ts depend-on: - build_windows - upb - - identifier: w_push_smoketest_ios + - identifier: w_smoketest_ios_smoketest buildspec: codebuild_specs/run_e2e_tests_windows.yml env: type: WINDOWS_SERVER_2019_CONTAINER image: $WINDOWS_IMAGE_2019 variables: - TEST_SUITE: src/__tests__/push.test.ts|src/__tests__/smoke-tests/smoketest-ios.test.ts + TEST_SUITE: src/__tests__/smoke-tests/smoketest-ios.test.ts|src/__tests__/smoke-tests/smoketest.test.ts depend-on: - build_windows - upb - - identifier: w_smoketest_api_8 + - identifier: w_api_8_schema_iterative_update_locking buildspec: codebuild_specs/run_e2e_tests_windows.yml env: type: WINDOWS_SERVER_2019_CONTAINER image: $WINDOWS_IMAGE_2019 variables: - TEST_SUITE: src/__tests__/smoke-tests/smoketest.test.ts|src/__tests__/api_8.test.ts + TEST_SUITE: src/__tests__/api_8.test.ts|src/__tests__/schema-iterative-update-locking.test.ts depend-on: - build_windows - upb - - identifier: w_schema_iterative_update_locking_api_lambda_auth_2 + - identifier: w_api_lambda_auth_2_schema_auth_13 buildspec: codebuild_specs/run_e2e_tests_windows.yml env: type: WINDOWS_SERVER_2019_CONTAINER 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 + TEST_SUITE: src/__tests__/graphql-v2/api_lambda_auth_2.test.ts|src/__tests__/schema-auth-13.test.ts depend-on: - build_windows - upb - - identifier: w_schema_auth_13_function_5 + - identifier: w_function_5_schema_iterative_update_1 buildspec: codebuild_specs/run_e2e_tests_windows.yml env: type: WINDOWS_SERVER_2019_CONTAINER image: $WINDOWS_IMAGE_2019 variables: - TEST_SUITE: src/__tests__/schema-auth-13.test.ts|src/__tests__/function_5.test.ts + TEST_SUITE: src/__tests__/function_5.test.ts|src/__tests__/schema-iterative-update-1.test.ts depend-on: - build_windows - upb - - identifier: w_schema_iterative_update_1_auth_6 + - identifier: w_auth_6_function_2a buildspec: codebuild_specs/run_e2e_tests_windows.yml env: type: WINDOWS_SERVER_2019_CONTAINER image: $WINDOWS_IMAGE_2019 variables: - TEST_SUITE: src/__tests__/schema-iterative-update-1.test.ts|src/__tests__/auth_6.test.ts + TEST_SUITE: src/__tests__/auth_6.test.ts|src/__tests__/function_2a.test.ts depend-on: - build_windows - upb - - identifier: w_function_2a_schema_connection_2 + - identifier: w_schema_connection_2_schema_function_1 buildspec: codebuild_specs/run_e2e_tests_windows.yml env: type: WINDOWS_SERVER_2019_CONTAINER image: $WINDOWS_IMAGE_2019 variables: - TEST_SUITE: src/__tests__/function_2a.test.ts|src/__tests__/schema-connection-2.test.ts + TEST_SUITE: src/__tests__/schema-connection-2.test.ts|src/__tests__/schema-function-1.test.ts depend-on: - build_windows - upb - - identifier: w_schema_function_1_api_9b + - identifier: w_api_9b_custom_policies_container buildspec: codebuild_specs/run_e2e_tests_windows.yml env: type: WINDOWS_SERVER_2019_CONTAINER image: $WINDOWS_IMAGE_2019 variables: - TEST_SUITE: src/__tests__/schema-function-1.test.ts|src/__tests__/api_9b.test.ts + TEST_SUITE: src/__tests__/api_9b.test.ts|src/__tests__/custom_policies_container.test.ts depend-on: - build_windows - upb - - identifier: w_custom_policies_container_function_9b + - identifier: w_function_9b_schema_iterative_update_2 buildspec: codebuild_specs/run_e2e_tests_windows.yml env: type: WINDOWS_SERVER_2019_CONTAINER image: $WINDOWS_IMAGE_2019 variables: - TEST_SUITE: src/__tests__/custom_policies_container.test.ts|src/__tests__/function_9b.test.ts + TEST_SUITE: src/__tests__/function_9b.test.ts|src/__tests__/schema-iterative-update-2.test.ts depend-on: - build_windows - upb - - identifier: w_schema_iterative_update_2_storage_1a + - identifier: w_storage_1a_storage_1b buildspec: codebuild_specs/run_e2e_tests_windows.yml env: type: WINDOWS_SERVER_2019_CONTAINER image: $WINDOWS_IMAGE_2019 variables: - TEST_SUITE: src/__tests__/schema-iterative-update-2.test.ts|src/__tests__/storage-1a.test.ts + TEST_SUITE: src/__tests__/storage-1a.test.ts|src/__tests__/storage-1b.test.ts depend-on: - build_windows - upb - - identifier: w_storage_1b_function_11 + - identifier: w_function_11_function_2b buildspec: codebuild_specs/run_e2e_tests_windows.yml env: type: WINDOWS_SERVER_2019_CONTAINER image: $WINDOWS_IMAGE_2019 variables: - TEST_SUITE: src/__tests__/storage-1b.test.ts|src/__tests__/function_11.test.ts + TEST_SUITE: src/__tests__/function_11.test.ts|src/__tests__/function_2b.test.ts depend-on: - build_windows - upb - - identifier: w_function_2b_api_connection_migration2 + - identifier: w_api_connection_migration2_api_4 buildspec: codebuild_specs/run_e2e_tests_windows.yml env: type: WINDOWS_SERVER_2019_CONTAINER image: $WINDOWS_IMAGE_2019 variables: - TEST_SUITE: src/__tests__/function_2b.test.ts|src/__tests__/migration/api.connection.migration2.test.ts + TEST_SUITE: src/__tests__/migration/api.connection.migration2.test.ts|src/__tests__/api_4.test.ts depend-on: - build_windows - upb - - identifier: w_api_4_containers_api_secrets + - identifier: w_containers_api_secrets_storage_4 buildspec: codebuild_specs/run_e2e_tests_windows.yml env: type: WINDOWS_SERVER_2019_CONTAINER image: $WINDOWS_IMAGE_2019 variables: - TEST_SUITE: src/__tests__/api_4.test.ts|src/__tests__/containers-api-secrets.test.ts + TEST_SUITE: src/__tests__/containers-api-secrets.test.ts|src/__tests__/storage-4.test.ts depend-on: - build_windows - upb - - identifier: w_storage_4_schema_auth_10 + - identifier: w_schema_auth_10_geo_multi_env buildspec: codebuild_specs/run_e2e_tests_windows.yml env: type: WINDOWS_SERVER_2019_CONTAINER image: $WINDOWS_IMAGE_2019 variables: - TEST_SUITE: src/__tests__/storage-4.test.ts|src/__tests__/schema-auth-10.test.ts + TEST_SUITE: src/__tests__/schema-auth-10.test.ts|src/__tests__/geo-multi-env.test.ts depend-on: - build_windows - upb - - identifier: w_geo_multi_env_searchable_datastore + - identifier: w_searchable_datastore_resolvers buildspec: codebuild_specs/run_e2e_tests_windows.yml env: type: WINDOWS_SERVER_2019_CONTAINER image: $WINDOWS_IMAGE_2019 variables: - TEST_SUITE: src/__tests__/geo-multi-env.test.ts|src/__tests__/graphql-v2/searchable-datastore.test.ts + TEST_SUITE: src/__tests__/graphql-v2/searchable-datastore.test.ts|src/__tests__/resolvers.test.ts depend-on: - build_windows - upb - - identifier: w_resolvers_schema_key + - identifier: w_schema_key_api_5 buildspec: codebuild_specs/run_e2e_tests_windows.yml env: type: WINDOWS_SERVER_2019_CONTAINER image: $WINDOWS_IMAGE_2019 variables: - TEST_SUITE: src/__tests__/resolvers.test.ts|src/__tests__/schema-key.test.ts + TEST_SUITE: src/__tests__/schema-key.test.ts|src/__tests__/api_5.test.ts depend-on: - build_windows - upb - - identifier: w_api_5_apigw + - identifier: w_apigw_api_lambda_auth_1 buildspec: codebuild_specs/run_e2e_tests_windows.yml env: type: WINDOWS_SERVER_2019_CONTAINER image: $WINDOWS_IMAGE_2019 variables: - TEST_SUITE: src/__tests__/api_5.test.ts|src/__tests__/apigw.test.ts + TEST_SUITE: src/__tests__/apigw.test.ts|src/__tests__/graphql-v2/api_lambda_auth_1.test.ts depend-on: - build_windows - upb - - identifier: w_api_lambda_auth_1_api_key_migration2 + - identifier: w_api_key_migration2_schema_searchable buildspec: codebuild_specs/run_e2e_tests_windows.yml env: type: WINDOWS_SERVER_2019_CONTAINER image: $WINDOWS_IMAGE_2019 variables: - TEST_SUITE: src/__tests__/graphql-v2/api_lambda_auth_1.test.ts|src/__tests__/migration/api.key.migration2.test.ts + TEST_SUITE: src/__tests__/migration/api.key.migration2.test.ts|src/__tests__/schema-searchable.test.ts depend-on: - build_windows - upb - - identifier: w_schema_searchable_api_key_migration1 + - identifier: w_api_key_migration1_schema_auth_14 buildspec: codebuild_specs/run_e2e_tests_windows.yml env: type: WINDOWS_SERVER_2019_CONTAINER image: $WINDOWS_IMAGE_2019 variables: - TEST_SUITE: src/__tests__/schema-searchable.test.ts|src/__tests__/migration/api.key.migration1.test.ts + TEST_SUITE: src/__tests__/migration/api.key.migration1.test.ts|src/__tests__/schema-auth-14.test.ts depend-on: - build_windows - upb - - identifier: w_schema_auth_14_api_3 + - identifier: w_api_3_api_6b buildspec: codebuild_specs/run_e2e_tests_windows.yml env: type: WINDOWS_SERVER_2019_CONTAINER image: $WINDOWS_IMAGE_2019 variables: - TEST_SUITE: src/__tests__/schema-auth-14.test.ts|src/__tests__/api_3.test.ts + TEST_SUITE: src/__tests__/api_3.test.ts|src/__tests__/api_6b.test.ts depend-on: - build_windows - upb - - identifier: w_api_6b_api_1 + - identifier: w_api_1_layer_1 buildspec: codebuild_specs/run_e2e_tests_windows.yml env: type: WINDOWS_SERVER_2019_CONTAINER image: $WINDOWS_IMAGE_2019 variables: - TEST_SUITE: src/__tests__/api_6b.test.ts|src/__tests__/api_1.test.ts + TEST_SUITE: src/__tests__/api_1.test.ts|src/__tests__/layer-1.test.ts depend-on: - build_windows - upb - - identifier: w_layer_1_api_key_migration4 + - identifier: w_api_key_migration4_schema_iterative_update_4 buildspec: codebuild_specs/run_e2e_tests_windows.yml env: type: WINDOWS_SERVER_2019_CONTAINER image: $WINDOWS_IMAGE_2019 variables: - TEST_SUITE: src/__tests__/layer-1.test.ts|src/__tests__/migration/api.key.migration4.test.ts + TEST_SUITE: src/__tests__/migration/api.key.migration4.test.ts|src/__tests__/schema-iterative-update-4.test.ts depend-on: - build_windows - upb - - identifier: w_schema_iterative_update_4_function_1 + - identifier: w_function_1 buildspec: codebuild_specs/run_e2e_tests_windows.yml env: type: WINDOWS_SERVER_2019_CONTAINER image: $WINDOWS_IMAGE_2019 variables: - TEST_SUITE: src/__tests__/schema-iterative-update-4.test.ts|src/__tests__/function_1.test.ts + TEST_SUITE: src/__tests__/function_1.test.ts depend-on: - build_windows - upb diff --git a/codebuild_specs/wait_for_ids.json b/codebuild_specs/wait_for_ids.json index 4d10b7e7c2d..e1bc0af16f0 100644 --- a/codebuild_specs/wait_for_ids.json +++ b/codebuild_specs/wait_for_ids.json @@ -1,18 +1,16 @@ [ - "l_S3server_api_8_function_8", "l_amplify_app", "l_amplify_configure_env_2_init_d", "l_analytics_kinesis_analytics_pinpoint_flutter_analytics_pinpoint_js", - "l_android_notifications_pinpoint_config_flutter_analytics_pinpoint_config_flutter_notifications_pinpoint_config", + "l_android_analytics_pinpoint_config_android_notifications_pinpoint_config_flutter_analytics_pinpoint_config", "l_api_2b_api_6c_api_9a", + "l_api_3_api_6b_api_1", + "l_api_4_containers_api_secrets_storage_4", "l_api_6a_auth_7b_export_pull_b", - "l_api_6b_api_1_layer_1", "l_api_7_export_pull_a_function_9a", - "l_api_key_migration1_schema_auth_14_api_3", - "l_api_key_migration4_schema_iterative_update_4_function_1", "l_api_key_migration_2_v8", "l_api_key_migration_v8", - "l_api_lambda_auth_1_api_key_migration2_schema_searchable", + "l_apigw_api_lambda_auth_1_api_key_migration2", "l_auth_12_auth_2g_auth_2h", "l_auth_1a_auth_trigger_custom_policies_function", "l_auth_1b_delete_geo_add_c", @@ -25,7 +23,6 @@ "l_auth_4b_auth_8a_export_pull_d", "l_auth_4c_auth_5a_auth_5c", "l_auth_5g_admin_api_hosted_ui", - "l_auth_6_function_2a_schema_connection_2", "l_auth_7a_auth_8c_feature_flags", "l_auth_9_custom_resources_env_5", "l_auth_app_client_secret_migration_v12", @@ -36,24 +33,27 @@ "l_auth_migration_amplify_remove_api_2a", "l_auth_migration_v12", "l_auth_oauth_lambda_migration_v12", + "l_build_function_custom_resource_with_storage_dynamodb_simulator", "l_container_hosting_init_b_notifications_apns", "l_containers_api_1", "l_containers_api_2", - "l_containers_api_secrets_storage_4_schema_auth_10", - "l_custom_resource_with_storage_dynamodb_simulator_export_pull_c", + "l_custom_policies_container_function_9b_schema_iterative_update_2", "l_datastore_modelgen", "l_diagnose_hooks_a_mock_api", "l_env_1_geo_add_a_init_a", "l_env_3", "l_env_4_frontend_config_drift_schema_auth_4d", + "l_export_pull_c_function_12_function_13", + "l_flutter_notifications_pinpoint_config_ios_analytics_pinpoint_config_ios_notifications_pinpoint_config", "l_function_10_function_9c_function_permissions", - "l_function_12_function_13_function_14", - "l_function_15_function_2d_general_config_headless_init", + "l_function_14_function_15_function_2d", + "l_function_1_storage_5", + "l_function_2b_function_7_api_connection_migration2", "l_function_2c_function_3b_function_4", "l_function_3a_init_special_case_http_migration", "l_function_6_storage_2_export", - "l_function_7_api_connection_migration2_api_4", - "l_function_9b_schema_iterative_update_2_storage_1a", + "l_function_8_schema_iterative_update_locking_api_lambda_auth_2", + "l_general_config_headless_init_help_hooks_c", "l_geo_add_b_s3_sse_schema_auth_4a", "l_geo_add_d_geo_import_3_hosting", "l_geo_add_e", @@ -61,14 +61,12 @@ "l_geo_headless_api_key_migration5_schema_auth_1a", "l_geo_import_1a_geo_import_2_global_sandbox_b", "l_geo_import_1b_global_sandbox_a_init_e", - "l_geo_multi_env_searchable_datastore_resolvers", "l_geo_remove_1", "l_geo_remove_2", "l_geo_remove_3", "l_geo_update_1", "l_geo_update_2", "l_git_clone_attach_init_c_layer_4", - "l_help_hooks_c_init_force_push", "l_hooks_b_notifications_analytics_compatibility_sms_1_plugin", "l_hostingPROD", "l_iam_permissions_boundary_node_function_notifications_sms", @@ -87,24 +85,26 @@ "l_import_s3_2c", "l_import_s3_3", "l_init_f_auth_5d_configure_project", - "l_interactions_1_interactions_2_minify_cloudformation", + "l_init_force_push_interactions_1_interactions_2", "l_interactions_schema_model_a_tags", - "l_ios_analytics_pinpoint_config_ios_notifications_pinpoint_config_javascript_analytics_pinpoint_config", - "l_javascript_notifications_pinpoint_config_pr_previews_multi_env_1_pull_2", + "l_javascript_analytics_pinpoint_config_javascript_notifications_pinpoint_config_pr_previews_multi_env_1", "l_js_frontend_config", + "l_layer_1_api_key_migration4_schema_iterative_update_4", + "l_layer_2_schema_auth_13_function_5", "l_layer_3_api_connection_migration_api_key_migration3", + "l_minify_cloudformation_notifications_multi_env_notifications_sms_update", "l_notifications_analytics_compatibility_in_app_2_schema_auth_11_c_schema_auth_2b", "l_notifications_analytics_compatibility_sms_2_analytics_2_global_sandbox_c", "l_notifications_fcm_notifications_in_app_messaging_env_2_with_babel_config", "l_notifications_in_app_messaging", - "l_notifications_multi_env_notifications_sms_update_opensearch_simulator", "l_notifications_sms_pull_pull_auth_10", - "l_parameter_store_1_parameter_store_2_android_analytics_pinpoint_config", + "l_opensearch_simulator_parameter_store_1_parameter_store_2", "l_predictions_schema_auth_11_b_schema_auth_1b", - "l_push_smoketest_ios_smoketest", + "l_pull_2_push_smoketest_ios", + "l_resolvers_schema_key_api_5", + "l_schema_auth_10_geo_multi_env_searchable_datastore", "l_schema_auth_11_a", "l_schema_auth_12_schema_auth_3_schema_function_2", - "l_schema_auth_13_function_5_schema_iterative_update_1", "l_schema_auth_15", "l_schema_auth_2a_schema_auth_7a_schema_auth_7b", "l_schema_auth_4b_schema_model_e_schema_versioned", @@ -118,32 +118,38 @@ "l_schema_auth_9_b_schema_iterative_rollback_1_predictions_migration", "l_schema_auth_9_c_storage_3_auth_11", "l_schema_connection_1", - "l_schema_function_1_api_9b_custom_policies_container", - "l_schema_iterative_update_locking_api_lambda_auth_2_layer_2", - "l_schema_key_api_5_apigw", + "l_schema_connection_2_schema_function_1_api_9b", + "l_schema_iterative_update_1_auth_6_function_2a", "l_schema_model_b_schema_model_d_auth_5f", "l_schema_predictions_model_migration_auth_3c", + "l_schema_searchable_api_key_migration1_schema_auth_14", "l_searchable_migration", + "l_smoketest_S3server_api_8", "l_smoketest_amplify_app", - "l_storage_1b_function_11_function_2b", - "l_storage_5", + "l_storage_1a_storage_1b_function_11", "l_studio_modelgen_custom_transformers_notifications_in_app_messaging_env_1", "l_uibuilder", - "l_user_groups_s3_access_user_groups_build_function", + "l_user_groups_s3_access_user_groups_build_function_yarn_modern", "w_amplify_configure_init_d", "w_amplify_remove_api_2a", "w_analytics_2_global_sandbox_c", "w_analytics_kinesis_analytics_pinpoint_flutter", "w_analytics_pinpoint_js_auth_2a", "w_api_10_api_7", + "w_api_1_layer_1", "w_api_2b_api_6c", - "w_api_4_containers_api_secrets", - "w_api_5_apigw", + "w_api_3_api_6b", "w_api_6a_auth_7b", - "w_api_6b_api_1", + "w_api_8_schema_iterative_update_locking", "w_api_9a_auth_2h", + "w_api_9b_custom_policies_container", + "w_api_connection_migration2_api_4", "w_api_connection_migration_api_key_migration3", - "w_api_lambda_auth_1_api_key_migration2", + "w_api_key_migration1_schema_auth_14", + "w_api_key_migration2_schema_searchable", + "w_api_key_migration4_schema_iterative_update_4", + "w_api_lambda_auth_2_schema_auth_13", + "w_apigw_api_lambda_auth_1", "w_auth_11_auth_1b", "w_auth_2b_auth_2d", "w_auth_2c", @@ -155,38 +161,41 @@ "w_auth_5a_auth_5c", "w_auth_5e_auth_8b", "w_auth_5g_admin_api", + "w_auth_6_function_2a", "w_auth_7a_auth_8c", "w_auth_9_env_5", "w_auth_trigger_custom_policies_function", + "w_build_function_dynamodb_simulator", "w_configure_project_init_c", "w_container_hosting_init_b", "w_containers_api_1", "w_containers_api_2", - "w_custom_policies_container_function_9b", + "w_containers_api_secrets_storage_4", "w_custom_transformers_notifications_in_app_messaging_env_1", "w_delete_geo_add_c", - "w_dynamodb_simulator_export_pull_c", "w_env_1_geo_add_a", "w_env_3", "w_env_4_frontend_config_drift", "w_export_pull_a_function_9a", "w_export_pull_b_init_special_case", + "w_export_pull_c_function_12", "w_export_pull_d_schema_auth_5a", "w_feature_flags_geo_import_1b", + "w_function_1", "w_function_10_function_9c", - "w_function_12_function_13", - "w_function_14_function_2d", - "w_function_2a_schema_connection_2", - "w_function_2b_api_connection_migration2", + "w_function_11_function_2b", + "w_function_13_function_14", + "w_function_2d_general_config_headless_init", + "w_function_5_schema_iterative_update_1", + "w_function_9b_schema_iterative_update_2", "w_function_permissions_geo_import_1a", - "w_general_config_headless_init_help", "w_geo_add_b_s3_sse", "w_geo_add_d_geo_import_3", "w_geo_headless_api_key_migration5", "w_geo_import_2_global_sandbox_b", - "w_geo_multi_env_searchable_datastore", "w_geo_remove_1", "w_global_sandbox_a_init_e", + "w_help_init_force_push", "w_hooks_b_notifications_analytics_compatibility_sms_1", "w_hosted_ui_user_groups_s3_access", "w_hostingPROD", @@ -197,28 +206,24 @@ "w_import_s3_3", "w_init_a_schema_auth_4c", "w_init_f_auth_5d", - "w_init_force_push_interactions_1", - "w_interactions_2_minify_cloudformation", + "w_interactions_1_interactions_2", "w_interactions_schema_model_a", "w_js_frontend_config", - "w_layer_1_api_key_migration4", "w_layer_4_function_2c", + "w_minify_cloudformation_notifications_multi_env", "w_node_function_notifications_sms", "w_notifications_analytics_compatibility_in_app_1_notifications_analytics_compatibility_sms_2", "w_notifications_analytics_compatibility_in_app_2_schema_auth_11_c", "w_notifications_apns_notifications_fcm", "w_notifications_in_app_messaging", "w_notifications_in_app_messaging_env_2_with_babel_config", - "w_notifications_multi_env_notifications_sms_update", "w_notifications_sms_pull_auth_10", - "w_parameter_store_1_parameter_store_2", + "w_notifications_sms_update_parameter_store_1", + "w_parameter_store_2_push", "w_plugin_studio_modelgen", "w_predictions_schema_auth_11_b", - "w_push_smoketest_ios", - "w_resolvers_schema_key", + "w_schema_auth_10_geo_multi_env", "w_schema_auth_11_a", - "w_schema_auth_13_function_5", - "w_schema_auth_14_api_3", "w_schema_auth_15", "w_schema_auth_1a_schema_auth_5b", "w_schema_auth_1b_schema_auth_2a", @@ -237,22 +242,18 @@ "w_schema_auth_9_b_predictions_migration", "w_schema_auth_9_c_storage_3", "w_schema_connection_1", + "w_schema_connection_2_schema_function_1", "w_schema_data_access_patterns_schema_model_c", - "w_schema_function_1_api_9b", - "w_schema_iterative_update_1_auth_6", - "w_schema_iterative_update_2_storage_1a", "w_schema_iterative_update_3_auth_migration", - "w_schema_iterative_update_4_function_1", - "w_schema_iterative_update_locking_api_lambda_auth_2", + "w_schema_key_api_5", "w_schema_model_d_auth_5f", "w_schema_predictions_model_migration", - "w_schema_searchable_api_key_migration1", "w_schema_versioned_auth_1c", + "w_searchable_datastore_resolvers", "w_searchable_migration", - "w_smoketest_api_8", - "w_storage_1b_function_11", + "w_smoketest_ios_smoketest", + "w_storage_1a_storage_1b", "w_storage_2_iam_permissions_boundary", - "w_storage_4_schema_auth_10", "w_tags_auth_1a", - "w_user_groups_build_function" + "w_user_groups_build_function_yarn_modern" ] diff --git a/packages/amplify-cli-core/API.md b/packages/amplify-cli-core/API.md index d9ee3f5db5d..935143587ee 100644 --- a/packages/amplify-cli-core/API.md +++ b/packages/amplify-cli-core/API.md @@ -1488,7 +1488,7 @@ export interface PackageManager { // (undocumented) readonly executable: string; // (undocumented) - getInstallArgs: (buildType: BuildType) => string[]; + getInstallArgs: (buildType: BuildType, resourceDir?: string) => string[]; // (undocumented) getRunScriptArgs: (scriptName: string) => string[]; // (undocumented) diff --git a/packages/amplify-cli-core/src/utils/packageManager.ts b/packages/amplify-cli-core/src/utils/packageManager.ts index d58fd3a4031..d97a962dfd3 100644 --- a/packages/amplify-cli-core/src/utils/packageManager.ts +++ b/packages/amplify-cli-core/src/utils/packageManager.ts @@ -22,7 +22,7 @@ export interface PackageManager { readonly displayValue: string; version?: SemVer; getRunScriptArgs: (scriptName: string) => string[]; - getInstallArgs: (buildType: BuildType) => string[]; + getInstallArgs: (buildType: BuildType, resourceDir?: string) => string[]; } class NpmPackageManager implements PackageManager { @@ -43,9 +43,22 @@ class YarnPackageManager implements PackageManager { version?: SemVer; getRunScriptArgs = (scriptName: string) => [scriptName]; - getInstallArgs = (buildType = BuildType.PROD) => { + getInstallArgs = (buildType = BuildType.PROD, resourceDir = '') => { const useYarnModern = this.version?.major && this.version?.major > 1; - return (useYarnModern ? ['install'] : ['--no-bin-links']).concat(buildType === 'PROD' ? ['--production'] : []); + /** + * Since Yarn 2, resourceDir needs to be treated as a separate project, + * otherwise it'll be hoisted to use the lock.file from the parent directory, + * so we need to create a lock file for it. + * ref: https://github.com/yarnpkg/yarn/issues/5716#issuecomment-817330338 + */ + if (useYarnModern) { + if (fs.existsSync(`${resourceDir}/${this.lockFile}`)) { + console.log(`${resourceDir}/${this.lockFile} already exists.`); + } else { + fs.writeFileSync(`${resourceDir}/${this.lockFile}`, ''); + } + } + return (useYarnModern ? ['workspaces', 'focus'] : ['--no-bin-links']).concat(buildType === 'PROD' ? ['--production'] : []); }; } diff --git a/packages/amplify-e2e-tests/src/__tests__/build-function-yarn-modern.test.ts b/packages/amplify-e2e-tests/src/__tests__/build-function-yarn-modern.test.ts new file mode 100644 index 00000000000..aebac9607cf --- /dev/null +++ b/packages/amplify-e2e-tests/src/__tests__/build-function-yarn-modern.test.ts @@ -0,0 +1,37 @@ +import execa from 'execa'; +import { + addFunction, + createNewProjectDir, + deleteProject, + deleteProjectDir, + functionBuild, + initJSProjectWithProfile, +} from '@aws-amplify/amplify-e2e-core'; + +describe('build successfully via Yarn Modern', () => { + let projRoot: string; + + beforeEach(async () => { + projRoot = await createNewProjectDir('analytics'); + await execa('corepack', ['enable'], { cwd: projRoot }); + await execa('yarn', ['init', '-2'], { cwd: projRoot }); + await execa('yarn', ['--version'], { cwd: projRoot }); + }); + + afterEach(async () => { + await deleteProject(projRoot); + deleteProjectDir(projRoot); + }); + + it('add analytics and function', async () => { + await initJSProjectWithProfile(projRoot, {}); + await addFunction( + projRoot, + { + functionTemplate: 'Hello World', + }, + 'nodejs', + ); + await functionBuild(projRoot); + }); +}); diff --git a/packages/amplify-nodejs-function-runtime-provider/src/utils/legacyBuild.ts b/packages/amplify-nodejs-function-runtime-provider/src/utils/legacyBuild.ts index c31b1fdd46c..f6d8a0d3e71 100644 --- a/packages/amplify-nodejs-function-runtime-provider/src/utils/legacyBuild.ts +++ b/packages/amplify-nodejs-function-runtime-provider/src/utils/legacyBuild.ts @@ -53,7 +53,7 @@ const runPackageManagerInstall = async (resourceDir: string, buildType: BuildTyp return; } - const args = packageManager.getInstallArgs(buildType); + const args = packageManager.getInstallArgs(buildType, resourceDir); await runPackageManager(packageManager, args, resourceDir); }; diff --git a/shared-scripts.sh b/shared-scripts.sh index 7013479a6fa..0f035056693 100644 --- a/shared-scripts.sh +++ b/shared-scripts.sh @@ -40,7 +40,7 @@ function loadCache { # create directory if it doesn't exist yet mkdir -p $localPath # check if cache exists in s3 - if ! aws s3 ls $s3Path > /dev/null; then + if ! aws s3 ls $s3Path >/dev/null; then echo "Cache not found." exit 0 fi @@ -57,7 +57,7 @@ function loadCacheFile { s3Path="s3://$CACHE_BUCKET_NAME/$CODEBUILD_SOURCE_VERSION/$alias" echo loading cache file from $s3Path # check if cache file exists in s3 - if ! aws s3 ls $s3Path > /dev/null; then + if ! aws s3 ls $s3Path >/dev/null; then echo "Cache file not found." exit 0 fi @@ -90,6 +90,7 @@ function _installAndCacheDependencies { storeCache $CODEBUILD_SRC_DIR repo storeCache $HOME/.cache .cache } + function _buildLinux { echo Linux Build yarn --immutable @@ -115,8 +116,8 @@ function _validateRollbackTargetVersion { loadCache repo $CODEBUILD_SRC_DIR loadCache .cache $HOME/.cache if [ -z "$ROLLBACK_TARGET_VERSION" ]; then - echo "Rollback target version is missing. Make sure CodeBuild workflow was started with ROLLBACK_TARGET_VERSION environment variable" - exit 1 + echo "Rollback target version is missing. Make sure CodeBuild workflow was started with ROLLBACK_TARGET_VERSION environment variable" + exit 1 fi yarn ts-node scripts/verify-deployment.ts -v $ROLLBACK_TARGET_VERSION } @@ -154,28 +155,28 @@ function _verifyGeneratedE2EWorkflow { loadCache .cache $HOME/.cache # backup current file and remove regions, they are not deterministic - cat codebuild_specs/e2e_workflow_generated.yml | grep -v "CLI_REGION:" > codebuild_specs/e2e_workflow_generated.yml.old.trimmed + cat codebuild_specs/e2e_workflow_generated.yml | grep -v "CLI_REGION:" >codebuild_specs/e2e_workflow_generated.yml.old.trimmed # regenerate e2e workflow yarn split-e2e-tests-codebuild # remove regions from generated file, they are not deterministic - cat codebuild_specs/e2e_workflow_generated.yml | grep -v "CLI_REGION:" > codebuild_specs/e2e_workflow_generated.yml.trimmed + cat codebuild_specs/e2e_workflow_generated.yml | grep -v "CLI_REGION:" >codebuild_specs/e2e_workflow_generated.yml.trimmed changed_lines_in_e2e_workflow_generated=$(diff codebuild_specs/e2e_workflow_generated.yml.old.trimmed codebuild_specs/e2e_workflow_generated.yml.trimmed | wc -l) if [[ changed_lines_in_e2e_workflow_generated -gt 0 ]]; then - echo "Fail! An uncommitted drift in E2E workflow has been detected - e2e_workflow_generated.yml. Please run 'yarn split-e2e-tests-codebuild' and commit the result." - diff codebuild_specs/e2e_workflow_generated.yml.old.trimmed codebuild_specs/e2e_workflow_generated.yml.trimmed - exit 1; + echo "Fail! An uncommitted drift in E2E workflow has been detected - e2e_workflow_generated.yml. Please run 'yarn split-e2e-tests-codebuild' and commit the result." + diff codebuild_specs/e2e_workflow_generated.yml.old.trimmed codebuild_specs/e2e_workflow_generated.yml.trimmed + exit 1 fi # check if wait_for_ids.json changed. changed_wait_for_ids_manifest=$(git status | grep -F wait_for_ids.json | wc -l) if [[ changed_wait_for_ids_manifest -gt 0 ]]; then - echo "Fail! An uncommitted drift in E2E workflow has been detected - wait_for_ids.json. Please run 'yarn split-e2e-tests-codebuild' and commit the result." - exit 1; + echo "Fail! An uncommitted drift in E2E workflow has been detected - wait_for_ids.json. Please run 'yarn split-e2e-tests-codebuild' and commit the result." + exit 1 fi echo "Success! No drift detected in E2E workflow." @@ -231,7 +232,7 @@ function _publishToLocalRegistry { cat UNIFIED_CHANGELOG.md echo Save new amplify Github tag - node scripts/echo-current-cli-version.js > .amplify-pkg-version + node scripts/echo-current-cli-version.js >.amplify-pkg-version echo LS HOME ls $CODEBUILD_SRC_DIR/.. @@ -306,8 +307,7 @@ function _convertCoverage { } # https://docs.codecov.com/docs/codecov-uploader#integrity-checking-the-uploader function _uploadCoverageLinux { - if [ -z ${CODECOV_TOKEN+x} ] - then + if [ -z ${CODECOV_TOKEN+x} ]; then echo "CODECOV_TOKEN not set: No coverage will be uploaded." else curl https://keybase.io/codecovsecurity/pgp_keys.asc | gpg --no-default-keyring --keyring trustedkeys.gpg --import # One-time step @@ -564,7 +564,8 @@ function _integrationTest { echo "running auth server in background" export NODE_OPTIONS=--openssl-legacy-provider - nohup yarn start > server_output.txt & disown $! + nohup yarn start >server_output.txt & + disown $! echo "Polling for server ready message" while ! grep -Fxq "You can now view aws-amplify-cypress-auth in the browser." server_output.txt; do echo "Waiting for server to start" && sleep 1; done echo "server started" @@ -584,7 +585,6 @@ function _integrationTest { expect ../amplify-cli/codebuild_specs/exp-files/delete.exp aws s3 rb "$DEPLOYMENT_BUCKET" --force - echo "Clone API test package" cd .. && pwd git clone $API_CLONE_URL @@ -605,7 +605,8 @@ function _integrationTest { echo "running api server in background" export NODE_OPTIONS=--openssl-legacy-provider - nohup yarn start > server_output.txt & disown $! + nohup yarn start >server_output.txt & + disown $! echo "Polling for server ready message" while ! grep -Fxq "You can now view aws-amplify-cypress-api in the browser." server_output.txt; do echo "Waiting for server to start" && sleep 1; done echo "server started" @@ -714,7 +715,7 @@ function _publishToNpm { ./out/amplify-pkg-linux-x64 --version echo Authenticate with npm - echo "//registry.npmjs.org/:_authToken=$NPM_PUBLISH_TOKEN" > ~/.npmrc + echo "//registry.npmjs.org/:_authToken=$NPM_PUBLISH_TOKEN" >~/.npmrc source ./.circleci/cb-publish-step-3-npm.sh } @@ -722,12 +723,12 @@ function _rollbackNpm { loadCache repo $CODEBUILD_SRC_DIR if [ -z "$ROLLBACK_TARGET_VERSION" ]; then - echo "Rollback target version is missing. Make sure CodeBuild workflow was started with ROLLBACK_TARGET_VERSION environment variable" - exit 1 + echo "Rollback target version is missing. Make sure CodeBuild workflow was started with ROLLBACK_TARGET_VERSION environment variable" + exit 1 fi echo Authenticate with npm - echo "//registry.npmjs.org/:_authToken=$NPM_PUBLISH_TOKEN" > ~/.npmrc + echo "//registry.npmjs.org/:_authToken=$NPM_PUBLISH_TOKEN" >~/.npmrc npm dist-tag add @aws-amplify/cli@$ROLLBACK_TARGET_VERSION "latest" } @@ -750,8 +751,8 @@ function _githubRollback { loadCache repo $CODEBUILD_SRC_DIR echo Rollback Amplify CLI GitHub release if [ -z "$ROLLBACK_TARGET_VERSION" ]; then - echo "Rollback target version is missing. Make sure CodeBuild workflow was started with ROLLBACK_TARGET_VERSION environment variable" - exit 1 + echo "Rollback target version is missing. Make sure CodeBuild workflow was started with ROLLBACK_TARGET_VERSION environment variable" + exit 1 fi yarn ts-node scripts/github-rollback.ts $ROLLBACK_TARGET_VERSION } @@ -768,7 +769,6 @@ function _amplifyGeneralConfigTests { retry yarn general-config-e2e --no-cache --maxWorkers=3 --forceExit $TEST_SUITE } - function _cleanUpResources { _loadTestAccountCredentials echo "Executing resource cleanup"