Update Dockerfile (#917) #613
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: Java Agent Main Build | |
on: | |
push: | |
branches: | |
- main | |
- "release/v*" | |
env: | |
AWS_DEFAULT_REGION: us-east-1 | |
TEST_TAG: public.ecr.aws/aws-observability/adot-autoinstrumentation-java:test | |
permissions: | |
id-token: write | |
contents: read | |
jobs: | |
testpatch: | |
name: Test patches applied to dependencies | |
runs-on: ubuntu-latest | |
if: ${{ startsWith(github.ref_name, 'release/v') }} | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-java@v3 | |
with: | |
java-version: 17 | |
distribution: temurin | |
- uses: gradle/wrapper-validation-action@v1 | |
- uses: ./.github/actions/patch-dependencies | |
with: | |
run_tests: "true" | |
branch: ${{ github.ref_name }} | |
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} | |
gpg_password: ${{ secrets.GPG_PASSPHRASE }} | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-java@v3 | |
with: | |
java-version: 17 | |
distribution: temurin | |
- name: Publish patched dependencies to maven local | |
uses: ./.github/actions/patch-dependencies | |
if: ${{ startsWith(github.ref_name, 'release/v') }} | |
with: | |
branch: ${{ github.ref_name }} | |
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} | |
gpg_password: ${{ secrets.GPG_PASSPHRASE }} | |
- uses: gradle/wrapper-validation-action@v1 | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
role-to-assume: ${{ secrets.AWS_ASSUME_ROLE_ARN }} | |
aws-region: ${{ env.AWS_DEFAULT_REGION }} | |
- name: Log in to AWS ECR | |
uses: docker/login-action@v1 | |
with: | |
registry: public.ecr.aws | |
- name: Build snapshot with Gradle | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: build integrationTests snapshot --stacktrace -PenableCoverage=true -PlocalDocker=true | |
env: | |
PUBLISH_USERNAME: ${{ secrets.PUBLISH_USERNAME }} | |
PUBLISH_PASSWORD: ${{ secrets.PUBLISH_PASSWORD }} | |
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} | |
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | |
- name: Get current version | |
shell: bash | |
run: | | |
echo "ADOT_JAVA_VERSION=$(./gradlew printVersion -q )" >> $GITHUB_ENV | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Build image for testing | |
uses: docker/build-push-action@v4 | |
with: | |
push: false | |
build-args: "ADOT_JAVA_VERSION=${{ env.ADOT_JAVA_VERSION }}" | |
context: . | |
platforms: linux/amd64 | |
tags: ${{ env.TEST_TAG }} | |
load: true | |
- name: Test docker image | |
shell: bash | |
run: .github/scripts/test-adot-javaagent-image.sh "${{ env.TEST_TAG }}" "${{ env.ADOT_JAVA_VERSION }}" | |
- name: Upload to GitHub Actions | |
uses: actions/upload-artifact@v2 | |
with: | |
name: aws-opentelemetry-agent.jar | |
path: otelagent/build/libs/aws-opentelemetry-agent-*.jar | |
- name: Build and push agent and testing docker images with Gradle | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: jib | |
env: | |
COMMIT_HASH: ${{ github.sha }} | |
- uses: codecov/codecov-action@v1 | |
test_Spring_App_With_Java_Agent: | |
name: Test Spring App with AWS OTel Java agent | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-java@v1 | |
with: | |
java-version: 17 | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
role-to-assume: ${{ secrets.AWS_ASSUME_ROLE_ARN }} | |
aws-region: ${{ env.AWS_DEFAULT_REGION }} | |
- name: Log in to AWS ECR | |
uses: docker/login-action@v1 | |
with: | |
registry: public.ecr.aws | |
- name: Run test containers | |
run: docker-compose up --abort-on-container-exit | |
working-directory: .github/collector | |
env: | |
INSTANCE_ID: ${{ github.run_id }}-${{ github.run_number }} | |
LISTEN_ADDRESS: 0.0.0.0:8080 | |
APP_IMAGE: public.ecr.aws/aws-otel-test/aws-otel-java-springboot:${{ github.sha }} | |
VALIDATOR_COMMAND: -c springboot-otel-trace-metric-validation.yml --endpoint http://app:8080 --metric-namespace aws-otel-integ-test -t ${{ github.run_id }}-${{ github.run_number }} | |
test_Spark_App_With_Java_Agent: | |
name: Test Spark App with AWS OTel Java agent | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-java@v1 | |
with: | |
java-version: 17 | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
role-to-assume: ${{ secrets.AWS_ASSUME_ROLE_ARN }} | |
aws-region: ${{ env.AWS_DEFAULT_REGION }} | |
- name: Log in to AWS ECR | |
uses: docker/login-action@v1 | |
with: | |
registry: public.ecr.aws | |
- name: Run test containers | |
run: docker-compose up --abort-on-container-exit | |
working-directory: .github/collector | |
env: | |
INSTANCE_ID: ${{ github.run_id }}-${{ github.run_number }} | |
LISTEN_ADDRESS: 0.0.0.0:4567 | |
APP_IMAGE: public.ecr.aws/aws-otel-test/aws-otel-java-spark:${{ github.sha }} | |
VALIDATOR_COMMAND: -c spark-otel-trace-metric-validation.yml --endpoint http://app:4567 --metric-namespace aws-otel-integ-test -t ${{ github.run_id }}-${{ github.run_number }} | |
test_Spark_AWS_SDK_V1_App_With_Java_Agent: | |
name: Test Spark App (AWS SDK v1) with AWS OTel Java agent | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-java@v1 | |
with: | |
java-version: 17 | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
role-to-assume: ${{ secrets.AWS_ASSUME_ROLE_ARN }} | |
aws-region: ${{ env.AWS_DEFAULT_REGION }} | |
- name: Log in to AWS ECR | |
uses: docker/login-action@v1 | |
with: | |
registry: public.ecr.aws | |
- name: Run test containers | |
run: docker-compose up --abort-on-container-exit | |
working-directory: .github/collector | |
env: | |
INSTANCE_ID: ${{ github.run_id }}-${{ github.run_number }} | |
LISTEN_ADDRESS: 0.0.0.0:4567 | |
APP_IMAGE: public.ecr.aws/aws-otel-test/aws-otel-java-spark-awssdkv1:${{ github.sha }} | |
VALIDATOR_COMMAND: -c spark-otel-trace-metric-validation.yml --endpoint http://app:4567 --metric-namespace aws-otel-integ-test -t ${{ github.run_id }}-${{ github.run_number }} | |
publish-build-status: | |
needs: [test_Spring_App_With_Java_Agent, test_Spark_App_With_Java_Agent, test_Spark_AWS_SDK_V1_App_With_Java_Agent] | |
if: ${{ always() }} | |
uses: ./.github/workflows/publish-status.yml | |
with: | |
namespace: 'ADOT/GitHubActions' | |
repository: ${{ github.repository }} | |
branch: ${{ github.ref_name }} | |
workflow: main-build | |
success: ${{ needs.test_Spring_App_With_Java_Agent.result == 'success' && | |
needs.test_Spark_App_With_Java_Agent.result == 'success' && | |
needs.test_Spark_AWS_SDK_V1_App_With_Java_Agent.result == 'success' }} | |
region: us-west-2 | |
secrets: | |
roleArn: ${{ secrets.METRICS_ROLE_ARN }} |