Canary Test #18446
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
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"). | |
# You may not use this file except in compliance with the License. | |
# A copy of the License is located at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# or in the "license" file accompanying this file. This file is distributed | |
# on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either | |
# express or implied. See the License for the specific language governing | |
# permissions and limitations under the License. | |
name: 'Canary Test' | |
on: | |
schedule: | |
- cron: '0 */3 * * *' # triggers the workflow every three hours | |
workflow_dispatch: | |
env: | |
TF_VAR_patch: 'true' | |
TESTING_FRAMEWORK_REPO: aws-observability/aws-otel-test-framework | |
concurrency: | |
group: canary-${{ github.ref_name }} | |
permissions: | |
id-token: write | |
contents: read | |
jobs: | |
create-test-ref: | |
runs-on: ubuntu-latest | |
outputs: | |
testRef: ${{ steps.setRef.outputs.ref }} | |
steps: | |
- name: Set testRef output | |
id: setRef | |
run: | | |
if [[ ${{ github.ref_name }} == release/v* ]]; then | |
echo "ref=${{github.ref_name}}" >> $GITHUB_OUTPUT | |
else | |
echo "ref=terraform" >> $GITHUB_OUTPUT | |
fi | |
build-aotutil: | |
runs-on: ubuntu-latest | |
needs: create-test-ref | |
steps: | |
- name: Check out testing framework | |
uses: actions/checkout@v4 | |
with: | |
repository: ${{ env.TESTING_FRAMEWORK_REPO }} | |
path: testing-framework | |
ref: ${{ needs.create-test-ref.outputs.testRef }} | |
- name: Set up Go 1.x | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '~1.22.7' | |
cache-dependency-path: testing-framework/cmd/aotutil/go.sum | |
- name: Build aotutil | |
run: cd testing-framework/cmd/aotutil && make build | |
- name: Cache aotutil | |
uses: actions/cache@v3 | |
with: | |
key: "aotutil_${{ github.run_id }}" | |
path: testing-framework/cmd/aotutil/aotutil | |
get-canary-test-cases: | |
runs-on: ubuntu-latest | |
needs: | |
- build-aotutil | |
outputs: | |
canary_matrix: ${{ steps.get-test-cases.outputs.canary_matrix }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.9' | |
- name: get all the canary test cases | |
id: get-test-cases | |
run: | | |
canary_matrix=$(python e2etest/get-testcases.py canary_matrix) | |
echo "canary_matrix=$canary_matrix" >> $GITHUB_OUTPUT | |
run-canary-test: | |
runs-on: ubuntu-latest | |
needs: [get-canary-test-cases, create-test-ref] | |
strategy: | |
matrix: ${{ fromJson(needs.get-canary-test-cases.outputs.canary_matrix) }} | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
role-to-assume: ${{ secrets.COLLECTOR_ASSUMABLE_ROLE_ARN }} | |
aws-region: us-west-2 | |
role-duration-seconds: 10800 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' | |
java-version: '11' | |
- name: Set up terraform | |
uses: hashicorp/setup-terraform@v3 | |
with: | |
terraform_version: "~1.5" | |
- name: Check out testing framework | |
uses: actions/checkout@v4 | |
with: | |
repository: ${{ env.TESTING_FRAMEWORK_REPO }} | |
path: testing-framework | |
ref: ${{ needs.create-test-ref.outputs.testRef }} | |
- name: Restore aoutil | |
uses: actions/cache@v3 | |
with: | |
key: "aotutil_${{ github.run_id }}" | |
path: testing-framework/cmd/aotutil/aotutil | |
- name: Run Canary test | |
uses: nick-fields/retry@v2 | |
with: | |
max_attempts: 3 | |
timeout_minutes: 60 | |
command: | | |
opts="" | |
if [[ -f testing-framework/terraform/testcases/${{ matrix.testcase }}/parameters.tfvars ]] ; then opts="-var-file=../testcases/${{ matrix.testcase }}/parameters.tfvars" ; fi | |
cd testing-framework/terraform/canary | |
terraform init | |
terraform apply -auto-approve -lock=false $opts -var="aoc_version=latest" -var="testcase=../testcases/${{ matrix.testcase }}" -var="testing_ami=${{ matrix.testing_ami }}" | |
- name: Destroy terraform resources | |
if: ${{ always() }} | |
run: | | |
cd testing-framework/terraform/canary && terraform destroy -auto-approve -var="region=us-west-2" |