Skip to content

Commit

Permalink
Merge pull request aws-amplify#1649 from aws-amplify/tag-name-checks
Browse files Browse the repository at this point in the history
chore: add check for reserved tag names
  • Loading branch information
phani-srikar authored Jul 7, 2023
2 parents 3ebdf53 + 674df33 commit 7fcded6
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 22 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@
/scripts/ @aws-amplify/amplify-data-admins
/shared-scripts.sh @aws-amplify/amplify-data-admins
/codebuild_specs/ @aws-amplify/amplify-data-admins
/codebuild_specs/e2e_workflow.yml @aws-amplify/amplify-data
35 changes: 18 additions & 17 deletions codebuild_specs/e2e_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,33 +131,34 @@ batch:
CLI_REGION: eu-central-1
depend-on:
- publish_to_local_registry
- identifier: containers_api_secrets_schema_function_1_api_3_api_1
- identifier: containers_api_secrets_schema_function_1_api_3_base_cdk
buildspec: codebuild_specs/run_e2e_tests.yml
env:
compute-type: BUILD_GENERAL1_MEDIUM
variables:
TEST_SUITE: >-
src/__tests__/containers-api-secrets.test.ts|src/__tests__/schema-function-1.test.ts|src/__tests__/api_3.test.ts|src/__tests__/api_1.test.ts
src/__tests__/containers-api-secrets.test.ts|src/__tests__/schema-function-1.test.ts|src/__tests__/api_3.test.ts|src/__tests__/cdk/base-cdk.test.ts
CLI_REGION: us-east-1
depend-on:
- publish_to_local_registry
- identifier: resolvers_sync_query_datastore_api_6_api_lambda_auth
- identifier: api_1_resolvers_sync_query_datastore_api_6
buildspec: codebuild_specs/run_e2e_tests.yml
env:
compute-type: BUILD_GENERAL1_MEDIUM
variables:
TEST_SUITE: >-
src/__tests__/resolvers.test.ts|src/__tests__/graphql-v2/sync_query_datastore.test.ts|src/__tests__/api_6.test.ts|src/__tests__/graphql-v2/api_lambda_auth.test.ts
CLI_REGION: eu-west-2
src/__tests__/api_1.test.ts|src/__tests__/resolvers.test.ts|src/__tests__/graphql-v2/sync_query_datastore.test.ts|src/__tests__/api_6.test.ts
CLI_REGION: ap-northeast-1
depend-on:
- publish_to_local_registry
- identifier: api_9
- identifier: api_lambda_auth_api_9
buildspec: codebuild_specs/run_e2e_tests.yml
env:
compute-type: BUILD_GENERAL1_MEDIUM
variables:
TEST_SUITE: src/__tests__/api_9.test.ts
CLI_REGION: eu-central-1
TEST_SUITE: >-
src/__tests__/graphql-v2/api_lambda_auth.test.ts|src/__tests__/api_9.test.ts
CLI_REGION: us-east-1
depend-on:
- publish_to_local_registry
- identifier: function_migration
Expand Down Expand Up @@ -350,7 +351,7 @@ batch:
compute-type: BUILD_GENERAL1_SMALL
variables:
TEST_SUITE: src/__tests__/schema-model.test.ts
CLI_REGION: ap-northeast-1
CLI_REGION: ap-southeast-1
depend-on:
- publish_to_local_registry
- identifier: apigw
Expand All @@ -359,7 +360,7 @@ batch:
compute-type: BUILD_GENERAL1_SMALL
variables:
TEST_SUITE: src/__tests__/apigw.test.ts
CLI_REGION: ap-southeast-1
CLI_REGION: ap-southeast-2
depend-on:
- publish_to_local_registry
- identifier: containers_api_2
Expand All @@ -377,7 +378,7 @@ batch:
compute-type: BUILD_GENERAL1_SMALL
variables:
TEST_SUITE: src/__tests__/schema-auth-14.test.ts
CLI_REGION: us-east-1
CLI_REGION: us-east-2
depend-on:
- publish_to_local_registry
- identifier: schema_auth_7
Expand All @@ -386,7 +387,7 @@ batch:
compute-type: BUILD_GENERAL1_SMALL
variables:
TEST_SUITE: src/__tests__/schema-auth-7.test.ts
CLI_REGION: us-east-2
CLI_REGION: us-west-2
depend-on:
- publish_to_local_registry
- identifier: schema_auth_9
Expand All @@ -395,7 +396,7 @@ batch:
compute-type: BUILD_GENERAL1_SMALL
variables:
TEST_SUITE: src/__tests__/schema-auth-9.test.ts
CLI_REGION: us-west-2
CLI_REGION: eu-west-2
depend-on:
- publish_to_local_registry
- identifier: schema_auth_5
Expand Down Expand Up @@ -442,7 +443,7 @@ batch:
compute-type: BUILD_GENERAL1_SMALL
variables:
TEST_SUITE: src/__tests__/schema-auth-6.test.ts
CLI_REGION: us-east-1
CLI_REGION: us-east-2
depend-on:
- publish_to_local_registry
- identifier: schema_connection
Expand All @@ -451,7 +452,7 @@ batch:
compute-type: BUILD_GENERAL1_SMALL
variables:
TEST_SUITE: src/__tests__/schema-connection.test.ts
CLI_REGION: us-east-2
CLI_REGION: us-west-2
depend-on:
- publish_to_local_registry
- identifier: searchable_previous_deployment_had_node_to_node
Expand All @@ -461,7 +462,7 @@ batch:
variables:
TEST_SUITE: >-
src/__tests__/graphql-v2/searchable-node-to-node-encryption/searchable-previous-deployment-had-node-to-node.test.ts
CLI_REGION: us-west-2
CLI_REGION: eu-west-2
depend-on:
- publish_to_local_registry
- identifier: searchable_previous_deployment_no_node_to_node
Expand All @@ -471,7 +472,7 @@ batch:
variables:
TEST_SUITE: >-
src/__tests__/graphql-v2/searchable-node-to-node-encryption/searchable-previous-deployment-no-node-to-node.test.ts
CLI_REGION: eu-west-2
CLI_REGION: eu-central-1
depend-on:
- publish_to_local_registry
- identifier: api_2
Expand Down
15 changes: 11 additions & 4 deletions codebuild_specs/scripts/publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,27 @@ else
git config --global user.name $GITHUB_USER
fi

