From aac5630ff6919c8f7e08361e3f3d7aaaf00affe3 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Thu, 7 Mar 2024 22:06:55 +0100 Subject: [PATCH 1/8] ci: use .java-version and prepare to use VM with installed tools in BK --- .buildkite/hooks/prepare-common.sh | 28 ++++++++----- .buildkite/snapshot.yml | 1 + .ci/release.sh | 9 ++++- .ci/snapshot.sh | 9 +++-- .github/workflows/main.yml | 2 +- .github/workflows/maven-goal-jdk/action.yml | 45 +++++++++++++++++++++ .github/workflows/maven-goal/action.yml | 22 +--------- .github/workflows/release.yml | 45 +++++++++------------ .java-version | 1 + 9 files changed, 98 insertions(+), 64 deletions(-) create mode 100644 .github/workflows/maven-goal-jdk/action.yml create mode 100644 .java-version diff --git a/.buildkite/hooks/prepare-common.sh b/.buildkite/hooks/prepare-common.sh index 68cf0d4ad4..3cf3a2d48f 100644 --- a/.buildkite/hooks/prepare-common.sh +++ b/.buildkite/hooks/prepare-common.sh @@ -1,17 +1,23 @@ #!/usr/bin/env bash set -euo pipefail -echo "--- Install JDK17 :java:" -# JDK version is defined in two different locations, here and .github/workflows/maven-goal/action.yml -JAVA_URL=https://jvm-catalog.elastic.co/jdk -JAVA_HOME=$(pwd)/.openjdk17 -JAVA_PKG="$JAVA_URL/latest_openjdk_17_linux.tar.gz" -curl -L --output /tmp/jdk.tar.gz "$JAVA_PKG" -mkdir -p "$JAVA_HOME" -tar --extract --file /tmp/jdk.tar.gz --directory "$JAVA_HOME" --strip-components 1 - +# Configure the java version +JAVA_VERSION=$(cat .java-version) +JAVA_HOME="${HOME}/.java/openjdk${JAVA_VERSION}" export JAVA_HOME -PATH=$JAVA_HOME/bin:$PATH +PATH="${JAVA_HOME}/bin:$PATH" export PATH -java -version || true +# Fallback to install at runtime +if [ ! -d "${JAVA_HOME}" ] ; then + # This should not be the case normally untless the .java-version file has been changed + # and the VM Image is not yet available with the latest version. + echo "--- Install JDK${JAVA_VERSION} :java:" + JAVA_URL=https://jvm-catalog.elastic.co/jdk + JAVA_PKG="${JAVA_URL}/latest_openjdk_${JAVA_VERSION}_linux.tar.gz" + curl -L --output /tmp/jdk.tar.gz "$JAVA_PKG" + mkdir -p "$JAVA_HOME" + tar --extract --file /tmp/jdk.tar.gz --directory "$JAVA_HOME" --strip-components 1 +fi + +java -version diff --git a/.buildkite/snapshot.yml b/.buildkite/snapshot.yml index c33406f9f4..f16028888f 100644 --- a/.buildkite/snapshot.yml +++ b/.buildkite/snapshot.yml @@ -1,5 +1,6 @@ agents: provider: "gcp" + #image: "family/apm-agent-java-ubuntu-2204" steps: - label: "Run the snapshot" diff --git a/.ci/release.sh b/.ci/release.sh index 77a418d863..644a90bb3a 100755 --- a/.ci/release.sh +++ b/.ci/release.sh @@ -21,5 +21,10 @@ echo $PATH java -version set +x -echo "--- Deploy the release :package:" -./mvnw -V -s .ci/settings.xml -Pgpg clean deploy -DskipTests --batch-mode | tee release.txt +if [[ "$dry_run" == "false" ]] ; then + echo "--- Deploy the release :package:" + ./mvnw -V -s .ci/settings.xml -Pgpg clean deploy -DskipTests --batch-mode | tee release.txt +else + echo "--- Deploy the release :package: (dry-run)" + ./mvnw -V -s .ci/settings.xml -Pgpg clean install -DskipTests --batch-mode | tee release.txt +fi diff --git a/.ci/snapshot.sh b/.ci/snapshot.sh index 63ec170778..6602dd0a07 100755 --- a/.ci/snapshot.sh +++ b/.ci/snapshot.sh @@ -23,9 +23,10 @@ echo $PATH java -version set +x -echo "--- Deploy the snapshot :package:" -if [[ "$dry_run" == "true" ]] ; then - echo './mvnw -V -s .ci/settings.xml -Pgpg clean deploy -DskipTests --batch-mode' -else +if [[ "$dry_run" == "false" ]] ; then + echo "--- Deploy the snapshot :package:" ./mvnw -V -s .ci/settings.xml -Pgpg clean deploy -DskipTests --batch-mode | tee snapshot.txt +else + echo "--- Deploy the snapshot :package: (dry-run)" + ./mvnw -V -s .ci/settings.xml -Pgpg clean install -DskipTests --batch-mode | tee snapshot.txt fi diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0e31fd70f5..419c369cd3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -305,7 +305,7 @@ jobs: distribution: 'temurin' steps: - uses: actions/checkout@v4 - - uses: ./.github/workflows/maven-goal + - uses: ./.github/workflows/maven-goal-jdk with: test-java-version: ${{ matrix.version }} test-java-distribution: ${{ matrix.distribution }} diff --git a/.github/workflows/maven-goal-jdk/action.yml b/.github/workflows/maven-goal-jdk/action.yml new file mode 100644 index 0000000000..0a248367ad --- /dev/null +++ b/.github/workflows/maven-goal-jdk/action.yml @@ -0,0 +1,45 @@ +--- + +name: common build tasks +description: Install specific JDK and run a command + +inputs: + test-java-version: + description: 'Testing Java version' + required: true + default: '17' + test-java-distribution: + description: 'Testing Java distribution' + required: true + default: 'temurin' + command: + description: 'Command to execute' + required: true + shell: + description: 'Default shell' + default: 'bash' + required: false + +runs: + using: "composite" + steps: + - name: Set up testing JDK + if: ${{ inputs.test-java-version != '17' }} + uses: actions/setup-java@v4 + with: + java-version: ${{ inputs.test-java-version}} + distribution: ${{ inputs.test-java-distribution}} + + - name: Set up TEST_JAVA_BINARY environment variable + shell: bash + run: | + major_version="$(echo '${{ inputs.test-java-version }}' | sed 's/\([0-9]*\).*/\1/')" + java_home_var=JAVA_HOME_${major_version}_${{ runner.arch }} + echo "TEST_JAVA_BINARY=${!java_home_var}/bin/java" >> $GITHUB_ENV + + - uses: ./.github/workflows/maven-goal + with: + command: ${{ inputs.command }} + shell: ${{ inputs.shell }} + env: + TEST_JAVA_BINARY: ${{ env.TEST_JAVA_BINARY }} diff --git a/.github/workflows/maven-goal/action.yml b/.github/workflows/maven-goal/action.yml index a2ddbea62b..371934f3a4 100644 --- a/.github/workflows/maven-goal/action.yml +++ b/.github/workflows/maven-goal/action.yml @@ -4,14 +4,6 @@ name: common build tasks description: Install specific JDK and run a command inputs: - test-java-version: - description: 'Testing Java version' - required: true - default: '17' - test-java-distribution: - description: 'Testing Java distribution' - required: true - default: 'temurin' command: description: 'Command to execute' required: true @@ -23,23 +15,11 @@ inputs: runs: using: "composite" steps: - - name: Set up testing JDK - if: ${{ inputs.test-java-version != '17' }} - uses: actions/setup-java@v4 - with: - java-version: ${{ inputs.test-java-version}} - distribution: ${{ inputs.test-java-distribution}} - name: Set up build JDK uses: actions/setup-java@v4 with: - java-version: 17 # NOTE: This version is also defined in .buildkite/hooks/pre-command + java-version-file: .java-version distribution: temurin cache: 'maven' - - name: Set up TEST_JAVA_BINARY environment variable - shell: bash - run: | - major_version="$(echo '${{ inputs.test-java-version }}' | sed 's/\([0-9]*\).*/\1/')" - java_home_var=JAVA_HOME_${major_version}_${{ runner.arch }} - echo "TEST_JAVA_BINARY=${!java_home_var}/bin/java" >> $GITHUB_ENV - run: ${{ inputs.command }} shell: ${{ inputs.shell }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 04915c1910..901cb850e3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -34,10 +34,12 @@ on: type: boolean required: true default: false + dry_run: + description: If set, run a dry-run release + default: false + type: boolean env: - JAVA_VERSION: 17 - JAVA_DIST: temurin TAG_NAME: v${{ inputs.version }} permissions: @@ -51,7 +53,7 @@ jobs: permissions: contents: write name: "Changelog and Version Bump" - if: ${{ ! inputs.skip_preparation }} + if: ${{ ! inputs.skip_preparation && ! inputs.dry_run }} runs-on: ubuntu-latest steps: - uses: elastic/apm-pipeline-library/.github/actions/github-token@current @@ -68,12 +70,10 @@ jobs: with: ref: ${{ inputs.branch }} token: ${{ env.GITHUB_TOKEN }} - - name: Set up JDK ${{ env.JAVA_VERSION }} - uses: actions/setup-java@v4 + - name: Install JDK and mvn clean + uses: ./.github/workflows/maven-goal with: - java-version: ${{ env.JAVA_VERSION }} - distribution: ${{ env.JAVA_DIST }} - cache: 'maven' + command: ./mvnw clean - name: Prepare changelog for release if: ${{ inputs.update_changelog }} run: | @@ -83,10 +83,9 @@ jobs: run: ./mvnw release:prepare -B -DpushChanges=false "-Darguments=-DskipTests -Dmaven.javadoc.skip=true" -DreleaseVersion=${{ inputs.version }} - run: git push --atomic origin ${{ inputs.branch }} ${{ env.TAG_NAME }} - maven_central_deploy: name: "Deploy to Maven Central (Buildkite)" - if: ${{ ! inputs.skip_maven_deploy && ( inputs.skip_preparation || success() ) }} + if: ${{ ! inputs.skip_maven_deploy && ! inputs.dry_run && ( inputs.skip_preparation || success() ) }} runs-on: ubuntu-latest needs: - prepare_release @@ -103,16 +102,13 @@ jobs: pipelineCommit: ${{ env.TAG_NAME }} waitFor: true printBuildLogs: false - # The action fails with .github/actions/buildkite/run.sh: line 24: 3: parameter missing. - # Which is an unexpected bug. - # Adding a random buildEnvVar to circumvent the behaviour. buildEnvVars: | - something_something=true - + dry_run=${{ inputs.dry_run || 'false' }} await_artifact_on_maven_central: name: "Wait for artifacts to be available on maven central" runs-on: ubuntu-latest + if: ${{ ! inputs.dry_run }} steps: - uses: actions/checkout@v4 - name: Await artifacts published in maven central @@ -128,6 +124,7 @@ jobs: update_major_branch: name: "Update Major Branch" runs-on: ubuntu-latest + if: ${{ ! inputs.dry_run }} needs: - await_artifact_on_maven_central permissions: @@ -153,6 +150,7 @@ jobs: update_cloudfoundry: name: "Update Cloudfoundry" runs-on: ubuntu-latest + if: ${{ ! inputs.dry_run }} needs: - await_artifact_on_maven_central permissions: @@ -181,6 +179,7 @@ jobs: build_and_push_docker_images: name: "Build and push docker images" runs-on: ubuntu-latest + if: ${{ ! inputs.dry_run }} needs: - await_artifact_on_maven_central env: @@ -206,6 +205,7 @@ jobs: publish_aws_lambda: name: "Publish AWS Lambda" runs-on: ubuntu-latest + if: ${{ ! inputs.dry_run }} needs: - await_artifact_on_maven_central outputs: @@ -218,14 +218,10 @@ jobs: - uses: actions/checkout@v4 with: ref: ${{ env.TAG_NAME }} - - name: Set up JDK ${{ env.JAVA_VERSION }} - uses: actions/setup-java@v4 - with: - java-version: ${{ env.JAVA_VERSION }} - distribution: ${{ env.JAVA_DIST }} - cache: 'maven' - name: Build Lambda-layer zip using agent from maven-central - run: ./mvnw dependency:purge-local-repository package -pl apm-agent-lambda-layer + uses: ./.github/workflows/maven-goal + with: + command: ./mvnw dependency:purge-local-repository package -pl apm-agent-lambda-layer - uses: hashicorp/vault-action@v3.0.0 with: url: ${{ secrets.VAULT_ADDR }} @@ -253,13 +249,13 @@ jobs: cat .ci/.arn-file.md >> $GITHUB_OUTPUT echo 'ARN_CONTENT_EOF' >> $GITHUB_OUTPUT - create_github_release: name: "Create GitHub Release" needs: - publish_aws_lambda - update_major_branch runs-on: ubuntu-latest + if: ${{ ! inputs.dry_run }} permissions: contents: write steps: @@ -286,10 +282,9 @@ jobs: --title="Release ${{ inputs.version }}" \ --notes="[Release Notes for ${{ inputs.version }}](https://www.elastic.co/guide/en/apm/agent/java/current/release-notes-${{ steps.get_dotx_branch.outputs.dotx_branch }}.html#release-notes-${{ inputs.version }}) ${{ needs.publish_aws_lambda.outputs.arn_content }}" - notify: - if: always() + if: ${{ always() && ! inputs.dry_run }} needs: - prepare_release - maven_central_deploy diff --git a/.java-version b/.java-version new file mode 100644 index 0000000000..8e2afd3427 --- /dev/null +++ b/.java-version @@ -0,0 +1 @@ +17 \ No newline at end of file From 4ca2767ca04194385798ead23e99f322f8d250e7 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Thu, 7 Mar 2024 22:09:26 +0100 Subject: [PATCH 2/8] install it regardless --- .github/workflows/maven-goal-jdk/action.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/maven-goal-jdk/action.yml b/.github/workflows/maven-goal-jdk/action.yml index 0a248367ad..43379e2fcf 100644 --- a/.github/workflows/maven-goal-jdk/action.yml +++ b/.github/workflows/maven-goal-jdk/action.yml @@ -24,7 +24,6 @@ runs: using: "composite" steps: - name: Set up testing JDK - if: ${{ inputs.test-java-version != '17' }} uses: actions/setup-java@v4 with: java-version: ${{ inputs.test-java-version}} From c37a1555f8555effca1129c6c78b457ea3bb5f05 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Thu, 7 Mar 2024 22:13:13 +0100 Subject: [PATCH 3/8] Update .buildkite/hooks/prepare-common.sh --- .buildkite/hooks/prepare-common.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.buildkite/hooks/prepare-common.sh b/.buildkite/hooks/prepare-common.sh index 3cf3a2d48f..50b3d3388e 100644 --- a/.buildkite/hooks/prepare-common.sh +++ b/.buildkite/hooks/prepare-common.sh @@ -2,7 +2,7 @@ set -euo pipefail # Configure the java version -JAVA_VERSION=$(cat .java-version) +JAVA_VERSION=$(cat .java-version | xargs | tr -dc '[:print:]') JAVA_HOME="${HOME}/.java/openjdk${JAVA_VERSION}" export JAVA_HOME PATH="${JAVA_HOME}/bin:$PATH" From 3f3f2e70371e415f4af1d672472fdc36ead7e59b Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Thu, 7 Mar 2024 22:15:12 +0100 Subject: [PATCH 4/8] Apply suggestions from code review --- .ci/release.sh | 5 +++-- .ci/snapshot.sh | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.ci/release.sh b/.ci/release.sh index 644a90bb3a..959502f966 100755 --- a/.ci/release.sh +++ b/.ci/release.sh @@ -23,8 +23,9 @@ java -version set +x if [[ "$dry_run" == "false" ]] ; then echo "--- Deploy the release :package:" - ./mvnw -V -s .ci/settings.xml -Pgpg clean deploy -DskipTests --batch-mode | tee release.txt + GOAL=deploy else echo "--- Deploy the release :package: (dry-run)" - ./mvnw -V -s .ci/settings.xml -Pgpg clean install -DskipTests --batch-mode | tee release.txt + GOAL=install fi +./mvnw -V -s .ci/settings.xml -Pgpg clean $GOAL -DskipTests --batch-mode | tee release.txt diff --git a/.ci/snapshot.sh b/.ci/snapshot.sh index 6602dd0a07..f9001c34ea 100755 --- a/.ci/snapshot.sh +++ b/.ci/snapshot.sh @@ -25,8 +25,9 @@ java -version set +x if [[ "$dry_run" == "false" ]] ; then echo "--- Deploy the snapshot :package:" - ./mvnw -V -s .ci/settings.xml -Pgpg clean deploy -DskipTests --batch-mode | tee snapshot.txt + GOAL=deploy else echo "--- Deploy the snapshot :package: (dry-run)" - ./mvnw -V -s .ci/settings.xml -Pgpg clean install -DskipTests --batch-mode | tee snapshot.txt + GOAL=install fi +./mvnw -V -s .ci/settings.xml -Pgpg clean $GOAL -DskipTests --batch-mode | tee snapshot.txt From ed83ffa674956ce7ea41948efd9cde88800ce02b Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Thu, 7 Mar 2024 22:24:08 +0100 Subject: [PATCH 5/8] better logging --- .ci/release.sh | 13 ++++++++----- .ci/snapshot.sh | 13 ++++++++----- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/.ci/release.sh b/.ci/release.sh index 959502f966..b05947ce95 100755 --- a/.ci/release.sh +++ b/.ci/release.sh @@ -21,11 +21,14 @@ echo $PATH java -version set +x +# Default in dry-run mode +GOAL="install" +DRY_RUN_MSG="(dry-run)" +# Otherwise, a RELEASE if [[ "$dry_run" == "false" ]] ; then - echo "--- Deploy the release :package:" - GOAL=deploy -else - echo "--- Deploy the release :package: (dry-run)" - GOAL=install + GOAL="deploy" + DRY_RUN_MSG="" fi + +echo "--- Deploy the release :package: [./mvnw $GOAL)] $DRY_RUN_MSG" ./mvnw -V -s .ci/settings.xml -Pgpg clean $GOAL -DskipTests --batch-mode | tee release.txt diff --git a/.ci/snapshot.sh b/.ci/snapshot.sh index f9001c34ea..a11cd4eb9a 100755 --- a/.ci/snapshot.sh +++ b/.ci/snapshot.sh @@ -23,11 +23,14 @@ echo $PATH java -version set +x +# Default in dry-run mode +GOAL="install" +DRY_RUN_MSG="(dry-run)" +# Otherwise, a snapshot if [[ "$dry_run" == "false" ]] ; then - echo "--- Deploy the snapshot :package:" - GOAL=deploy -else - echo "--- Deploy the snapshot :package: (dry-run)" - GOAL=install + GOAL="deploy" + DRY_RUN_MSG="" fi + +echo "--- Deploy the snapshot :package: [./mvnw $GOAL)] $DRY_RUN_MSG" ./mvnw -V -s .ci/settings.xml -Pgpg clean $GOAL -DskipTests --batch-mode | tee snapshot.txt From c0a9a18e7793071358423f94687c7b3926325a5e Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Fri, 8 Mar 2024 14:19:52 +0100 Subject: [PATCH 6/8] skip steps --- .github/workflows/release.yml | 40 +++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 901cb850e3..d15ea5f5bc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -53,7 +53,7 @@ jobs: permissions: contents: write name: "Changelog and Version Bump" - if: ${{ ! inputs.skip_preparation && ! inputs.dry_run }} + if: ${{ ! inputs.skip_preparation }} runs-on: ubuntu-latest steps: - uses: elastic/apm-pipeline-library/.github/actions/github-token@current @@ -75,17 +75,20 @@ jobs: with: command: ./mvnw clean - name: Prepare changelog for release - if: ${{ inputs.update_changelog }} + if: ${{ inputs.update_changelog && ! inputs.dry_run }} run: | java .ci/ReleaseChangelog.java CHANGELOG.asciidoc ${{ inputs.version }} git commit -m "Prepare changelog for release ${{ inputs.version }}" CHANGELOG.asciidoc - name: Bump version and add git tag + if: ${{ ! inputs.dry_run }} run: ./mvnw release:prepare -B -DpushChanges=false "-Darguments=-DskipTests -Dmaven.javadoc.skip=true" -DreleaseVersion=${{ inputs.version }} - - run: git push --atomic origin ${{ inputs.branch }} ${{ env.TAG_NAME }} + - name: Push changes + if: ${{ ! inputs.dry_run }} + run: git push --atomic origin ${{ inputs.branch }} ${{ env.TAG_NAME }} maven_central_deploy: name: "Deploy to Maven Central (Buildkite)" - if: ${{ ! inputs.skip_maven_deploy && ! inputs.dry_run && ( inputs.skip_preparation || success() ) }} + if: ${{ ! inputs.skip_maven_deploy && ( inputs.skip_preparation || success() ) }} runs-on: ubuntu-latest needs: - prepare_release @@ -108,10 +111,10 @@ jobs: await_artifact_on_maven_central: name: "Wait for artifacts to be available on maven central" runs-on: ubuntu-latest - if: ${{ ! inputs.dry_run }} steps: - uses: actions/checkout@v4 - name: Await artifacts published in maven central + if: ${{ ! inputs.dry_run }} shell: bash timeout-minutes: 120 run: | @@ -124,7 +127,6 @@ jobs: update_major_branch: name: "Update Major Branch" runs-on: ubuntu-latest - if: ${{ ! inputs.dry_run }} needs: - await_artifact_on_maven_central permissions: @@ -144,13 +146,15 @@ jobs: with: ref: ${{ env.TAG_NAME }} token: ${{ env.GITHUB_TOKEN }} - - run: .ci/release/update_major_branch.sh ${{ inputs.version }} - - run: git push -f origin "$(echo '${{ inputs.version }}' | sed -E 's/\..+/.x/')" + - name: Update major branch + run: .ci/release/update_major_branch.sh ${{ inputs.version }} + - name: Push changes + if: ${{ ! inputs.dry_run }} + run: git push -f origin "$(echo '${{ inputs.version }}' | sed -E 's/\..+/.x/')" update_cloudfoundry: name: "Update Cloudfoundry" runs-on: ubuntu-latest - if: ${{ ! inputs.dry_run }} needs: - await_artifact_on_maven_central permissions: @@ -173,13 +177,13 @@ jobs: - name: "Update Cloudfoundry index.yml file" shell: bash run: .ci/release/update_cloudfoundry.sh ${{ inputs.version }} - - run: git push origin ${{ inputs.branch }} - + - name: Push changes + if: ${{ ! inputs.dry_run }} + run: git push origin ${{ inputs.branch }} build_and_push_docker_images: name: "Build and push docker images" runs-on: ubuntu-latest - if: ${{ ! inputs.dry_run }} needs: - await_artifact_on_maven_central env: @@ -198,14 +202,15 @@ jobs: secretId: ${{ secrets.VAULT_SECRET_ID }} - name: "Build docker image" shell: bash - run: | - ./scripts/docker-release/build_docker.sh - ./scripts/docker-release/push_docker.sh + run: ./scripts/docker-release/build_docker.sh + - name: "Push docker image" + if: ${{ ! inputs.dry_run }} + shell: bash + run: ./scripts/docker-release/push_docker.sh publish_aws_lambda: name: "Publish AWS Lambda" runs-on: ubuntu-latest - if: ${{ ! inputs.dry_run }} needs: - await_artifact_on_maven_central outputs: @@ -232,6 +237,7 @@ jobs: secret/observability-team/ci/service-account/apm-aws-lambda access_key_id | AWS_ACCESS_KEY_ID ; secret/observability-team/ci/service-account/apm-aws-lambda secret_access_key | AWS_SECRET_ACCESS_KEY - name: Publish + if: ${{ ! inputs.dry_run }} run: | # Convert v1.2.3 to ver-1-2-3 VERSION=${TAG_NAME/v/ver-} @@ -239,10 +245,12 @@ jobs: ELASTIC_LAYER_NAME="elastic-apm-java-${VERSION}" .ci/publish-aws.sh - uses: actions/upload-artifact@v4 + if: ${{ ! inputs.dry_run }} with: name: arn-file path: .ci/.arn-file.md - name: Add ARN file to output + if: ${{ ! inputs.dry_run }} id: arn_output run: | echo 'arn_content<> $GITHUB_OUTPUT From 0663807e999785a986e96bc8a76a82fbd1968c53 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Fri, 8 Mar 2024 14:20:59 +0100 Subject: [PATCH 7/8] follow up --- .buildkite/release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.buildkite/release.yml b/.buildkite/release.yml index 1b6a41fae7..e2b6953e76 100644 --- a/.buildkite/release.yml +++ b/.buildkite/release.yml @@ -1,5 +1,6 @@ agents: provider: "gcp" + #image: "family/apm-agent-java-ubuntu-2204" steps: - label: "Run the release" From 02a306f07a7f4b1c381db9b077d5c5ef49fbe699 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Fri, 8 Mar 2024 15:29:25 +0100 Subject: [PATCH 8/8] skip slack messages for dry-run --- .buildkite/release.yml | 3 ++- .buildkite/snapshot.yml | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.buildkite/release.yml b/.buildkite/release.yml index e2b6953e76..b646bf3309 100644 --- a/.buildkite/release.yml +++ b/.buildkite/release.yml @@ -12,4 +12,5 @@ steps: notify: - slack: "#apm-agent-java" - if: 'build.state != "passed"' + # skip slack messages if no failures and dry-run mode + if: 'build.state != "passed" && build.env("dry_run") == "false"' diff --git a/.buildkite/snapshot.yml b/.buildkite/snapshot.yml index f16028888f..6421fad588 100644 --- a/.buildkite/snapshot.yml +++ b/.buildkite/snapshot.yml @@ -12,4 +12,5 @@ steps: notify: - slack: "#apm-agent-java" - if: 'build.state != "passed"' + # skip slack messages if no failures and dry-run mode + if: 'build.state != "passed" && build.env("dry_run") == "false"'