-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Select random region in health check #1911
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
99cebea
Select random region in e2e tests
sobolk d1e11ec
try this
sobolk d1ea1c5
try this
sobolk 98da409
try this
sobolk d28a3ec
try this
sobolk fd7cc26
try this
sobolk c1d041d
try this
sobolk 66684f5
try this
sobolk a3372dc
try this
sobolk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
name: run_with_e2e_account | ||
description: Runs commands with e2e test account | ||
inputs: | ||
run: | ||
description: Script to run | ||
required: true | ||
shell: | ||
description: Shell | ||
required: false | ||
node_version: | ||
description: node version used to configure environment with | ||
required: false | ||
e2e_test_accounts: | ||
description: Serialized JSON array of strings with account numbers | ||
required: true | ||
aws_region: | ||
description: AWS region. If not provided random will be selected | ||
required: false | ||
link_cli: | ||
description: Whether should link Gen2 CLI globally | ||
default: false | ||
fresh_build: | ||
description: Whether should build from scratch | ||
default: false | ||
runs: | ||
using: composite | ||
steps: | ||
- name: Setup Node.js | ||
uses: ./.github/actions/setup_node | ||
with: | ||
node-version: ${{ inputs.node_version }} | ||
- name: Restore Build Cache | ||
if: inputs.fresh_build != 'true' | ||
uses: ./.github/actions/restore_build_cache | ||
- name: Build With Cache | ||
if: inputs.fresh_build == 'true' | ||
uses: ./.github/actions/build_with_cache | ||
- name: Link CLI | ||
if: inputs.link_cli == 'true' | ||
shell: bash | ||
run: cd packages/cli && npm link | ||
- name: Select E2E test account | ||
uses: ./.github/actions/select_e2e_account | ||
id: selectE2EAccount | ||
with: | ||
e2e_test_accounts: ${{ inputs.e2e_test_accounts }} | ||
- name: Select region | ||
id: selectE2ERegion | ||
shell: bash | ||
run: | | ||
if [ -z "${{ inputs.aws_region }}" ]; then | ||
regions=("us-west-2" "us-east-1" "ca-central-1" "eu-central-1") | ||
rand=$[$RANDOM % ${#regions[@]}] | ||
selected_aws_region=${regions[$rand]} | ||
else | ||
selected_aws_region="${{ inputs.aws_region }}" | ||
fi | ||
echo "Selected AWS Region is $selected_aws_region" | ||
echo "selected_aws_region=$selected_aws_region" >> "$GITHUB_OUTPUT" | ||
- name: Configure test tooling credentials | ||
uses: ./.github/actions/setup_profile | ||
with: | ||
role-to-assume: ${{ steps.selectE2EAccount.outputs.e2e_test_tooling_role }} | ||
aws-region: ${{ steps.selectE2ERegion.outputs.selected_aws_region }} | ||
profile-name: e2e-tooling | ||
- name: Configure test execution credentials | ||
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # version 4.0.2 | ||
with: | ||
role-to-assume: ${{ steps.selectE2EAccount.outputs.e2e_execution_role }} | ||
aws-region: ${{ steps.selectE2ERegion.outputs.selected_aws_region }} | ||
- name: Run script | ||
shell: ${{ inputs.shell }} | ||
run: ${{ inputs.run }} | ||
env: | ||
AWS_REGION: ${{ steps.selectE2ERegion.outputs.selected_aws_region }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I chose bash for this, because it doesn't involve any JSON parsing like we do in case of account selection.
And is rather simple at this point.