RESERVED_TAGS=(alpha beta dev latest main)

if [[ "$BRANCH_NAME" =~ ^cb-tagged-release ]]; then
if [[ "$BRANCH_NAME" =~ ^cb-tagged-release-without-e2e-tests\/.* ]]; then
# Remove tagged-release-without-e2e-tests/
export NPM_TAG="${BRANCH_NAME/cb-tagged-release-without-e2e-tests\//}"
NPM_TAG="${BRANCH_NAME/cb-tagged-release-without-e2e-tests\//}"
elif [[ "$BRANCH_NAME" =~ ^cb-tagged-release\/.* ]]; then
# Remove tagged-release/
export NPM_TAG="${BRANCH_NAME/cb-tagged-release\//}"
NPM_TAG="${BRANCH_NAME/cb-tagged-release\//}"
fi
if [ -z "$NPM_TAG" ]; then
echo "Tag name is missing. Name your branch with either cb-tagged-release/<tag-name> or cb-tagged-release-without-e2e-tests/<tag-name>"
exit 1
fi
echo "Publishing to NPM with tag $NPM_TAG"
yarn publish:tag
if [[ " ${RESERVED_TAGS[*]} " =~ " ${NPM_TAG} " ]]; then
echo "The $NPM_TAG tag is reserved. Use alternate tag name"
else
echo "Publishing to NPM with tag $NPM_TAG"
export NPM_TAG="$NPM_TAG"
yarn publish:tag
fi
else
yarn publish:$BRANCH_NAME
fi
3 changes: 2 additions & 1 deletion scripts/sample.env
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
E2E_ACCOUNT_BETA=
E2E_ACCOUNT_PROD=
E2E_ACCOUNT_PROD=
RELEASE_ACCOUNT_PROD=

0 comments on commit 7fcded6

Please sign in to comment.