Skip to content
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 9 commits into from
Aug 23, 2024
Merged

Select random region in health check #1911

merged 9 commits into from
Aug 23, 2024

Conversation

sobolk
Copy link
Member

@sobolk sobolk commented Aug 23, 2024

Problem

We could spread health_checks traffic across regions we also use for canaries (since they're bootstrapped anyway).

This is a follow up on this #1902 (comment) .

Changes

  1. Refactor out a new action that can run a script with "e2e context". I.e. reduce duplication of constantly growing jobs that share same steps.
  2. Add mechanism that can select region randomly if not provided.
    1. In canaries region is provided explicitly, so we use that
    2. In health checks a jobs pick region randomly.

Validation

  1. Canary checks: https://github.com/aws-amplify/amplify-backend/actions/runs/10531663942
  2. This PR checks.

I looked at jobs to see if canaries keep their stickyness and if health checks select random regions.

Checklist

  • If this PR includes a functional change to the runtime behavior of the code, I have added or updated automated test coverage for this change.
  • If this PR requires a change to the Project Architecture README, I have included that update in this PR.
  • If this PR requires a docs update, I have linked to that docs PR above.
  • If this PR modifies E2E tests, makes changes to resource provisioning, or makes SDK calls, I have run the PR checks with the run-e2e label set.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@sobolk sobolk added the run-e2e Label that will include e2e tests in PR checks workflow label Aug 23, 2024
Copy link

changeset-bot bot commented Aug 23, 2024

⚠️ No Changeset found

Latest commit: a3372dc

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@sobolk sobolk changed the title Select random region in e2e tests Select random region in health check Aug 23, 2024
Comment on lines +51 to +57
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
Copy link
Member Author

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.

@sobolk sobolk marked this pull request as ready for review August 23, 2024 20:21
@sobolk sobolk requested a review from a team as a code owner August 23, 2024 20:21
Copy link
Contributor

@rtpascual rtpascual left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL about composite actions, LGTM

@sobolk sobolk merged commit 90eb24f into main Aug 23, 2024
57 checks passed
@sobolk sobolk deleted the region-stuff branch August 23, 2024 22:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
run-e2e Label that will include e2e tests in PR checks workflow
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants