Skip to content

Commit

Permalink
Build operator staging image
Browse files Browse the repository at this point in the history
  • Loading branch information
majanjua-amzn committed Jul 15, 2024
1 parent 28e4faa commit bca35b5
Showing 1 changed file with 100 additions and 99 deletions.
199 changes: 100 additions & 99 deletions .github/workflows/main-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
- operator-fix-v1.32.x
env:
AWS_DEFAULT_REGION: us-east-1
STAGING_ECR_REGISTRY: 611364707713.dkr.ecr.us-west-2.amazonaws.com
STAGING_ECR_REGISTRY: 992382537080.dkr.ecr.us-west-2.amazonaws.com
STAGING_ECR_REPOSITORY: adot-autoinstrumentation-java-operator-staging

concurrency:
Expand Down Expand Up @@ -47,92 +47,92 @@ jobs:
# gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
# gpg_password: ${{ secrets.GPG_PASSPHRASE }}

# build:
# runs-on: ubuntu-latest
# outputs:
# java_agent_tag: ${{ steps.java_agent_versioning.outputs.STAGING_TAG}}
# staging-image: ${{ steps.imageOutput.outputs.stagingImage }}
# staging_registry: ${{ steps.imageOutput.outputs.stagingRegistry }}
# staging_repository: ${{ steps.imageOutput.outputs.stagingRepository }}
# steps:
# - 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
# 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
# with:
# 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@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 snapshot with Gradle
# uses: gradle/gradle-build-action@v3
# with:
# arguments: build integrationTests snapshot --stacktrace -PenableCoverage=true -PlocalDocker=true
# env:
# PUBLISH_TOKEN_USERNAME: ${{ secrets.PUBLISH_TOKEN_USERNAME }}
# PUBLISH_TOKEN_PASSWORD: ${{ secrets.PUBLISH_TOKEN_PASSWORD }}
# GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
# GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}

# - name: Get current version
# id: getADOTJavaVersion
# shell: bash
# run: echo "adot_java_version=$(./gradlew printVersion -q )" >> $GITHUB_OUTPUT

# - name: Get ADOT_JAVA_AGENT Image Tag
# id: java_agent_versioning
# run: |
# shortsha="$(git rev-parse --short HEAD)"
# java_agent_tag=${{ steps.getADOTJavaVersion.outputs.adot_java_version }}-$shortsha
# echo "STAGING_TAG=$java_agent_tag" >> $GITHUB_OUTPUT

# - name: Set image to output
# id: imageOutput
# run: |
# 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 }}:${{ steps.java_agent_versioning.outputs.STAGING_TAG }}" >> $GITHUB_OUTPUT
build:
runs-on: ubuntu-latest
outputs:
java_agent_tag: ${{ steps.java_agent_versioning.outputs.STAGING_TAG}}
staging-image: ${{ steps.imageOutput.outputs.stagingImage }}
staging_registry: ${{ steps.imageOutput.outputs.stagingRegistry }}
staging_repository: ${{ steps.imageOutput.outputs.stagingRepository }}
steps:
- 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
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
with:
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@v4
with:
role-to-assume: ${{ secrets.TEMP_JAVA_INSTRUMENTATION_INTEG_TEST_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 snapshot with Gradle
uses: gradle/gradle-build-action@v3
with:
arguments: build integrationTests snapshot --stacktrace -PenableCoverage=true -PlocalDocker=true
env:
PUBLISH_TOKEN_USERNAME: ${{ secrets.PUBLISH_TOKEN_USERNAME }}
PUBLISH_TOKEN_PASSWORD: ${{ secrets.PUBLISH_TOKEN_PASSWORD }}
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}

- name: Get current version
id: getADOTJavaVersion
shell: bash
run: echo "adot_java_version=$(./gradlew printVersion -q )" >> $GITHUB_OUTPUT

- name: Get ADOT_JAVA_AGENT Image Tag
id: java_agent_versioning
run: |
shortsha="$(git rev-parse --short HEAD)"
java_agent_tag=${{ steps.getADOTJavaVersion.outputs.adot_java_version }}-$shortsha
echo "STAGING_TAG=$java_agent_tag" >> $GITHUB_OUTPUT
# - name: Build and Push Java Agent Image and Execute cpUtility Tests
# uses: ./.github/actions/cpUtility-testing
# with:
# aws-region: us-west-2
# image_uri_with_tag: ${{ steps.imageOutput.outputs.stagingImage }}
# image_registry: ${{ steps.imageOutput.outputs.stagingRegistry }}
# adot-java-version: ${{ steps.getADOTJavaVersion.outputs.adot_java_version }}
# snapshot-ecr-role: ${{ secrets.JAVA_INSTRUMENTATION_SNAPSHOT_ECR }}

# - name: Upload to GitHub Actions
# uses: actions/upload-artifact@v3
# with:
# name: aws-opentelemetry-agent.jar
# path: otelagent/build/libs/aws-opentelemetry-agent-*.jar
- name: Set image to output
id: imageOutput
run: |
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 }}:${{ steps.java_agent_versioning.outputs.STAGING_TAG }}" >> $GITHUB_OUTPUT
- name: Build and Push Java Agent Image and Execute cpUtility Tests
uses: ./.github/actions/cpUtility-testing
with:
aws-region: us-west-2
image_uri_with_tag: ${{ steps.imageOutput.outputs.stagingImage }}
image_registry: ${{ steps.imageOutput.outputs.stagingRegistry }}
adot-java-version: ${{ steps.getADOTJavaVersion.outputs.adot_java_version }}
snapshot-ecr-role: ${{ secrets.TEMP_JAVA_INSTRUMENTATION_INTEG_TEST_ARN }}

- name: Upload to GitHub Actions
uses: actions/upload-artifact@v3
with:
name: aws-opentelemetry-agent.jar
path: otelagent/build/libs/aws-opentelemetry-agent-*.jar

# default-region-output:
# runs-on: ubuntu-latest
Expand All @@ -158,19 +158,20 @@ jobs:
echo "ref=terraform" >> $GITHUB_OUTPUT
fi
e2e-operator-test:
concurrency:
group: e2e-adot-agent-operator-test
cancel-in-progress: false
# needs: [ build, create-test-ref, default-region-output ]
uses: ./.github/workflows/e2e-tests-with-operator.yml
secrets: inherit
with:
aws-region: 'us-east-1'
image_tag: '1.33.0-SNAPSHOT-753acdf'
image_uri: '611364707713.dkr.ecr.us-west-2.amazonaws.com/adot-autoinstrumentation-java-operator-staging'
test_ref: ${{ needs.create-test-ref.outputs.testRef }}
caller-workflow-name: 'main-build'
# e2e-operator-test:
# concurrency:
# group: e2e-adot-agent-operator-test
# cancel-in-progress: false
# # needs: [ build, create-test-ref, default-region-output ]
# needs: [ build, create-test-ref ]
# uses: ./.github/workflows/e2e-tests-with-operator.yml
# secrets: inherit
# with:
# aws-region: 'us-east-1'
# image_tag: ${{ needs.build.outputs.java_agent_tag }}
# image_uri: ${{ needs.build.outputs.staging_registry }}/${{ needs.build.outputs.staging_repository }}
# test_ref: ${{ needs.create-test-ref.outputs.testRef }}
# caller-workflow-name: 'main-build'

# # E2E tests where SampleApp has Java Agent
# e2e-test:
Expand Down

0 comments on commit bca35b5

Please sign in to comment.