Skip to content

Canary (published artifacts) build #3714

Canary (published artifacts) build

Canary (published artifacts) build #3714

Workflow file for this run

name: Canary (published artifacts) build
on:
schedule:
- cron: '25 */8 * * *' # every 8 hours
workflow_dispatch:
env:
AMP_REGIONS: us-west-2,us-east-1,us-east-2,eu-central-1,eu-west-1
permissions:
id-token: write
contents: read
jobs:
canary-test:
runs-on: ubuntu-latest
name: Canary Test - (${{ matrix.aws_region }} - ${{ matrix.language }} - ${{ matrix.sample-app }} - ${{ matrix.instrumentation-type }} - ${{ matrix.architecture }})
strategy:
fail-fast: false
matrix:
aws_region: [
"us-east-1",
"us-east-2",
"us-west-1",
"us-west-2",
"ap-south-1",
"ap-northeast-2",
"ap-southeast-1",
"ap-southeast-2",
"ap-northeast-1",
"ca-central-1",
"eu-central-1",
"eu-west-1",
"eu-west-2",
"eu-west-3",
"eu-north-1",
"sa-east-1"
]
language: [ dotnet, go, java, nodejs, python ]
sample-app: [ aws-sdk, okhttp ]
instrumentation-type: [ agent, wrapper ]
architecture: [ amd64, arm64 ]
exclude:
- language: dotnet
sample-app: okhttp
- language: dotnet
instrumentation-type: agent
- language: go
sample-app: okhttp
- language: go
instrumentation-type: agent
- language: nodejs
sample-app: okhttp
- language: nodejs
instrumentation-type: agent
- language: python
sample-app: okhttp
- language: python
instrumentation-type: agent
- language: java
sample-app: okhttp
instrumentation-type: agent
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/setup-go@v5
with:
go-version: '~1.21.10'
check-latest: true
- uses: actions/setup-java@v4
if: ${{ matrix.language == 'java' }}
with:
distribution: corretto
java-version: '17'
- name: Cache (Java)
uses: actions/cache@v3
if: ${{ matrix.language == 'java' }}
with:
path: |
~/go/pkg/mod
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-gradle-
- uses: actions/setup-node@v4
if: ${{ matrix.language == 'nodejs' }}
with:
node-version: '16'
- name: Cache (NodeJS)
uses: actions/cache@v3
if: ${{ matrix.language == 'nodejs' }}
with:
path: |
~/go/pkg/mod
~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-node-
- uses: actions/setup-python@v5
if: ${{ matrix.language == 'python' }}
with:
python-version: '3.x'
- name: Cache (Python)
uses: actions/cache@v3
if: ${{ matrix.language == 'python' }}
with:
path: |
~/go/pkg/mod
~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-pip-
- uses: actions/setup-dotnet@v4
if: ${{ matrix.language == 'dotnet' }}
with:
dotnet-version: '6.0.405'
- name: Patch ADOT
run: ./patch-upstream.sh
- name: Build functions
run: GOARCH=${{ matrix.architecture }} ./build.sh ${{ matrix.architecture }}
working-directory: ${{ matrix.language }}
- uses: aws-actions/configure-aws-credentials@v4.0.2
with:
role-to-assume: ${{ secrets.INTEG_TEST_LAMBDA_ROLE_ARN }}
role-duration-seconds: 7200
aws-region: ${{ matrix.aws_region }}
- name: Get terraform directory
run: |
echo TERRAFORM_DIRECTORY=${{ matrix.language }}/sample-apps/${{ matrix.sample-app }}/deploy/${{ matrix.instrumentation-type }} |
tee --append $GITHUB_ENV
- uses: hashicorp/setup-terraform@v2
- name: Initialize terraform
run: terraform init
working-directory: ${{ env.TERRAFORM_DIRECTORY }}
- name: Get Lambda Layer `amd64` architecture value
if: ${{ matrix.architecture == 'amd64' }}
run: echo LAMBDA_FUNCTION_ARCH=x86_64 | tee --append $GITHUB_ENV
- name: Get Lambda Layer `arm64` architecture value
if: ${{ matrix.architecture == 'arm64' }}
run: echo LAMBDA_FUNCTION_ARCH=arm64 | tee --append $GITHUB_ENV
- name: Apply terraform
run: terraform apply -auto-approve
working-directory: ${{ env.TERRAFORM_DIRECTORY }}
env:
TF_VAR_function_name: lambda-${{ matrix.language }}-${{ matrix.sample-app }}-${{ matrix.instrumentation-type }}-${{ matrix.architecture }}-${{ github.run_id }}-${{ matrix.aws_region }}
TF_VAR_architecture: ${{ env.LAMBDA_FUNCTION_ARCH }}
- name: Extract endpoint
id: extract-endpoint
run: terraform output -raw api-gateway-url
working-directory: ${{ env.TERRAFORM_DIRECTORY }}
- name: Extract AMP endpoint
if: ${{ matrix.language == 'java' && matrix.sample-app == 'aws-sdk' && matrix.instrumentation-type == 'agent' && contains(env.AMP_REGIONS, matrix.aws_region) }}
id: extract-amp-endpoint
run: terraform output -raw amp_endpoint
working-directory: ${{ env.TERRAFORM_DIRECTORY }}
- name: Send request to endpoint
run: curl -sS ${{ steps.extract-endpoint.outputs.stdout }}
- name: Checkout test framework
uses: actions/checkout@v4
with:
repository: aws-observability/aws-otel-test-framework
path: test-framework
- name: validate trace sample
uses: nick-invision/retry@v3
with:
timeout_seconds: 300
max_attempts: 3
command: |
cp adot/utils/expected-templates/${{ matrix.language }}-${{ matrix.sample-app }}-${{ matrix.instrumentation-type }}.json \
test-framework/validator/src/main/resources/expected-data-template/lambdaExpectedTrace.mustache
cd test-framework
./gradlew :validator:run --args="-c default-lambda-validation.yml --endpoint ${{ steps.extract-endpoint.outputs.stdout }} --region $AWS_REGION"
# add back in once the java-agent layer is published and the ARNs are available
# - name: validate java agent metric sample
# if: ${{ matrix.language == 'java' && matrix.sample-app == 'aws-sdk' && matrix.instrumentation-type == 'agent' && contains(env.AMP_REGIONS, matrix.aws_region) }}
# run: |
# cp adot/utils/expected-templates/${{ matrix.language }}-${{ matrix.sample-app }}-${{ matrix.instrumentation-type }}-metric.json \
# test-framework/validator/src/main/resources/expected-data-template/ampExpectedMetric.mustache
# cd test-framework
# ./gradlew :validator:run --args="-c prometheus-static-metric-validation.yml --cortex-instance-endpoint ${{ steps.extract-amp-endpoint.outputs.stdout }} --region $AWS_REGION"
- name: Destroy terraform
if: always()
run: terraform destroy -auto-approve
working-directory: ${{ env.TERRAFORM_DIRECTORY }}
env:
TF_VAR_architecture: ${{ env.LAMBDA_FUNCTION_ARCH }}
publish-canary-status:
needs: [canary-test]
if: ${{ always() }}
uses: ./.github/workflows/publish-status.yml
with:
namespace: 'ADOT/GitHubActions'
repository: ${{ github.repository }}
branch: ${{ github.ref_name }}
workflow: canary
success: ${{ needs.canary-test.result == 'success' }}
region: us-west-2
secrets:
roleArn: ${{ secrets.METRICS_ROLE_ARN }}