Skip to content
6 changes: 6 additions & 0 deletions .github/workflows/build-artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ jobs:
name: ${{ env.ARTIFACT_NAME }}-${{ env.LANGUAGE }}-${{ matrix.architecture }}-artifacts
path: ${{ env.LANGUAGE }}/${{ env.ARTIFACT_ARCHIVE_BASE_NAME }}-${{ matrix.architecture }}.zip
if-no-files-found: error
overwrite: true
- name: Rename sample-app java artifact
if: env.LANGUAGE == 'java' && success()
run: |
Expand All @@ -102,13 +103,15 @@ jobs:
name: sample-app-${{ env.LANGUAGE }}-${{ matrix.architecture }}-artifacts
path: opentelemetry-lambda/${{ env.LANGUAGE }}/sample-apps/aws-sdk/build/libs/java-sample-app.jar
if-no-files-found: error
overwrite: true
- name: Upload artifacts - nodejs
if: env.LANGUAGE == 'nodejs' && success()
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACT_NAME }}-${{ env.LANGUAGE }}-${{ matrix.architecture }}-artifacts
path: ${{ env.LANGUAGE }}/${{ env.ARTIFACT_ARCHIVE_BASE_NAME }}-${{ matrix.architecture }}.zip
if-no-files-found: error
overwrite: true
- name: Rename sample-app nodejs artifact
if: env.LANGUAGE == 'nodejs' && success()
run: |
Expand All @@ -121,13 +124,15 @@ jobs:
name: sample-app-${{ env.LANGUAGE }}-${{ matrix.architecture }}-artifacts
path: opentelemetry-lambda/${{ env.LANGUAGE }}/sample-apps/aws-sdk/build/nodejs-sample-app.zip
if-no-files-found: error
overwrite: true
- name: Upload artifacts - python layer
if: env.LANGUAGE == 'python' && success()
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACT_NAME }}-${{ env.LANGUAGE }}-${{ matrix.architecture }}-artifacts
path: ${{ env.LANGUAGE }}/${{ env.ARTIFACT_ARCHIVE_BASE_NAME }}-${{ matrix.architecture }}.zip
if-no-files-found: error
overwrite: true
- name: Rename sample-app python artifact
if: env.LANGUAGE == 'python' && success()
run: |
Expand All @@ -140,3 +145,4 @@ jobs:
name: sample-app-${{ env.LANGUAGE }}-${{ matrix.architecture }}-artifacts
path: opentelemetry-lambda/${{ env.LANGUAGE }}/sample-apps/build/python-sample-app.zip
if-no-files-found: error
overwrite: true
4 changes: 2 additions & 2 deletions .github/workflows/pr-build-java.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ jobs:
BUILD_COMMAND: make build-java
LANGUAGE: java
ARTIFACT_ARCHIVE_BASE_NAME: opentelemetry-java-wrapper
ARTIFACT_NAME: ${{ github.head_ref }}
ARTIFACT_NAME: ${{ github.run_id }}

create-dev-lambda-layer:
needs: build-artifacts
uses: ./.github/workflows/publish-dev-layer.yml
with:
ARTIFACT_ARCHIVE_BASE_NAME: opentelemetry-java-wrapper
ARTIFACT_NAME: ${{ github.head_ref }}
ARTIFACT_NAME: ${{ github.run_id }}
LANGUAGE: java

run-tests:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pr-build-nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ jobs:
BUILD_COMMAND: make build-nodejs
LANGUAGE: nodejs
ARTIFACT_ARCHIVE_BASE_NAME: opentelemetry-nodejs
ARTIFACT_NAME: ${{ github.head_ref }}
ARTIFACT_NAME: ${{ github.run_id }}

create-dev-lambda-layer:
needs: build-artifacts
uses: ./.github/workflows/publish-dev-layer.yml
with:
ARTIFACT_ARCHIVE_BASE_NAME: opentelemetry-nodejs
ARTIFACT_NAME: ${{ github.head_ref }}
ARTIFACT_NAME: ${{ github.run_id }}
LANGUAGE: nodejs

