Skip to content

Commit 318a8e3

Browse files
committed
Test
1 parent dda7afb commit 318a8e3

File tree

2 files changed

+101
-4
lines changed

2 files changed

+101
-4
lines changed

.github/workflows/application-signals-e2e-test.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343

4444
python-ec2-default-e2e-test:
4545
needs: [ upload-main-build ]
46-
uses: aws-observability/aws-application-signals-test-framework/.github/workflows/python-ec2-default-e2e-test.yml@consolidate-release
46+
uses: aws-observability/aws-application-signals-test-framework/.github/workflows/python-ec2-default-e2e-test.yml@main
4747
secrets: inherit
4848
with:
4949
aws-region: us-east-1
@@ -52,15 +52,15 @@ jobs:
5252

5353
python-ec2-asg-e2e-test:
5454
needs: [ upload-main-build ]
55-
uses: aws-observability/aws-application-signals-test-framework/.github/workflows/python-ec2-asg-e2e-test.yml@consolidate-release
55+
uses: aws-observability/aws-application-signals-test-framework/.github/workflows/python-ec2-asg-e2e-test.yml@main
5656
secrets: inherit
5757
with:
5858
aws-region: us-east-1
5959
staging-wheel-name: aws_opentelemetry_distro-0.2.0.dev0-07ca0f26-py3-none-any.whl
6060
caller-workflow-name: 'main-build'
6161

6262
python-eks-e2e-test:
63-
uses: aws-observability/aws-application-signals-test-framework/.github/workflows/python-eks-e2e-test.yml@consolidate-release
63+
uses: aws-observability/aws-application-signals-test-framework/.github/workflows/python-eks-e2e-test.yml@main
6464
secrets: inherit
6565
with:
6666
aws-region: us-east-1
@@ -69,7 +69,7 @@ jobs:
6969
caller-workflow-name: 'main-build'
7070

7171
python-k8s-e2e-test:
72-
uses: aws-observability/aws-application-signals-test-framework/.github/workflows/python-k8s-e2e-test.yml@consolidate-release
72+
uses: aws-observability/aws-application-signals-test-framework/.github/workflows/python-k8s-e2e-test.yml@main
7373
secrets: inherit
7474
with:
7575
aws-region: us-east-1

