Updating sample app layers (#963) #539
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
name: Main Build | |
on: | |
push: | |
branches: | |
- main | |
- release/* | |
paths-ignore: | |
- '.github/**' | |
- '!.github/workflows/main-build.yml' | |
- '!.github/workflows/main-build-python.yml' | |
- '!.github/workflows/main-build-java.yml' | |
- '**.md' | |
workflow_dispatch: | |
concurrency: | |
group: main-build-${{ github.ref_name }} | |
cancel-in-progress: true | |
permissions: | |
id-token: write | |
contents: read | |
jobs: | |
integration-test: | |
runs-on: ubuntu-20.04 | |
name: ${{ matrix.language }}-${{ matrix.instrumentation-type }}-${{ matrix.architecture }} | |
strategy: | |
fail-fast: false | |
matrix: | |
architecture: [ amd64, arm64 ] | |
language: [ dotnet, go, nodejs ] | |
sample-app: [ aws-sdk ] | |
instrumentation-type: [ wrapper ] | |
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-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-dotnet@v4 | |
if: ${{ matrix.language == 'dotnet' }} | |
with: | |
dotnet-version: '6.0.405' | |
- 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: us-east-1 | |
- name: Patch ADOT | |
run: ./patch-upstream.sh | |
- name: Build layers / functions | |
run: GOARCH=${{ matrix.architecture }} ./build.sh ${{ matrix.architecture }} | |
working-directory: ${{ matrix.language }} | |
- 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: Get terraform directory | |
run: | | |
echo TERRAFORM_DIRECTORY=${{ matrix.language }}/integration-tests/${{ matrix.sample-app }}/${{ 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 terraform Lambda function name | |
run: | | |
echo TERRAFORM_LAMBDA_FUNCTION_NAME=lambda-${{ matrix.language }}-${{ matrix.sample-app }}-${{ matrix.instrumentation-type }}-${{ matrix.architecture }}-${{ github.run_id }} | | |
tee --append $GITHUB_ENV | |
- name: Apply terraform | |
run: terraform apply -auto-approve | |
working-directory: ${{ env.TERRAFORM_DIRECTORY }} | |
env: | |
TF_VAR_sdk_layer_name: opentelemetry-${{ matrix.language }}-${{ matrix.sample-app }}-${{ matrix.instrumentation-type }}-${{ matrix.architecture }}-${{ github.run_id }} | |
TF_VAR_function_name: ${{ env.TERRAFORM_LAMBDA_FUNCTION_NAME }} | |
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 SDK layer arn | |
id: extract-sdk-layer-arn | |
if: ${{ matrix.language != 'dotnet' && matrix.language != 'go' }} | |
run: terraform output -raw sdk_layer_arn | |
working-directory: ${{ env.TERRAFORM_DIRECTORY }} | |
- name: Output annotations | |
if: ${{ matrix.language != 'dotnet' && matrix.language != 'go' }} | |
run: | | |
echo "::warning::Function: ${{ env.TERRAFORM_LAMBDA_FUNCTION_NAME }}" | |
echo "::warning::SDK Layer ARN: ${{ steps.extract-sdk-layer-arn.outputs.stdout }}" | |
- 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 | |
run: | | |
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" | |
- name: Destroy terraform | |
if: always() | |
run: terraform destroy -auto-approve | |
working-directory: ${{ env.TERRAFORM_DIRECTORY }} | |
env: | |
TF_VAR_architecture: ${{ env.LAMBDA_FUNCTION_ARCH }} | |
python-runtime-test: | |
concurrency: | |
group: python-runtime-test | |
cancel-in-progress: false | |
uses: ./.github/workflows/main-build-python.yml | |
secrets: inherit | |
with: | |
caller-workflow-name: 'main-build' | |
java-runtime-test: | |
concurrency: | |
group: java-runtime-test | |
cancel-in-progress: false | |
uses: ./.github/workflows/main-build-java.yml | |
secrets: inherit | |
with: | |
caller-workflow-name: 'main-build' | |
publish-build-status: | |
needs: [integration-test, python-runtime-test, java-runtime-test] | |
if: ${{ always() }} | |
uses: ./.github/workflows/publish-status.yml | |
with: | |
namespace: 'ADOT/GitHubActions' | |
repository: ${{ github.repository }} | |
branch: ${{ github.ref_name }} | |
workflow: main-build | |
success: ${{ needs.integration-test.result == 'success' && needs.python-runtime-test.result == 'success' && needs.java-runtime-test.result == 'success' }} | |
region: us-west-2 | |
secrets: | |
roleArn: ${{ secrets.METRICS_ROLE_ARN }} |