diff --git a/.github/workflows/application-signals-e2e-test.yml b/.github/workflows/application-signals-e2e-test.yml index d521c4637..010b55aab 100644 --- a/.github/workflows/application-signals-e2e-test.yml +++ b/.github/workflows/application-signals-e2e-test.yml @@ -19,54 +19,54 @@ permissions: id-token: write contents: read -#concurrency: -# group: '${{ github.workflow }} @ ${{ inputs.aws-region }}' -# cancel-in-progress: false +concurrency: + group: '${{ github.workflow }} @ ${{ inputs.aws-region }}' + cancel-in-progress: false jobs: -# upload-main-build: -# runs-on: ubuntu-latest -# steps: -# - name: Configure AWS Credentials -# uses: aws-actions/configure-aws-credentials@v4 -# with: -# role-to-assume: arn:aws:iam::${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ACCOUNT_ID }}:role/${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ROLE_NAME }} -# aws-region: us-east-1 -# -# - uses: actions/download-artifact@v3 -# with: -# name: ${{ inputs.staging-wheel-name }} -# -# - name: Upload main-build adot.whl to s3 -# run: aws s3 cp ${{ inputs.staging-wheel-name }} s3://adot-main-build-staging-jar/${{ inputs.staging-wheel-name }} -# -# python-ec2-default-e2e-test: -# needs: [ upload-main-build ] -# uses: aws-observability/aws-application-signals-test-framework/.github/workflows/python-ec2-default-e2e-test.yml@consolidate-release -# secrets: inherit -# with: -# aws-region: us-east-1 -# staging-wheel-name: ${{ inputs.staging-wheel-name }} -# caller-workflow-name: 'main-build' -# -# python-ec2-asg-e2e-test: -# needs: [ upload-main-build ] -# uses: aws-observability/aws-application-signals-test-framework/.github/workflows/python-ec2-asg-e2e-test.yml@consolidate-release -# secrets: inherit -# with: -# aws-region: us-east-1 -# staging-wheel-name: ${{ inputs.staging-wheel-name }} -# caller-workflow-name: 'main-build' -# -# python-eks-e2e-test: -# uses: aws-observability/aws-application-signals-test-framework/.github/workflows/python-eks-e2e-test.yml@consolidate-release -# secrets: inherit -# with: -# aws-region: us-east-1 -# test-cluster-name: 'e2e-python-adot-test' -# adot-image-name: 637423224110.dkr.ecr.us-east-1.amazonaws.com/aws-observability/adot-autoinstrumentation-python-staging:0.2.0.dev0-21fc235 -# caller-workflow-name: 'main-build' + upload-main-build: + runs-on: ubuntu-latest + steps: + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v4 + with: + role-to-assume: arn:aws:iam::${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ACCOUNT_ID }}:role/${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ROLE_NAME }} + aws-region: us-east-1 + + - uses: actions/download-artifact@v3 + with: + name: ${{ inputs.staging-wheel-name }} + + - name: Upload main-build adot.whl to s3 + run: aws s3 cp ${{ inputs.staging-wheel-name }} s3://adot-main-build-staging-jar/${{ inputs.staging-wheel-name }} + + python-ec2-default-e2e-test: + needs: [ upload-main-build ] + uses: aws-observability/aws-application-signals-test-framework/.github/workflows/python-ec2-default-e2e-test.yml@consolidate-release + secrets: inherit + with: + aws-region: us-east-1 + staging-wheel-name: ${{ inputs.staging-wheel-name }} + caller-workflow-name: 'main-build' + + python-ec2-asg-e2e-test: + needs: [ upload-main-build ] + uses: aws-observability/aws-application-signals-test-framework/.github/workflows/python-ec2-asg-e2e-test.yml@consolidate-release + secrets: inherit + with: + aws-region: us-east-1 + staging-wheel-name: ${{ inputs.staging-wheel-name }} + caller-workflow-name: 'main-build' + + python-eks-e2e-test: + uses: aws-observability/aws-application-signals-test-framework/.github/workflows/python-eks-e2e-test.yml@consolidate-release + secrets: inherit + with: + aws-region: us-east-1 + test-cluster-name: 'e2e-python-adot-test' + adot-image-name: 637423224110.dkr.ecr.us-east-1.amazonaws.com/aws-observability/adot-autoinstrumentation-python-staging:0.2.0.dev0-21fc235 + caller-workflow-name: 'main-build' python-k8s-e2e-test: uses: aws-observability/aws-application-signals-test-framework/.github/workflows/python-k8s-e2e-test.yml@consolidate-release diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3ddde7ba1..484e1e215 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,96 +9,96 @@ env: STAGING_ECR_REPOSITORY: aws-observability/adot-autoinstrumentation-python-staging STAGING_S3_BUCKET: ${{ secrets.STAGING_BUCKET_NAME }} -#concurrency: -# group: python-instrumentation-main-build -# cancel-in-progress: false +concurrency: + group: python-instrumentation-main-build + cancel-in-progress: false permissions: id-token: write contents: read jobs: -# build: -# runs-on: ubuntu-latest -# outputs: -# aws_default_region: ${{ steps.python_output.outputs.awsDefaultRegion}} -# python_image_tag: ${{ steps.python_output.outputs.python_image_tag}} -# staging_image: ${{ steps.python_output.outputs.stagingImage}} -# staging_registry: ${{ steps.python_output.outputs.stagingRegistry}} -# staging_repository: ${{ steps.python_output.outputs.stagingRepository}} -# staging_wheel_file: ${{ steps.staging_wheel_output.outputs.STAGING_WHEEL}} -# steps: -# - name: Checkout Contrib Repo @ SHA - ${{ github.sha }} -# uses: actions/checkout@v4 -# -# - name: Get Python Distro Output -# id: python_output -# run: | -# pkg_version=$(grep '__version__' ./aws-opentelemetry-distro/src/amazon/opentelemetry/distro/version.py | awk -F '"' '{print $2}') -# echo "ADOT_PYTHON_VERSION=$pkg_version" >> $GITHUB_OUTPUT -# shortsha="$(git rev-parse --short HEAD)" -# echo "SHORT_SHA=$shortsha" >> $GITHUB_ENV -# python_distro_tag=$pkg_version-$shortsha -# echo "awsDefaultRegion=${{ env.AWS_DEFAULT_REGION }}" >> $GITHUB_OUTPUT -# echo "python_image_tag=$python_distro_tag" >> $GITHUB_OUTPUT -# echo "stagingRegistry=${{ env.STAGING_ECR_REGISTRY }}" >> $GITHUB_OUTPUT -# echo "stagingRepository=${{ env.STAGING_ECR_REPOSITORY }}" >> $GITHUB_OUTPUT -# echo "stagingImage=${{ env.STAGING_ECR_REGISTRY }}/${{ env.STAGING_ECR_REPOSITORY }}:$python_distro_tag" >> $GITHUB_OUTPUT -# -# - name: Build and Push Wheel and Image Files -# uses: ./.github/actions/artifacts_build -# with: -# aws-region: ${{ env.AWS_DEFAULT_REGION }} -# image_uri_with_tag: ${{ steps.python_output.outputs.stagingImage}} -# image_registry: ${{ env.STAGING_ECR_REGISTRY }} -# snapshot-ecr-role: ${{ secrets.AWS_ASSUME_ROLE_ARN }} -# push_image: true -# load_image: false -# python_version: "3.10" -# package_name: aws-opentelemetry-distro -# os: ubuntu-latest -# -# # workaround: prefixing the short-sha with a 0 to create a valid -# # wheel file name as per https://peps.python.org/pep-0427/#file-name-convention -# - name: Output Wheel File Name -# id: staging_wheel_output -# run: | -# staging_wheel="aws_opentelemetry_distro-${{ steps.python_output.outputs.ADOT_PYTHON_VERSION}}-0${{ env.SHORT_SHA }}-py3-none-any.whl" -# echo "STAGING_WHEEL=$staging_wheel" >> $GITHUB_OUTPUT -# cd ./dist -# cp aws_opentelemetry_distro-${{ steps.python_output.outputs.ADOT_PYTHON_VERSION}}-py3-none-any.whl $staging_wheel -# -# - name: Upload wheel to S3 -# run: | -# aws s3 cp dist/${{ steps.staging_wheel_output.outputs.STAGING_WHEEL}} s3://${{ env.STAGING_S3_BUCKET }} -# -# - name: Upload Wheel to GitHub Actions -# uses: actions/upload-artifact@v3 -# with: -# name: ${{ steps.staging_wheel_output.outputs.STAGING_WHEEL}} -# path: dist/${{ steps.staging_wheel_output.outputs.STAGING_WHEEL}} -# -# - name: Set up and run contract tests with pytest -# run: | -# bash scripts/set-up-contract-tests.sh -# pip install pytest -# pytest contract-tests/tests + build: + runs-on: ubuntu-latest + outputs: + aws_default_region: ${{ steps.python_output.outputs.awsDefaultRegion}} + python_image_tag: ${{ steps.python_output.outputs.python_image_tag}} + staging_image: ${{ steps.python_output.outputs.stagingImage}} + staging_registry: ${{ steps.python_output.outputs.stagingRegistry}} + staging_repository: ${{ steps.python_output.outputs.stagingRepository}} + staging_wheel_file: ${{ steps.staging_wheel_output.outputs.STAGING_WHEEL}} + steps: + - name: Checkout Contrib Repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Get Python Distro Output + id: python_output + run: | + pkg_version=$(grep '__version__' ./aws-opentelemetry-distro/src/amazon/opentelemetry/distro/version.py | awk -F '"' '{print $2}') + echo "ADOT_PYTHON_VERSION=$pkg_version" >> $GITHUB_OUTPUT + shortsha="$(git rev-parse --short HEAD)" + echo "SHORT_SHA=$shortsha" >> $GITHUB_ENV + python_distro_tag=$pkg_version-$shortsha + echo "awsDefaultRegion=${{ env.AWS_DEFAULT_REGION }}" >> $GITHUB_OUTPUT + echo "python_image_tag=$python_distro_tag" >> $GITHUB_OUTPUT + echo "stagingRegistry=${{ env.STAGING_ECR_REGISTRY }}" >> $GITHUB_OUTPUT + echo "stagingRepository=${{ env.STAGING_ECR_REPOSITORY }}" >> $GITHUB_OUTPUT + echo "stagingImage=${{ env.STAGING_ECR_REGISTRY }}/${{ env.STAGING_ECR_REPOSITORY }}:$python_distro_tag" >> $GITHUB_OUTPUT + + - name: Build and Push Wheel and Image Files + uses: ./.github/actions/artifacts_build + with: + aws-region: ${{ env.AWS_DEFAULT_REGION }} + image_uri_with_tag: ${{ steps.python_output.outputs.stagingImage}} + image_registry: ${{ env.STAGING_ECR_REGISTRY }} + snapshot-ecr-role: ${{ secrets.AWS_ASSUME_ROLE_ARN }} + push_image: true + load_image: false + python_version: "3.10" + package_name: aws-opentelemetry-distro + os: ubuntu-latest + + # workaround: prefixing the short-sha with a 0 to create a valid + # wheel file name as per https://peps.python.org/pep-0427/#file-name-convention + - name: Output Wheel File Name + id: staging_wheel_output + run: | + staging_wheel="aws_opentelemetry_distro-${{ steps.python_output.outputs.ADOT_PYTHON_VERSION}}-0${{ env.SHORT_SHA }}-py3-none-any.whl" + echo "STAGING_WHEEL=$staging_wheel" >> $GITHUB_OUTPUT + cd ./dist + cp aws_opentelemetry_distro-${{ steps.python_output.outputs.ADOT_PYTHON_VERSION}}-py3-none-any.whl $staging_wheel + + - name: Upload wheel to S3 + run: | + aws s3 cp dist/${{ steps.staging_wheel_output.outputs.STAGING_WHEEL}} s3://${{ env.STAGING_S3_BUCKET }} + + - name: Upload Wheel to GitHub Actions + uses: actions/upload-artifact@v3 + with: + name: ${{ steps.staging_wheel_output.outputs.STAGING_WHEEL}} + path: dist/${{ steps.staging_wheel_output.outputs.STAGING_WHEEL}} + + - name: Set up and run contract tests with pytest + run: | + bash scripts/set-up-contract-tests.sh + pip install pytest + pytest contract-tests/tests # application-signals-e2e-test: name: "Application Signals E2E Test" -# needs: [ build ] + needs: [ build ] uses: ./.github/workflows/application-signals-e2e-test.yml secrets: inherit permissions: id-token: write contents: read with: - staging-wheel-name: aws_opentelemetry_distro-0.2.0.dev0-062311f1-py3-none-any.whl - adot-image-name: 637423224110.dkr.ecr.us-east-1.amazonaws.com/aws-observability/adot-autoinstrumentation-python-staging:0.2.0.dev0-62311f1 -# staging-wheel-name: ${{ needs.build.outputs.staging_wheel_file }} -# adot-image-name: ${{ needs.build.outputs.staging_registry }}/aws-observability/adot-autoinstrumentation-python-staging:${{ needs.build.outputs.python_image_tag }} +# staging-wheel-name: aws_opentelemetry_distro-0.2.0.dev0-062311f1-py3-none-any.whl +# adot-image-name: 637423224110.dkr.ecr.us-east-1.amazonaws.com/aws-observability/adot-autoinstrumentation-python-staging:0.2.0.dev0-62311f1 + staging-wheel-name: ${{ needs.build.outputs.staging_wheel_file }} + adot-image-name: ${{ needs.build.outputs.staging_registry }}/aws-observability/adot-autoinstrumentation-python-staging:${{ needs.build.outputs.python_image_tag }}