.github/workflows/test.yml

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
# This workflow build the aws-opentelemetry-distro wheel file, upload to staging S3 bucket, and build project docker image then push to staging ECR
2+
name: Python Instrumentation Main Build
3+
on:
4+
push:
5+
6+
env:
7+
AWS_DEFAULT_REGION: us-east-1
8+
STAGING_ECR_REGISTRY: 637423224110.dkr.ecr.us-east-1.amazonaws.com
9+
STAGING_ECR_REPOSITORY: aws-observability/adot-autoinstrumentation-python-staging
10+
STAGING_S3_BUCKET: ${{ secrets.STAGING_BUCKET_NAME }}
11+
12+
concurrency:
13+
group: python-instrumentation-main-build
14+
cancel-in-progress: false
15+
16+
permissions:
17+
id-token: write
18+
contents: read
19+
20+
jobs:
21+
build:
22+
runs-on: ubuntu-latest
23+
outputs:
24+
aws_default_region: ${{ steps.python_output.outputs.awsDefaultRegion}}
25+
python_image_tag: ${{ steps.python_output.outputs.python_image_tag}}
26+
staging_image: ${{ steps.python_output.outputs.stagingImage}}
27+
staging_registry: ${{ steps.python_output.outputs.stagingRegistry}}
28+
staging_repository: ${{ steps.python_output.outputs.stagingRepository}}
29+
staging_wheel_file: ${{ steps.staging_wheel_output.outputs.STAGING_WHEEL}}
30+
steps:
31+
- name: Checkout Contrib Repo @ SHA - ${{ github.sha }}
32+
uses: actions/checkout@v4
33+
34+
- name: Get Python Distro Output
35+
id: python_output
36+
run: |
37+
pkg_version=$(grep '__version__' ./aws-opentelemetry-distro/src/amazon/opentelemetry/distro/version.py | awk -F '"' '{print $2}')
38+
echo "ADOT_PYTHON_VERSION=$pkg_version" >> $GITHUB_OUTPUT
39+
shortsha="$(git rev-parse --short HEAD)"
40+
echo "SHORT_SHA=$shortsha" >> $GITHUB_ENV
41+
python_distro_tag=$pkg_version-$shortsha
42+
echo "awsDefaultRegion=${{ env.AWS_DEFAULT_REGION }}" >> $GITHUB_OUTPUT
43+
echo "python_image_tag=$python_distro_tag" >> $GITHUB_OUTPUT
44+
echo "stagingRegistry=${{ env.STAGING_ECR_REGISTRY }}" >> $GITHUB_OUTPUT
45+
echo "stagingRepository=${{ env.STAGING_ECR_REPOSITORY }}" >> $GITHUB_OUTPUT
46+
echo "stagingImage=${{ env.STAGING_ECR_REGISTRY }}/${{ env.STAGING_ECR_REPOSITORY }}:$python_distro_tag" >> $GITHUB_OUTPUT
47+
48+
- name: Build and Push Wheel and Image Files
49+
uses: ./.github/actions/artifacts_build
50+
with:
51+
aws-region: ${{ env.AWS_DEFAULT_REGION }}
52+
image_uri_with_tag: ${{ steps.python_output.outputs.stagingImage}}
53+
image_registry: ${{ env.STAGING_ECR_REGISTRY }}
54+
snapshot-ecr-role: ${{ secrets.AWS_ASSUME_ROLE_ARN }}
55+
push_image: true
56+
load_image: false
57+
python_version: "3.10"
58+
package_name: aws-opentelemetry-distro
59+
os: ubuntu-latest
60+
61+
# workaround: prefixing the short-sha with a 0 to create a valid
62+
# wheel file name as per https://peps.python.org/pep-0427/#file-name-convention
63+
- name: Output Wheel File Name
64+
id: staging_wheel_output
65+
run: |
66+
staging_wheel="aws_opentelemetry_distro-${{ steps.python_output.outputs.ADOT_PYTHON_VERSION}}-0${{ env.SHORT_SHA }}-py3-none-any.whl"
67+
echo "STAGING_WHEEL=$staging_wheel" >> $GITHUB_OUTPUT
68+
cd ./dist
69+
cp aws_opentelemetry_distro-${{ steps.python_output.outputs.ADOT_PYTHON_VERSION}}-py3-none-any.whl $staging_wheel
70+
71+
- name: Upload wheel to S3
72+
run: |
73+
aws s3 cp dist/${{ steps.staging_wheel_output.outputs.STAGING_WHEEL}} s3://${{ env.STAGING_S3_BUCKET }}
74+
75+
- name: Upload Wheel to GitHub Actions
76+
uses: actions/upload-artifact@v3
77+
with:
78+
name: ${{ steps.staging_wheel_output.outputs.STAGING_WHEEL}}
79+
path: dist/${{ steps.staging_wheel_output.outputs.STAGING_WHEEL}}
80+
81+
- name: Set up and run contract tests with pytest
82+
run: |
83+
bash scripts/set-up-contract-tests.sh
84+
pip install pytest
85+
pytest contract-tests/tests
86+
87+
application-signals-e2e-test:
88+
name: "Application Signals E2E Test"
89+
needs: [ build ]
90+
uses: ./.github/workflows/application-signals-e2e-test.yml
91+
secrets: inherit
92+
permissions:
93+
id-token: write
94+
contents: read
95+
with:
96+
staging-wheel-name: ${{ needs.build.outputs.staging_wheel_file }}
97+
adot-image-name: ${{ needs.build.outputs.staging_registry }}/aws-observability/adot-autoinstrumentation-python-staging:${{ needs.build.outputs.python_image_tag }}

0 commit comments

Comments
 (0)