Skip to content

Commit

Permalink
Add Github case for Python EC2 Default (#201)
Browse files Browse the repository at this point in the history
*Issue description:*
We need to also test whether OTEL Python is available in Github

*Description of changes:*
Add test to check if OTEL python from Github works

*Rollback procedure:*
Revert

Test run:
https://github.com/aws-observability/aws-application-signals-test-framework/actions/runs/10637583389/job/29491730320

By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 license.
  • Loading branch information
harrryr authored Sep 10, 2024
1 parent 4636b6a commit 32a3245
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 4 deletions.
13 changes: 11 additions & 2 deletions .github/workflows/python-ec2-canary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ permissions:
contents: read

jobs:
default:
github:
strategy:
fail-fast: false
matrix:
Expand All @@ -28,4 +28,13 @@ jobs:
secrets: inherit
with:
aws-region: ${{ matrix.aws-region }}
caller-workflow-name: 'appsignals-python-e2e-ec2-canary-test'
caller-workflow-name: 'appsignals-python-e2e-ec2-canary-test'
staging-wheel-name: 'aws_opentelemetry_distro-0.3.0-py3-none-any.whl'

pypi:
uses: ./.github/workflows/python-ec2-default-retry.yml
secrets: inherit
with:
aws-region: 'us-east-1'
caller-workflow-name: 'appsignals-python-e2e-ec2-pypi-canary-test'
otel-source: 'pypi'
12 changes: 12 additions & 0 deletions .github/workflows/python-ec2-default-retry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ on:
caller-workflow-name:
required: true
type: string
staging-wheel-name:
required: false
default: 'aws-opentelemetry-distro'
type: string
otel-source:
required: false
type: string
default: 'github'

permissions:
id-token: write
Expand All @@ -26,6 +34,8 @@ jobs:
with:
aws-region: ${{ inputs.aws-region }}
caller-workflow-name: ${{ inputs.caller-workflow-name }}
staging-wheel-name: ${{ inputs.staging-wheel-name }}
otel-source: ${{ inputs.otel-source }}

python-ec2-default-attempt-2:
needs: [ python-ec2-default-attempt-1 ]
Expand All @@ -35,6 +45,8 @@ jobs:
with:
aws-region: ${{ inputs.aws-region }}
caller-workflow-name: ${{ inputs.caller-workflow-name }}
staging-wheel-name: ${{ inputs.staging-wheel-name }}
otel-source: ${{ inputs.otel-source }}

publish-metric-attempt-1:
needs: [ python-ec2-default-attempt-1, python-ec2-default-attempt-2 ]
Expand Down
11 changes: 9 additions & 2 deletions .github/workflows/python-ec2-default-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ on:
required: false
default: 'aws-opentelemetry-distro'
type: string
otel-source:
required: false
type: string
default: 'github'
outputs:
job-started:
value: ${{ jobs.python-ec2-default.outputs.job-started }}
Expand All @@ -32,6 +36,7 @@ env:
E2E_TEST_AWS_REGION: ${{ inputs.aws-region }}
CALLER_WORKFLOW_NAME: ${{ inputs.caller-workflow-name }}
ADOT_WHEEL_NAME: ${{ inputs.staging-wheel-name }}
OTEL_SOURCE: ${{ inputs.otel-source }}
SAMPLE_APP_ZIP: s3://aws-appsignals-sample-app-prod-${{ inputs.aws-region }}/python-sample-app.zip
E2E_TEST_ACCOUNT_ID: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ACCOUNT_ID }}
E2E_TEST_ROLE_NAME: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ROLE_NAME }}
Expand Down Expand Up @@ -70,7 +75,7 @@ jobs:
sleep_time: 60

- name: Generate testing id
run: echo TESTING_ID="${{ github.job }}-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}" >> $GITHUB_ENV
run: echo TESTING_ID="${{ github.run_id }}-${{ github.run_number }}-${RANDOM}" >> $GITHUB_ENV

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
Expand All @@ -96,8 +101,10 @@ jobs:
if [ "${{ github.event.repository.name }}" = "aws-otel-python-instrumentation" ]; then
# Reusing the adot-main-build-staging-jar bucket to store the python wheel file
echo GET_ADOT_WHEEL_COMMAND="aws s3 cp s3://adot-main-build-staging-jar/${{ env.ADOT_WHEEL_NAME }} ./${{ env.ADOT_WHEEL_NAME }} && python3.9 -m pip install ${{ env.ADOT_WHEEL_NAME }}" >> $GITHUB_ENV
else
elif [ "${{ env.OTEL_SOURCE }}" == "pypi" ]; then
echo GET_ADOT_WHEEL_COMMAND="python3.9 -m pip install ${{ env.ADOT_WHEEL_NAME }}" >> $GITHUB_ENV
else
echo GET_ADOT_WHEEL_COMMAND="wget -O ${{ env.ADOT_WHEEL_NAME }} https://github.com/aws-observability/aws-otel-python-instrumentation/releases/latest/download/${{ env.ADOT_WHEEL_NAME }} && python3.9 -m pip install ${{ env.ADOT_WHEEL_NAME }}" >> $GITHUB_ENV
fi
- name: Set Get CW Agent command environment variable
Expand Down

0 comments on commit 32a3245

Please sign in to comment.