Skip to content

Nightly Snapshot Build #1024

Nightly Snapshot Build

Nightly Snapshot Build #1024

name: Nightly Snapshot Build
on:
schedule:
- cron: "21 3 * * *"
workflow_dispatch:
env:
AWS_DEFAULT_REGION: us-east-1
IMAGE_TAG: 611364707713.dkr.ecr.us-west-2.amazonaws.com/adot-autoinstrumentation-java-nightly:nightly
permissions:
id-token: write
contents: read
jobs:
build:
runs-on: ubuntu-latest
outputs:
release-candidate-image: ${{ steps.imageNameOutput.outputs.imageName }}
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
- 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: build contractTests --stacktrace -PenableCoverage=true -PtestUpstreamSnapshots=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: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.JAVA_INSTRUMENTATION_SNAPSHOT_ECR }}
aws-region: us-west-2
- name: Login to private aws ecr
uses: docker/login-action@v3
with:
registry: 611364707713.dkr.ecr.us-west-2.amazonaws.com
- name: Get current version
shell: bash
run: |
echo "ADOT_JAVA_VERSION=$(./gradlew printVersion -q -PtestUpstreamSnapshots=true )" >> $GITHUB_ENV
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build image for testing
uses: docker/build-push-action@v5
with:
push: false
build-args: "ADOT_JAVA_VERSION=${{ env.ADOT_JAVA_VERSION }}"
context: .
platforms: linux/amd64
tags: ${{ env.IMAGE_TAG }}
load: true
- name: Test docker image
shell: bash
run: .github/scripts/test-adot-javaagent-image.sh "${{ env.IMAGE_TAG }}" "${{ env.ADOT_JAVA_VERSION }}"
- name: Build and push image
uses: docker/build-push-action@v5
with:
push: true
build-args: "ADOT_JAVA_VERSION=${{ env.ADOT_JAVA_VERSION }}"
context: .
platforms: linux/amd64,linux/arm64
tags: |
${{ env.IMAGE_TAG }}
- name: Set image name to output
id: imageNameOutput
run: echo "imageName=${{ env.IMAGE_NAME }}" >> "$GITHUB_OUTPUT"
- name: Upload to GitHub Actions
uses: actions/upload-artifact@v3
with:
name: aws-opentelemetry-agent.jar
path: otelagent/build/libs/aws-opentelemetry-agent-*.jar
e2e-test:
needs: build
uses: ./.github/workflows/appsignals-e2e-eks-test.yml
secrets: inherit
with:
test-cluster-name: "e2e-adot-test"
appsignals-adot-image-name: ${{ needs.build.outputs.release-candidate-image }}
caller-workflow-name: 'nightly-upstream-snapshot-build'
publish-build-status:
needs: [build]
if: ${{ always() }}
uses: ./.github/workflows/publish-status.yml
with:
namespace: 'ADOT/GitHubActions'
repository: ${{ github.repository }}
branch: ${{ github.ref_name }}
workflow: nightly-upstream-snapshot-build
success: ${{ needs.build.result == 'success' }}
region: us-west-2
secrets:
roleArn: ${{ secrets.METRICS_ROLE_ARN }}