Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nightly-build workfow update #627

Merged
merged 11 commits into from
Dec 30, 2023
78 changes: 78 additions & 0 deletions .github/workflows/build-and-push-image-with-cpUtility-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Build and Push Java-Agent Image after CPUtility Test # non-Appsignals Testing
on:
workflow_call:
inputs:
aws-region:
required: true
type: string
image_uri_with_tag:
required: true
type: string
image_registry:
required: true
type: string
adot-java-version:
required: true
tpe: string

env:
AWS_DEFAULT_REGION: ${{ inputs.aws-region }}

permissions:
id-token: write
contents: read

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-java@v4
with:
java-version: 17
distribution: temurin

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.JAVA_INSTRUMENTATION_SNAPSHOT_ECR }}
aws-region: {{ env.AWS_DEFAULT_REGION }}

- name: Login to private staging ecr
uses: docker/login-action@v3
with:
registry: ${{ inputs.image_registry }}
env:
AWS_REGION: {{ env.AWS_DEFAULT_REGION }}

- name: Build image for testing
uses: docker/build-push-action@v5
with:
push: false
build-args: "ADOT_JAVA_VERSION=${{ inputs.adot-java-version }}"
context: .
platforms: linux/amd64
tags: ${{ inputs.image_uri_with_tag }}
load: true

- name: Test docker image
shell: bash
run: .github/scripts/test-adot-javaagent-image.sh "${{ inputs.image_uri_with_tag }}" "${{ inputs.adot-java-version }}"

- name: Build and push image
uses: docker/build-push-action@v5
with:
push: true
build-args: "ADOT_JAVA_VERSION=${{ inputs.adot-java-version }}"
context: .
platforms: linux/amd64,linux/arm64
tags: ${{ inputs.image_uri_with_tag }}
80 changes: 80 additions & 0 deletions .github/workflows/contract-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: End to End Tests with Operator # Appsignals Contract Testing
on:
workflow_call:
inputs:
aws-region:
required: true
type: string
caller-workflow-name:
required: true
type: string
env:
AWS_DEFAULT_REGION: ${{ inputs.aws-region }}

permissions:
id-token: write
contents: read

jobs:
# AppSignals specific contract tests
contract-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'temurin'
- uses: gradle/wrapper-validation-action@v1

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
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@v3
with:
registry: public.ecr.aws

# cache local patch outputs
- name: Cache local Maven repository
id: cache-local-maven-repo
uses: actions/cache@v3
with:
path: |
~/.m2/repository/io/opentelemetry/
key: ${{ runner.os }}-maven-local-${{ hashFiles('.github/patches/opentelemetry-java*.patch') }}

- name: Publish patched dependencies to maven local
uses: ./.github/actions/patch-dependencies
if: steps.cache-local-maven-repo.outputs.cache-hit != 'true'
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg_password: ${{ secrets.GPG_PASSPHRASE }}

- name: Pull base image of Contract Tests Sample Apps
run: docker pull public.ecr.aws/docker/library/amazoncorretto:17-alpine

- name: Build snapshot with Gradle
uses: gradle/gradle-build-action@v2
with:
arguments: contractTests --stacktrace -PenableCoverage=true -PtestUpstreamSnapshots=true -PlocalDocker=true

# publish status
publish-build-status:
needs: [ contract-tests ]
if: ${{ always() }}
uses: ./.github/workflows/publish-status.yml
with:
namespace: 'ADOT/GitHubActions'
repository: ${{ github.repository }}
branch: ${{ github.ref_name }}
workflow: ${{ inputs.caller-workflow-name }}
success: ${{ needs.contract-tests.result == 'success' }}
region: us-west-2
secrets:
roleArn: ${{ secrets.METRICS_ROLE_ARN }}
183 changes: 183 additions & 0 deletions .github/workflows/e2e-tests-app-with-java-agent.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
name: End to End Tests with Java Agent in Sample App
on:
workflow_call:
inputs:
aws-region:
required: true
type: string
image_tag:
required: true
type: string
caller-workflow-name:
required: true
type: string

env:
AWS_DEFAULT_REGION: ${{ inputs.aws-region }}

permissions:
id-token: write
contents: read

jobs:
build_Images_For_Testing_Sample_App_With_Java_Agent:
runs-on: ubuntu-latest
steps:
- name: Checkout Java Instrumentation repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-java@v4
with:
java-version: 17
distribution: temurin

# cache local patch outputs
- name: Cache local Maven repository
id: cache-local-maven-repo
uses: actions/cache@v3
with:
path: |
~/.m2/repository/io/opentelemetry/
key: ${{ runner.os }}-maven-local-${{ hashFiles('.github/patches/opentelemetry-java*.patch') }}

- name: Publish patched dependencies to maven local
uses: ./.github/actions/patch-dependencies
if: steps.cache-local-maven-repo.outputs.cache-hit != 'true'
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg_password: ${{ secrets.GPG_PASSPHRASE }}

- name: Validate the checksums of Gradle Wrapper
uses: gradle/wrapper-validation-action@v1

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
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@v3
with:
registry: public.ecr.aws

- name: Build and push agent and testing docker images with Gradle
uses: gradle/gradle-build-action@v2
with:
arguments: jib
env:
COMMIT_HASH: ${{ inputs.image_tag }}

- uses: codecov/codecov-action@v3

test_Spring_App_With_Java_Agent:
name: Test Spring App with AWS OTel Java agent
needs: [ build_Images_For_Testing_Sample_App_With_Java_Agent ]
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'temurin'
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
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@v3
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:${{ inputs.image_tag }}
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_Images_For_Testing_Sample_App_With_Java_Agent ]
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'temurin'
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
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@v3
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:${{ inputs.image_tag }}
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_Images_For_Testing_Sample_App_With_Java_Agent ]
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'temurin'
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
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@v3
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:${{ inputs.image_tag }}
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 status
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: ${{ inputs.caller-workflow-name }}
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 }}
Loading