run-tests:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pr-build-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ jobs:
BUILD_COMMAND: make build-python
LANGUAGE: python
ARTIFACT_ARCHIVE_BASE_NAME: opentelemetry-python
ARTIFACT_NAME: ${{ github.head_ref }}
ARTIFACT_NAME: ${{ github.run_id }}

create-dev-lambda-layer:
needs: build-artifacts
uses: ./.github/workflows/publish-dev-layer.yml
with:
ARTIFACT_ARCHIVE_BASE_NAME: opentelemetry-python
ARTIFACT_NAME: ${{ github.head_ref }}
ARTIFACT_NAME: ${{ github.run_id }}
LANGUAGE: python

run-tests:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-dev-layer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ jobs:
aws_region: [ eu-central-1 ]
env:
LANGUAGE: ${{ inputs.LANGUAGE }}
LAYER_NAME: sumologic-otel-lambda-dev-${{ inputs.LANGUAGE }}-${{ matrix.architecture }}-${{ github.run_id }}
LAYER_NAME: sumologic-otel-lambda-dev-${{ inputs.LANGUAGE }}-${{ matrix.architecture }}-${{ github.run_id }}-${{ github.run_attempt }}
ARCHITECTURE: ${{ matrix.architecture }}
ARTIFACT_ARCHIVE_BASE_NAME: ${{ inputs.ARTIFACT_ARCHIVE_BASE_NAME }}
ARTIFACT_NAME: ${{ inputs.ARTIFACT_NAME }}
BUCKET_NAME: sumologic-otel-lambda-dev-${{ github.run_id }}-${{ matrix.architecture }}
BUCKET_NAME: sumologic-otel-lambda-dev-${{ github.run_id }}-${{ github.run_attempt }}-${{ matrix.architecture }}
BUCKET_KEY: layer-${{ matrix.architecture }}-${{ matrix.aws_region }}-.zip
DIRECTORY: ${{ inputs.LANGUAGE }}
REGION: ${{ matrix.aws_region }}
Expand Down
48 changes: 27 additions & 21 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,16 @@ jobs:
receivermockendpoint: ${{ steps.get-receiver-mock-endpoint.outputs.endpoint }}
env:
BUCKET_NAME: lambda-tests-terraform-state-bucket
BUCKET_KEY: receivermock.${{ matrix.architecture}}.${{ inputs.LANGUAGE }}/terraform_state.tfstate
BUCKET_KEY: receivermock.${{ github.run_id }}.${{ inputs.LANGUAGE }}/terraform_state.tfstate
LANGUAGE: ${{ inputs.LANGUAGE }}
TERRAFORM_DIRECTORY: utils/receiver-mock/deploy
steps:
- uses: actions/checkout@v4
- name: Set receiver-mock resource name
run: |
# Load balancer and target group names cap at 32 characters, so hash the run id instead of embedding it.
run_hash="$(printf '%s' '${{ github.run_id }}' | sha256sum | cut -c1-8)"
echo "TF_VAR_app_name=ll-${{ inputs.LANGUAGE }}-${run_hash}" >> "$GITHUB_ENV"
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4.0.1
env:
Expand All @@ -40,11 +45,6 @@ jobs:
role-to-assume: ${{ env.AWS_OPENID_ROLE_ARN }}
aws-region: ${{ matrix.aws_region }}
mask-aws-account-id: false
- name: Cache terraform working directory
uses: actions/cache@v3
with:
path: ${{ env.TERRAFORM_DIRECTORY }}
key: ${{ inputs.LANGUAGE }}-${{ github.run_id }}
- uses: hashicorp/setup-terraform@v3
with:
terraform_wrapper: false
Expand All @@ -55,21 +55,17 @@ jobs:
--backend-config "key=${{ env.BUCKET_KEY }}" \
--backend-config "region=${{ matrix.aws_region }}" \
--backend-config "encrypt=true" \
--backend-config "dynamodb_table=SumoOtelLambdaTfStateLock"
--backend-config "use_lockfile=true"
working-directory: ${{ env.TERRAFORM_DIRECTORY }}
- name: Apply terraform
run: terraform apply -auto-approve
working-directory: ${{ env.TERRAFORM_DIRECTORY }}
env:
TF_VAR_app_name: lambda-layers-${{ inputs.LANGUAGE }}
- name: Wait for task container to be ready
run: sleep 30
- name: Get receiver-mock endpoint
id: get-receiver-mock-endpoint
run: echo "endpoint=$(terraform output -raw loadbalancer_ip)" >> $GITHUB_OUTPUT
working-directory: ${{ env.TERRAFORM_DIRECTORY }}
env:
TF_VAR_app_name: lambda-layers-${{ inputs.LANGUAGE }}
run-tests:
name: Run tests
runs-on: ubuntu-22.04
Expand All @@ -78,12 +74,13 @@ jobs:
id-token: write
contents: read
strategy:
fail-fast: false
matrix:
architecture: [ amd64, arm64 ]
aws_region: [ eu-central-1 ]
env:
BUCKET_NAME: lambda-tests-terraform-state-bucket
BUCKET_KEY: ${{ matrix.architecture}}.${{ inputs.LANGUAGE }}/terraform_state.tfstate
BUCKET_KEY: ${{ matrix.architecture}}.${{ inputs.LANGUAGE }}.${{ github.run_id }}/terraform_state.tfstate
LANGUAGE: ${{ inputs.LANGUAGE }}
TERRAFORM_DIRECTORY: ${{ inputs.LANGUAGE }}/tests/deploy
steps:
Expand Down Expand Up @@ -138,7 +135,7 @@ jobs:
--backend-config "key=${{ env.BUCKET_KEY }}" \
--backend-config "region=${{ matrix.aws_region }}" \
--backend-config "encrypt=true" \
--backend-config "dynamodb_table=SumoOtelLambdaTfStateLock"
--backend-config "use_lockfile=true"
working-directory: ${{ env.TERRAFORM_DIRECTORY }}
- name: Deploy lambda sample function
run: terraform apply -auto-approve
Expand Down Expand Up @@ -170,7 +167,7 @@ jobs:
cd tests/lambdalayer
go test -v -run TestSpans${{ env.LANGUAGE }}
- name: Cleanup AWS environment
if: success()
if: always()
run: terraform destroy -auto-approve
working-directory: ${{ env.TERRAFORM_DIRECTORY }}
env:
Expand All @@ -190,9 +187,16 @@ jobs:
matrix:
aws_region: [ eu-central-1 ]
env:
BUCKET_NAME: lambda-tests-terraform-state-bucket
BUCKET_KEY: receivermock.${{ github.run_id }}.${{ inputs.LANGUAGE }}/terraform_state.tfstate
TERRAFORM_DIRECTORY: utils/receiver-mock/deploy
steps:
- uses: actions/checkout@v4
- name: Set receiver-mock resource name
run: |
# Must match the name computed in deploy-receiver-mock.
run_hash="$(printf '%s' '${{ github.run_id }}' | sha256sum | cut -c1-8)"
echo "TF_VAR_app_name=ll-${{ inputs.LANGUAGE }}-${run_hash}" >> "$GITHUB_ENV"
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4.0.1
env:
Expand All @@ -204,13 +208,15 @@ jobs:
- uses: hashicorp/setup-terraform@v3
with:
terraform_wrapper: false
- name: Cache terraform working directory
uses: actions/cache@v3
with:
path: ${{ env.TERRAFORM_DIRECTORY }}
key: ${{ inputs.LANGUAGE }}-${{ github.run_id }}
- name: Initialize terraform
run: |
terraform init \
--backend-config "bucket=${{ env.BUCKET_NAME }}" \
--backend-config "key=${{ env.BUCKET_KEY }}" \
--backend-config "region=${{ matrix.aws_region }}" \
--backend-config "encrypt=true" \
--backend-config "use_lockfile=true"
working-directory: ${{ env.TERRAFORM_DIRECTORY }}
- name: Destroy terraform
run: terraform destroy -auto-approve
working-directory: ${{ env.TERRAFORM_DIRECTORY }}
env:
TF_VAR_app_name: lambda-layers-${{ inputs.LANGUAGE }}
Loading