Skip to content

Commit 3f0ece7

Browse files
ezhang6811jj22ee
authored andcommitted
Add main build validation for release workflow (#1125)
*Issue #, if available:* *Description of changes:* This PR modifies the release build workflow to wait for the main build workflow in the same branch to complete successfully. before proceeding with the release. see [Python PR](aws-observability/aws-otel-python-instrumentation#443) for more details and testing. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent a868378 commit 3f0ece7

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

.github/workflows/main-build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@ jobs:
256256
aws s3 cp ./build/distributions/aws-opentelemetry-java-layer.zip s3://adot-main-build-staging-jar/adot-java-lambda-layer-${{ github.run_id }}.zip
257257
258258
application-signals-e2e-test:
259+
name: "Application Signals E2E Test"
259260
needs: [build, application-signals-lambda-layer-build]
260261
uses: ./.github/workflows/application-signals-e2e-test.yml
261262
secrets: inherit

.github/workflows/release-build.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,25 @@ jobs:
2525
runs-on: ubuntu-latest
2626
steps:
2727
- uses: actions/checkout@v5
28-
- uses: actions/setup-java@v4
28+
29+
- name: Check main build status
30+
env:
31+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32+
run: |
33+
WORKFLOW_ID=$(gh api repos/${{ github.repository }}/actions/workflows --jq '.workflows[] | select(.name=="Java Agent Main Build") | .id')
34+
LATEST_RUN=$(gh api repos/${{ github.repository }}/actions/workflows/$WORKFLOW_ID/runs --jq '[.workflow_runs[] | select(.head_branch=="${{ github.ref_name }}")] | sort_by(.created_at) | .[-1] | {conclusion, status}')
35+
STATUS=$(echo "$LATEST_RUN" | jq -r '.status')
36+
CONCLUSION=$(echo "$LATEST_RUN" | jq -r '.conclusion')
37+
38+
if [ "$STATUS" = "in_progress" ] || [ "$STATUS" = "queued" ]; then
39+
echo "Main build is still running (status: $STATUS). Cannot proceed with release."
40+
exit 1
41+
elif [ "$CONCLUSION" != "success" ]; then
42+
echo "Latest main build on branch ${{ github.ref_name }} conclusion: $CONCLUSION"
43+
exit 1
44+
fi
45+
echo "Main build succeeded, proceeding with release"
46+
- uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
2947
with:
3048
java-version: 17
3149
distribution: 'temurin'

0 commit comments

Comments
 (0)