From 8ae831ddbc3c4048398cf43f44c61c22ce2883c3 Mon Sep 17 00:00:00 2001 From: David Arthur Date: Sun, 8 Sep 2024 20:52:42 -0400 Subject: [PATCH 01/39] Capture URL --- .github/workflows/ci-complete.yml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-complete.yml b/.github/workflows/ci-complete.yml index 73de8fcf4d19f..bbbbca92e4055 100644 --- a/.github/workflows/ci-complete.yml +++ b/.github/workflows/ci-complete.yml @@ -21,6 +21,8 @@ on: types: - completed +run-name: Build Scan for ${{ github.event.workflow_run.display_title}} + jobs: upload-build-scan: if: ${{ github.event.workflow_run.head_repository.full_name != 'apache/kafka' }} @@ -28,7 +30,7 @@ jobs: strategy: fail-fast: false matrix: - java: [ 21, 17, 11, 8 ] + java: [ 17, 11 ] steps: - name: Env run: printenv @@ -51,4 +53,11 @@ jobs: name: build-scan-test-${{ matrix.java }} path: ~/.gradle/build-scan-data - name: Publish scan - run: ./gradlew --info buildScanPublishPrevious + id: publish-scan + run: | + ./gradlew --info buildScanPublishPrevious > gradle.out + SCAN_URL = $(grep '^https://.*$' gradle.out) + echo "scan-url=SCAN_URL" >> $GITHUB_OUTPUT + - run: | + echo "Finished publishing" + echo "Build scan url is: ${{ steps.publish-scan.outputs.scan-url }}" \ No newline at end of file From b4c5a452e543f907b393fdd9ca149a3da58605a5 Mon Sep 17 00:00:00 2001 From: David Arthur Date: Sun, 8 Sep 2024 20:54:22 -0400 Subject: [PATCH 02/39] shorten the CI --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b8dbe5a4feea5..0d7a466930d67 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -120,7 +120,7 @@ jobs: -PmaxParallelForks=2 \ -PmaxTestRetries=1 -PmaxTestRetryFailures=10 \ -PcommitId=xxxxxxxxxxxxxxxx \ - test + :metadata:test exitcode="$?" echo "exitcode=$exitcode" >> $GITHUB_OUTPUT - name: Archive JUnit reports From 9f3c9c62914e15cda17150dde8932e6e5d0e78eb Mon Sep 17 00:00:00 2001 From: David Arthur Date: Sun, 8 Sep 2024 20:56:55 -0400 Subject: [PATCH 03/39] only run for PRs --- .github/workflows/ci-complete.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-complete.yml b/.github/workflows/ci-complete.yml index bbbbca92e4055..377b31099ee69 100644 --- a/.github/workflows/ci-complete.yml +++ b/.github/workflows/ci-complete.yml @@ -25,7 +25,7 @@ run-name: Build Scan for ${{ github.event.workflow_run.display_title}} jobs: upload-build-scan: - if: ${{ github.event.workflow_run.head_repository.full_name != 'apache/kafka' }} + if: ${{ github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.head_repository.full_name != 'apache/kafka' }} runs-on: ubuntu-latest strategy: fail-fast: false From 0ae05508074a1356a67c5ebc900210fefba54924 Mon Sep 17 00:00:00 2001 From: David Arthur Date: Sun, 8 Sep 2024 21:10:39 -0400 Subject: [PATCH 04/39] Fix env --- .github/workflows/ci-complete.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-complete.yml b/.github/workflows/ci-complete.yml index 377b31099ee69..b11526d954f70 100644 --- a/.github/workflows/ci-complete.yml +++ b/.github/workflows/ci-complete.yml @@ -57,7 +57,7 @@ jobs: run: | ./gradlew --info buildScanPublishPrevious > gradle.out SCAN_URL = $(grep '^https://.*$' gradle.out) - echo "scan-url=SCAN_URL" >> $GITHUB_OUTPUT + echo "scan-url=$SCAN_URL" >> $GITHUB_OUTPUT - run: | echo "Finished publishing" echo "Build scan url is: ${{ steps.publish-scan.outputs.scan-url }}" \ No newline at end of file From e1490588e545a2da978acf8a1d2a7dcb48721682 Mon Sep 17 00:00:00 2001 From: David Arthur Date: Sun, 8 Sep 2024 21:27:37 -0400 Subject: [PATCH 05/39] fix whitespace --- .github/workflows/ci-complete.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-complete.yml b/.github/workflows/ci-complete.yml index b11526d954f70..9d6b69db99a1e 100644 --- a/.github/workflows/ci-complete.yml +++ b/.github/workflows/ci-complete.yml @@ -56,7 +56,7 @@ jobs: id: publish-scan run: | ./gradlew --info buildScanPublishPrevious > gradle.out - SCAN_URL = $(grep '^https://.*$' gradle.out) + SCAN_URL=$(grep '^https://.*$' gradle.out) echo "scan-url=$SCAN_URL" >> $GITHUB_OUTPUT - run: | echo "Finished publishing" From fd4349d9db0dc7ebb91c58f6b28b102389fd4fa0 Mon Sep 17 00:00:00 2001 From: David Arthur Date: Sun, 8 Sep 2024 22:02:05 -0400 Subject: [PATCH 06/39] add a comment --- .github/workflows/ci-complete.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-complete.yml b/.github/workflows/ci-complete.yml index 9d6b69db99a1e..43e2d41ebccc4 100644 --- a/.github/workflows/ci-complete.yml +++ b/.github/workflows/ci-complete.yml @@ -58,6 +58,11 @@ jobs: ./gradlew --info buildScanPublishPrevious > gradle.out SCAN_URL=$(grep '^https://.*$' gradle.out) echo "scan-url=$SCAN_URL" >> $GITHUB_OUTPUT - - run: | + - name: Update PR + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PR_NUMBER: ${{ github.event.workflow_run.pull_requests[0].number }} + run: | echo "Finished publishing" - echo "Build scan url is: ${{ steps.publish-scan.outputs.scan-url }}" \ No newline at end of file + echo "Build scan url is: ${{ steps.publish-scan.outputs.scan-url }}" + gh pr comment $PR_NUMBER --edit-last --body "Hello from Github Actions!" \ No newline at end of file From 93fa110eb698e4284d3cf5717c4874db52348453 Mon Sep 17 00:00:00 2001 From: David Arthur Date: Sun, 8 Sep 2024 22:21:37 -0400 Subject: [PATCH 07/39] fix comment --- .github/workflows/ci-complete.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-complete.yml b/.github/workflows/ci-complete.yml index 43e2d41ebccc4..e6fe6a7c51487 100644 --- a/.github/workflows/ci-complete.yml +++ b/.github/workflows/ci-complete.yml @@ -65,4 +65,4 @@ jobs: run: | echo "Finished publishing" echo "Build scan url is: ${{ steps.publish-scan.outputs.scan-url }}" - gh pr comment $PR_NUMBER --edit-last --body "Hello from Github Actions!" \ No newline at end of file + gh pr comment $PR_NUMBER --body "Published scan ${{ steps.publish-scan.outputs.scan-url }} for workflow run ${{ github.event.workflow_run.html_url }} " \ No newline at end of file From aa28cc548550d009e6f7c025a571e590cf79b985 Mon Sep 17 00:00:00 2001 From: David Arthur Date: Mon, 9 Sep 2024 09:53:04 -0400 Subject: [PATCH 08/39] one comment for both scans --- .github/workflows/ci-complete.yml | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci-complete.yml b/.github/workflows/ci-complete.yml index e6fe6a7c51487..dd71efbb53226 100644 --- a/.github/workflows/ci-complete.yml +++ b/.github/workflows/ci-complete.yml @@ -31,6 +31,9 @@ jobs: fail-fast: false matrix: java: [ 17, 11 ] + outputs: + build-scan-url-11: ${{ steps.publish-scan.scan-url-11 }} + build-scan-url-17: ${{ steps.publish-scan.scan-url-17 }} steps: - name: Env run: printenv @@ -57,12 +60,20 @@ jobs: run: | ./gradlew --info buildScanPublishPrevious > gradle.out SCAN_URL=$(grep '^https://.*$' gradle.out) - echo "scan-url=$SCAN_URL" >> $GITHUB_OUTPUT + echo "Published build scan to $SCAN_URL" + echo "scan-url-${{ matrix.java }}=$SCAN_URL" >> $GITHUB_OUTPUT + + update-pr-comment: + needs: upload-build-scan + runs-on: ubuntu-latest + steps: - name: Update PR env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} PR_NUMBER: ${{ github.event.workflow_run.pull_requests[0].number }} run: | - echo "Finished publishing" - echo "Build scan url is: ${{ steps.publish-scan.outputs.scan-url }}" - gh pr comment $PR_NUMBER --body "Published scan ${{ steps.publish-scan.outputs.scan-url }} for workflow run ${{ github.event.workflow_run.html_url }} " \ No newline at end of file + echo "Build scans published for workflow ${{ github.event.workflow_run.html_url }}\n" >> pr-comment.txt + echo "Java 11: ${{ needs.upload-build-scan.outputs.build-scan-url-11 }} >> pr-comment.txt + echo "Java 17: ${{ needs.upload-build-scan.outputs.build-scan-url-17 }} >> pr-comment.txt + cat pr-comment.txt + gh pr comment $PR_NUMBER --body-file pr-comment.txt \ No newline at end of file From f7b24f0890c8cf775365d4dd9b55dde37711c3f0 Mon Sep 17 00:00:00 2001 From: David Arthur Date: Mon, 9 Sep 2024 10:07:01 -0400 Subject: [PATCH 09/39] fix quote --- .github/workflows/ci-complete.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci-complete.yml b/.github/workflows/ci-complete.yml index dd71efbb53226..825f79d7c5b45 100644 --- a/.github/workflows/ci-complete.yml +++ b/.github/workflows/ci-complete.yml @@ -72,8 +72,8 @@ jobs: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} PR_NUMBER: ${{ github.event.workflow_run.pull_requests[0].number }} run: | - echo "Build scans published for workflow ${{ github.event.workflow_run.html_url }}\n" >> pr-comment.txt - echo "Java 11: ${{ needs.upload-build-scan.outputs.build-scan-url-11 }} >> pr-comment.txt - echo "Java 17: ${{ needs.upload-build-scan.outputs.build-scan-url-17 }} >> pr-comment.txt + echo "Build scans published for workflow ${{ github.event.workflow_run.html_url }}" >> pr-comment.txt + echo "Java 11: ${{ needs.upload-build-scan.outputs.build-scan-url-11 }}" >> pr-comment.txt + echo "Java 17: ${{ needs.upload-build-scan.outputs.build-scan-url-17 }}" >> pr-comment.txt cat pr-comment.txt gh pr comment $PR_NUMBER --body-file pr-comment.txt \ No newline at end of file From 0346b06766ccb779bd450793820997373a6b6127 Mon Sep 17 00:00:00 2001 From: David Arthur Date: Mon, 9 Sep 2024 10:16:45 -0400 Subject: [PATCH 10/39] use status check --- .github/workflows/ci-complete.yml | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci-complete.yml b/.github/workflows/ci-complete.yml index 825f79d7c5b45..39b64fce45662 100644 --- a/.github/workflows/ci-complete.yml +++ b/.github/workflows/ci-complete.yml @@ -21,7 +21,7 @@ on: types: - completed -run-name: Build Scan for ${{ github.event.workflow_run.display_title}} +run-name: Build Scans for ${{ github.event.workflow_run.display_title}} jobs: upload-build-scan: @@ -61,7 +61,7 @@ jobs: ./gradlew --info buildScanPublishPrevious > gradle.out SCAN_URL=$(grep '^https://.*$' gradle.out) echo "Published build scan to $SCAN_URL" - echo "scan-url-${{ matrix.java }}=$SCAN_URL" >> $GITHUB_OUTPUT + echo "build-scan-url-${{ matrix.java }}=$SCAN_URL" >> $GITHUB_OUTPUT update-pr-comment: needs: upload-build-scan @@ -71,9 +71,13 @@ jobs: env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} PR_NUMBER: ${{ github.event.workflow_run.pull_requests[0].number }} + REPO: ${{ github.event.workflow_run.head_repository.full_name }} + SHA: ${{ github.event.workflow_run.head_sha }} run: | - echo "Build scans published for workflow ${{ github.event.workflow_run.html_url }}" >> pr-comment.txt - echo "Java 11: ${{ needs.upload-build-scan.outputs.build-scan-url-11 }}" >> pr-comment.txt - echo "Java 17: ${{ needs.upload-build-scan.outputs.build-scan-url-17 }}" >> pr-comment.txt - cat pr-comment.txt - gh pr comment $PR_NUMBER --body-file pr-comment.txt \ No newline at end of file + echo "Build scans published for workflow ${{ github.event.workflow_run.html_url }}" + echo "Java 11: ${{ needs.upload-build-scan.outputs.build-scan-url-11 }}" + echo "Java 17: ${{ needs.upload-build-scan.outputs.build-scan-url-17 }}" + gh api --method POST -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" \ + /repos/${{ env.REPO }}/statuses/${{ env.SHA }} \ + -f "state=success" -f "target_url=${{ needs.upload-build-scan.outputs.build-scan-url-11 }}" \ + -f "description=The build scan was successfully published" -f "context=gradle-build-scan/java-11" From 01a739e01271a9eff4027ef2377c1c15fcaf3a62 Mon Sep 17 00:00:00 2001 From: David Arthur Date: Mon, 9 Sep 2024 10:18:42 -0400 Subject: [PATCH 11/39] empty From 31ec37b70d536b06b7f9cb4a304fbf413f56ca67 Mon Sep 17 00:00:00 2001 From: David Arthur Date: Mon, 9 Sep 2024 10:24:36 -0400 Subject: [PATCH 12/39] fix outputs --- .github/workflows/ci-complete.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci-complete.yml b/.github/workflows/ci-complete.yml index 39b64fce45662..c165a96c5fd52 100644 --- a/.github/workflows/ci-complete.yml +++ b/.github/workflows/ci-complete.yml @@ -32,8 +32,8 @@ jobs: matrix: java: [ 17, 11 ] outputs: - build-scan-url-11: ${{ steps.publish-scan.scan-url-11 }} - build-scan-url-17: ${{ steps.publish-scan.scan-url-17 }} + build-scan-url-11: ${{ steps.publish-build-scan.outputs.build-scan-url-11 }} + build-scan-url-17: ${{ steps.publish-build-scan.outputs.build-scan-url-17 }} steps: - name: Env run: printenv @@ -56,14 +56,14 @@ jobs: name: build-scan-test-${{ matrix.java }} path: ~/.gradle/build-scan-data - name: Publish scan - id: publish-scan + id: publish-build-scan run: | ./gradlew --info buildScanPublishPrevious > gradle.out SCAN_URL=$(grep '^https://.*$' gradle.out) echo "Published build scan to $SCAN_URL" echo "build-scan-url-${{ matrix.java }}=$SCAN_URL" >> $GITHUB_OUTPUT - update-pr-comment: + update-pr: needs: upload-build-scan runs-on: ubuntu-latest steps: From 0341fdd30fa23a8552b381d94e3098d9664a2bce Mon Sep 17 00:00:00 2001 From: David Arthur Date: Mon, 9 Sep 2024 10:35:58 -0400 Subject: [PATCH 13/39] update workflow --- .github/workflows/ci-complete.yml | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci-complete.yml b/.github/workflows/ci-complete.yml index c165a96c5fd52..b8ee6ce318f0d 100644 --- a/.github/workflows/ci-complete.yml +++ b/.github/workflows/ci-complete.yml @@ -23,8 +23,22 @@ on: run-name: Build Scans for ${{ github.event.workflow_run.display_title}} +# This workflow runs after the completion of the CI workflow triggered on a "pull_request" event. +# The "pull_request" event type is run in an unprivileged context without access to the repository +# secrets. This means that PRs from public forks cannot publish Gradle Build Scans or modify the +# PR contents. +# +# This "workflow_run" triggered workflow is run in a privileged context and so does have access to +# the repository secrets. Here we can download the build scan files produced by a PR and publish +# them to ge.apache.org. +# +# If we need to do things like comment on, label, or otherwise modify PRs from public forks. This +# workflow is the place to do it. + jobs: upload-build-scan: + # Skip this workflow if CI was run for anything other than "pull_request" (like "push"). + # Also skip this workflow if the PR was from apache/kafka. Those will have already published the build scan in CI. if: ${{ github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.head_repository.full_name != 'apache/kafka' }} runs-on: ubuntu-latest strategy: @@ -54,7 +68,7 @@ jobs: github-token: ${{ github.token }} run-id: ${{ github.event.workflow_run.id }} name: build-scan-test-${{ matrix.java }} - path: ~/.gradle/build-scan-data + path: ~/.gradle/build-scan-data # This is where Gradle buffers unpublished build scan data when --no-scan is given - name: Publish scan id: publish-build-scan run: | @@ -74,10 +88,16 @@ jobs: REPO: ${{ github.event.workflow_run.head_repository.full_name }} SHA: ${{ github.event.workflow_run.head_sha }} run: | - echo "Build scans published for workflow ${{ github.event.workflow_run.html_url }}" - echo "Java 11: ${{ needs.upload-build-scan.outputs.build-scan-url-11 }}" - echo "Java 17: ${{ needs.upload-build-scan.outputs.build-scan-url-17 }}" + echo "Build scans published for workflow ${{ github.event.workflow_run.html_url }}" >> $GITHUB_STEP_SUMMARY + echo "Java 11: ${{ needs.upload-build-scan.outputs.build-scan-url-11 }}" >> $GITHUB_STEP_SUMMARY + echo "Java 17: ${{ needs.upload-build-scan.outputs.build-scan-url-17 }}" >> $GITHUB_STEP_SUMMARY gh api --method POST -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" \ /repos/${{ env.REPO }}/statuses/${{ env.SHA }} \ -f "state=success" -f "target_url=${{ needs.upload-build-scan.outputs.build-scan-url-11 }}" \ - -f "description=The build scan was successfully published" -f "context=gradle-build-scan/java-11" + -f "description=The build scan was successfully published" \ + -f "context=Gradle Build Scan / Java 11" + gh api --method POST -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" \ + /repos/${{ env.REPO }}/statuses/${{ env.SHA }} \ + -f "state=success" -f "target_url=${{ needs.upload-build-scan.outputs.build-scan-url-17 }}" \ + -f "description=The build scan was successfully published" \ + -f "context=Gradle Build Scan / Java 17" From beeb8e1d4e560c79bef9b21d0469956efa6a2e7b Mon Sep 17 00:00:00 2001 From: David Arthur Date: Mon, 9 Sep 2024 11:01:03 -0400 Subject: [PATCH 14/39] try composite action --- .../actions/gh-api-update-status/action.yml | 56 +++++++++++++++++++ .github/workflows/ci-complete.yml | 40 +++++++------ 2 files changed, 78 insertions(+), 18 deletions(-) create mode 100644 .github/actions/gh-api-update-status/action.yml diff --git a/.github/actions/gh-api-update-status/action.yml b/.github/actions/gh-api-update-status/action.yml new file mode 100644 index 0000000000000..d72c5e668ef18 --- /dev/null +++ b/.github/actions/gh-api-update-status/action.yml @@ -0,0 +1,56 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +--- +name: "Update Commit Status Check" +description: "Update the status of a commit check using the GH CLI" +inputs: + repository: + description: "The repository where the commit is located" + default: "apache/kafka" + commit_sha: + description: "The SHA of the commit we are updating" + required: true + url: + description: "The URL of the status check" + required: false + default: "" + description: + description: "The text to display next to the check" + default: "" + required: false + context: + description: "The name of the status check" + required: true + state: + description: "The state of the check. Can be one of: error, failure, pending, success" + required: true + +runs: + using: "composite" + steps: + - name: Update Check + shell: bash + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh api --method POST -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" \ + /repos/${{ inputs.repository }}/statuses/${{ inputs.commit_sha }} \ + -f "state=${{ inputs.state }}" -f "target_url=${{ inputs.url }}" \ + -f "description=${{ inputs.description }}" \ + -f "context=${{ inputs.context }}" + diff --git a/.github/workflows/ci-complete.yml b/.github/workflows/ci-complete.yml index b8ee6ce318f0d..52303a16b27d7 100644 --- a/.github/workflows/ci-complete.yml +++ b/.github/workflows/ci-complete.yml @@ -81,23 +81,27 @@ jobs: needs: upload-build-scan runs-on: ubuntu-latest steps: - - name: Update PR + - name: Update Java 11 Check + uses: ./.github/actions/gh-api-update-status env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - PR_NUMBER: ${{ github.event.workflow_run.pull_requests[0].number }} - REPO: ${{ github.event.workflow_run.head_repository.full_name }} - SHA: ${{ github.event.workflow_run.head_sha }} - run: | - echo "Build scans published for workflow ${{ github.event.workflow_run.html_url }}" >> $GITHUB_STEP_SUMMARY - echo "Java 11: ${{ needs.upload-build-scan.outputs.build-scan-url-11 }}" >> $GITHUB_STEP_SUMMARY - echo "Java 17: ${{ needs.upload-build-scan.outputs.build-scan-url-17 }}" >> $GITHUB_STEP_SUMMARY - gh api --method POST -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" \ - /repos/${{ env.REPO }}/statuses/${{ env.SHA }} \ - -f "state=success" -f "target_url=${{ needs.upload-build-scan.outputs.build-scan-url-11 }}" \ - -f "description=The build scan was successfully published" \ - -f "context=Gradle Build Scan / Java 11" - gh api --method POST -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" \ - /repos/${{ env.REPO }}/statuses/${{ env.SHA }} \ - -f "state=success" -f "target_url=${{ needs.upload-build-scan.outputs.build-scan-url-17 }}" \ - -f "description=The build scan was successfully published" \ - -f "context=Gradle Build Scan / Java 17" + with: + #PR_NUMBER: ${{ github.event.workflow_run.pull_requests[0].number }} + repository: ${{ github.event.workflow_run.head_repository.full_name }} + commit_sha: ${{ github.event.workflow_run.head_sha }} + url: ${{ needs.upload-build-scan.outputs.build-scan-url-11 }} + description: 'The build scan was successfully published' + context: 'Gradle Build Scan / Java 11' + status: 'complete' + - name: Update Java 17 Check + uses: ./.github/actions/gh-api-update-status + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + #PR_NUMBER: ${{ github.event.workflow_run.pull_requests[0].number }} + repository: ${{ github.event.workflow_run.head_repository.full_name }} + commit_sha: ${{ github.event.workflow_run.head_sha }} + url: ${{ needs.upload-build-scan.outputs.build-scan-url-17 }} + description: 'The build scan was successfully published' + context: 'Gradle Build Scan / Java 17' + status: 'complete' \ No newline at end of file From 6ca348c6897c479ca349f402da7a254f9d8807c9 Mon Sep 17 00:00:00 2001 From: David Arthur Date: Mon, 9 Sep 2024 11:13:39 -0400 Subject: [PATCH 15/39] fix workflow --- .github/workflows/ci-complete.yml | 30 +++++------------------------- 1 file changed, 5 insertions(+), 25 deletions(-) diff --git a/.github/workflows/ci-complete.yml b/.github/workflows/ci-complete.yml index 52303a16b27d7..bee92dc0c7406 100644 --- a/.github/workflows/ci-complete.yml +++ b/.github/workflows/ci-complete.yml @@ -45,9 +45,6 @@ jobs: fail-fast: false matrix: java: [ 17, 11 ] - outputs: - build-scan-url-11: ${{ steps.publish-build-scan.outputs.build-scan-url-11 }} - build-scan-url-17: ${{ steps.publish-build-scan.outputs.build-scan-url-17 }} steps: - name: Env run: printenv @@ -69,19 +66,14 @@ jobs: run-id: ${{ github.event.workflow_run.id }} name: build-scan-test-${{ matrix.java }} path: ~/.gradle/build-scan-data # This is where Gradle buffers unpublished build scan data when --no-scan is given - - name: Publish scan + - name: Publish Scan id: publish-build-scan run: | ./gradlew --info buildScanPublishPrevious > gradle.out SCAN_URL=$(grep '^https://.*$' gradle.out) echo "Published build scan to $SCAN_URL" - echo "build-scan-url-${{ matrix.java }}=$SCAN_URL" >> $GITHUB_OUTPUT - - update-pr: - needs: upload-build-scan - runs-on: ubuntu-latest - steps: - - name: Update Java 11 Check + echo "build-scan-url=$SCAN_URL" >> $GITHUB_OUTPUT + - name: Update Status Check uses: ./.github/actions/gh-api-update-status env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -89,19 +81,7 @@ jobs: #PR_NUMBER: ${{ github.event.workflow_run.pull_requests[0].number }} repository: ${{ github.event.workflow_run.head_repository.full_name }} commit_sha: ${{ github.event.workflow_run.head_sha }} - url: ${{ needs.upload-build-scan.outputs.build-scan-url-11 }} + url: ${{ steps.publish-build-scan.outputs.build-scan-url }} description: 'The build scan was successfully published' - context: 'Gradle Build Scan / Java 11' + context: 'Gradle Build Scan / Java ${{ matrix.java }}' status: 'complete' - - name: Update Java 17 Check - uses: ./.github/actions/gh-api-update-status - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - #PR_NUMBER: ${{ github.event.workflow_run.pull_requests[0].number }} - repository: ${{ github.event.workflow_run.head_repository.full_name }} - commit_sha: ${{ github.event.workflow_run.head_sha }} - url: ${{ needs.upload-build-scan.outputs.build-scan-url-17 }} - description: 'The build scan was successfully published' - context: 'Gradle Build Scan / Java 17' - status: 'complete' \ No newline at end of file From aacd31b1d0929054ad74828f19ac76d7cf90c2dc Mon Sep 17 00:00:00 2001 From: David Arthur Date: Mon, 9 Sep 2024 11:21:28 -0400 Subject: [PATCH 16/39] pass token --- .github/actions/gh-api-update-status/action.yml | 5 ++++- .github/workflows/ci-complete.yml | 3 +-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/actions/gh-api-update-status/action.yml b/.github/actions/gh-api-update-status/action.yml index d72c5e668ef18..585df26d0a019 100644 --- a/.github/actions/gh-api-update-status/action.yml +++ b/.github/actions/gh-api-update-status/action.yml @@ -19,6 +19,9 @@ name: "Update Commit Status Check" description: "Update the status of a commit check using the GH CLI" inputs: + gh-token: + description: "The GitHub token for use with the CLI" + required: true repository: description: "The repository where the commit is located" default: "apache/kafka" @@ -46,7 +49,7 @@ runs: - name: Update Check shell: bash env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_TOKEN: ${{ inputs.gh-token }} run: | gh api --method POST -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" \ /repos/${{ inputs.repository }}/statuses/${{ inputs.commit_sha }} \ diff --git a/.github/workflows/ci-complete.yml b/.github/workflows/ci-complete.yml index bee92dc0c7406..866cd5eddfa10 100644 --- a/.github/workflows/ci-complete.yml +++ b/.github/workflows/ci-complete.yml @@ -75,9 +75,8 @@ jobs: echo "build-scan-url=$SCAN_URL" >> $GITHUB_OUTPUT - name: Update Status Check uses: ./.github/actions/gh-api-update-status - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: + gh-token: ${{ secrets.GITHUB_TOKEN }} #PR_NUMBER: ${{ github.event.workflow_run.pull_requests[0].number }} repository: ${{ github.event.workflow_run.head_repository.full_name }} commit_sha: ${{ github.event.workflow_run.head_sha }} From c72d7da9ce518f55bd4d651872cd3abe92d92c9b Mon Sep 17 00:00:00 2001 From: David Arthur Date: Mon, 9 Sep 2024 11:25:46 -0400 Subject: [PATCH 17/39] fix state --- .github/workflows/ci-complete.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-complete.yml b/.github/workflows/ci-complete.yml index 866cd5eddfa10..e45ab4fba9138 100644 --- a/.github/workflows/ci-complete.yml +++ b/.github/workflows/ci-complete.yml @@ -83,4 +83,4 @@ jobs: url: ${{ steps.publish-build-scan.outputs.build-scan-url }} description: 'The build scan was successfully published' context: 'Gradle Build Scan / Java ${{ matrix.java }}' - status: 'complete' + state: 'complete' From 363a96e5b3d3b64337ab9acfefbed4c43be7d66e Mon Sep 17 00:00:00 2001 From: David Arthur Date: Mon, 9 Sep 2024 11:32:16 -0400 Subject: [PATCH 18/39] fix state value --- .github/workflows/ci-complete.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-complete.yml b/.github/workflows/ci-complete.yml index e45ab4fba9138..1bb862b299d49 100644 --- a/.github/workflows/ci-complete.yml +++ b/.github/workflows/ci-complete.yml @@ -83,4 +83,4 @@ jobs: url: ${{ steps.publish-build-scan.outputs.build-scan-url }} description: 'The build scan was successfully published' context: 'Gradle Build Scan / Java ${{ matrix.java }}' - state: 'complete' + state: 'success' From 0a34da8e4e62f79a682b7960395530a18f473c1f Mon Sep 17 00:00:00 2001 From: David Arthur Date: Mon, 9 Sep 2024 11:40:18 -0400 Subject: [PATCH 19/39] clear check before run --- .github/workflows/build.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b8dbe5a4feea5..56b3a6c1c693d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -52,6 +52,15 @@ jobs: uses: actions/checkout@v4 with: persist-credentials: false + - name: Clear Status Check + uses: ./.github/actions/gh-api-update-status + with: + gh-token: ${{ secrets.GITHUB_TOKEN }} + repository: ${{ github.event.pull_request.head.repo.full_name }} + commit_sha: ${{ github.event.pull_request.head.sha }} + url: ${{ steps.publish-build-scan.outputs.build-scan-url }} + context: 'Gradle Build Scan / Java ${{ matrix.java }}' + state: 'pending' - uses: actions/setup-python@v5 with: python-version: '3.12' From d6e72df8d37ec05f41a8e12e960860678cc8dd90 Mon Sep 17 00:00:00 2001 From: David Arthur Date: Mon, 9 Sep 2024 11:43:17 -0400 Subject: [PATCH 20/39] only clear the check in test job --- .github/workflows/build.yml | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 56b3a6c1c693d..ecfc933ad9281 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -52,15 +52,6 @@ jobs: uses: actions/checkout@v4 with: persist-credentials: false - - name: Clear Status Check - uses: ./.github/actions/gh-api-update-status - with: - gh-token: ${{ secrets.GITHUB_TOKEN }} - repository: ${{ github.event.pull_request.head.repo.full_name }} - commit_sha: ${{ github.event.pull_request.head.sha }} - url: ${{ steps.publish-build-scan.outputs.build-scan-url }} - context: 'Gradle Build Scan / Java ${{ matrix.java }}' - state: 'pending' - uses: actions/setup-python@v5 with: python-version: '3.12' @@ -107,6 +98,14 @@ jobs: uses: actions/checkout@v4 with: persist-credentials: false + - name: Clear Status Check + uses: ./.github/actions/gh-api-update-status + with: + gh-token: ${{ secrets.GITHUB_TOKEN }} + repository: ${{ github.event.pull_request.head.repo.full_name }} + commit_sha: ${{ github.event.pull_request.head.sha }} + context: 'Gradle Build Scan / Java ${{ matrix.java }}' + state: 'pending' - name: Setup Gradle uses: ./.github/actions/setup-gradle with: From ca8ffb435b026b84223c7cce7a5590b5ef77ba21 Mon Sep 17 00:00:00 2001 From: David Arthur Date: Mon, 9 Sep 2024 11:53:53 -0400 Subject: [PATCH 21/39] add failure check --- .github/workflows/build.yml | 8 -------- .github/workflows/ci-complete.yml | 14 ++++++++++++-- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ecfc933ad9281..b8dbe5a4feea5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -98,14 +98,6 @@ jobs: uses: actions/checkout@v4 with: persist-credentials: false - - name: Clear Status Check - uses: ./.github/actions/gh-api-update-status - with: - gh-token: ${{ secrets.GITHUB_TOKEN }} - repository: ${{ github.event.pull_request.head.repo.full_name }} - commit_sha: ${{ github.event.pull_request.head.sha }} - context: 'Gradle Build Scan / Java ${{ matrix.java }}' - state: 'pending' - name: Setup Gradle uses: ./.github/actions/setup-gradle with: diff --git a/.github/workflows/ci-complete.yml b/.github/workflows/ci-complete.yml index 1bb862b299d49..6f31753408ce6 100644 --- a/.github/workflows/ci-complete.yml +++ b/.github/workflows/ci-complete.yml @@ -33,7 +33,7 @@ run-name: Build Scans for ${{ github.event.workflow_run.display_title}} # them to ge.apache.org. # # If we need to do things like comment on, label, or otherwise modify PRs from public forks. This -# workflow is the place to do it. +# workflow is the place to do it. PR number is ${{ github.event.workflow_run.pull_requests[0].number }} jobs: upload-build-scan: @@ -73,11 +73,21 @@ jobs: SCAN_URL=$(grep '^https://.*$' gradle.out) echo "Published build scan to $SCAN_URL" echo "build-scan-url=$SCAN_URL" >> $GITHUB_OUTPUT + exit 1 + - name: Handle failed publish + if: failed() + uses: ./.github/actions/gh-api-update-status + with: + gh-token: ${{ secrets.GITHUB_TOKEN }} + repository: ${{ github.event.workflow_run.head_repository.full_name }} + commit_sha: ${{ github.event.workflow_run.head_sha }} + description: 'The build scan could not be published' + context: 'Gradle Build Scan / Java ${{ matrix.java }}' + state: 'error' - name: Update Status Check uses: ./.github/actions/gh-api-update-status with: gh-token: ${{ secrets.GITHUB_TOKEN }} - #PR_NUMBER: ${{ github.event.workflow_run.pull_requests[0].number }} repository: ${{ github.event.workflow_run.head_repository.full_name }} commit_sha: ${{ github.event.workflow_run.head_sha }} url: ${{ steps.publish-build-scan.outputs.build-scan-url }} From ee781a40afe0ae84af6847deab56564756309761 Mon Sep 17 00:00:00 2001 From: David Arthur Date: Mon, 9 Sep 2024 11:54:37 -0400 Subject: [PATCH 22/39] fix syntax --- .github/workflows/ci-complete.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-complete.yml b/.github/workflows/ci-complete.yml index 6f31753408ce6..4e144bd7f5a70 100644 --- a/.github/workflows/ci-complete.yml +++ b/.github/workflows/ci-complete.yml @@ -75,7 +75,7 @@ jobs: echo "build-scan-url=$SCAN_URL" >> $GITHUB_OUTPUT exit 1 - name: Handle failed publish - if: failed() + if: failure() uses: ./.github/actions/gh-api-update-status with: gh-token: ${{ secrets.GITHUB_TOKEN }} From e2bb9f59a6d89fcbc23425170892a18fcf782457 Mon Sep 17 00:00:00 2001 From: David Arthur Date: Mon, 9 Sep 2024 12:03:08 -0400 Subject: [PATCH 23/39] add url for failure --- .github/workflows/ci-complete.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci-complete.yml b/.github/workflows/ci-complete.yml index 4e144bd7f5a70..cc14d53247dee 100644 --- a/.github/workflows/ci-complete.yml +++ b/.github/workflows/ci-complete.yml @@ -81,6 +81,7 @@ jobs: gh-token: ${{ secrets.GITHUB_TOKEN }} repository: ${{ github.event.workflow_run.head_repository.full_name }} commit_sha: ${{ github.event.workflow_run.head_sha }} + url: '${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }}' description: 'The build scan could not be published' context: 'Gradle Build Scan / Java ${{ matrix.java }}' state: 'error' From a8e211e175b28215f2a918279037802e53fae6db Mon Sep 17 00:00:00 2001 From: David Arthur Date: Mon, 9 Sep 2024 12:30:27 -0400 Subject: [PATCH 24/39] remove failure --- .github/workflows/ci-complete.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci-complete.yml b/.github/workflows/ci-complete.yml index cc14d53247dee..0b808dd32902e 100644 --- a/.github/workflows/ci-complete.yml +++ b/.github/workflows/ci-complete.yml @@ -73,7 +73,6 @@ jobs: SCAN_URL=$(grep '^https://.*$' gradle.out) echo "Published build scan to $SCAN_URL" echo "build-scan-url=$SCAN_URL" >> $GITHUB_OUTPUT - exit 1 - name: Handle failed publish if: failure() uses: ./.github/actions/gh-api-update-status From 654acafb4131ea76068f179e69856bf45a1ff503 Mon Sep 17 00:00:00 2001 From: David Arthur Date: Mon, 9 Sep 2024 12:31:10 -0400 Subject: [PATCH 25/39] empty From 6cfcdcbe9bddeb0f34eef614f85899372a1ec62c Mon Sep 17 00:00:00 2001 From: David Arthur Date: Mon, 9 Sep 2024 12:37:35 -0400 Subject: [PATCH 26/39] run full tests --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0d7a466930d67..b8dbe5a4feea5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -120,7 +120,7 @@ jobs: -PmaxParallelForks=2 \ -PmaxTestRetries=1 -PmaxTestRetryFailures=10 \ -PcommitId=xxxxxxxxxxxxxxxx \ - :metadata:test + test exitcode="$?" echo "exitcode=$exitcode" >> $GITHUB_OUTPUT - name: Archive JUnit reports From de8754834c6060f054f746bb91ebb00cee0f1a4c Mon Sep 17 00:00:00 2001 From: David Arthur Date: Mon, 9 Sep 2024 12:46:29 -0400 Subject: [PATCH 27/39] add step conditions --- .github/workflows/ci-complete.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-complete.yml b/.github/workflows/ci-complete.yml index 0b808dd32902e..30cd895a33825 100644 --- a/.github/workflows/ci-complete.yml +++ b/.github/workflows/ci-complete.yml @@ -60,7 +60,10 @@ jobs: with: java-version: ${{ matrix.java }} develocity-access-key: ${{ secrets.GE_ACCESS_TOKEN }} - - uses: actions/download-artifact@v4 + - name: Download build scan archive + id: download-build-scan + uses: actions/download-artifact@v4 + continue-on-error: true with: github-token: ${{ github.token }} run-id: ${{ github.event.workflow_run.id }} @@ -68,13 +71,15 @@ jobs: path: ~/.gradle/build-scan-data # This is where Gradle buffers unpublished build scan data when --no-scan is given - name: Publish Scan id: publish-build-scan + continue-on-error: true + if: ${{ steps.download-build-scan.outcome == 'success' }} run: | ./gradlew --info buildScanPublishPrevious > gradle.out SCAN_URL=$(grep '^https://.*$' gradle.out) echo "Published build scan to $SCAN_URL" echo "build-scan-url=$SCAN_URL" >> $GITHUB_OUTPUT - name: Handle failed publish - if: failure() + if: ${{ steps.publish-build-scan.outcome == 'failure' }} uses: ./.github/actions/gh-api-update-status with: gh-token: ${{ secrets.GITHUB_TOKEN }} @@ -85,6 +90,7 @@ jobs: context: 'Gradle Build Scan / Java ${{ matrix.java }}' state: 'error' - name: Update Status Check + if: ${{ steps.publish-build-scan.outcome == 'success' }} uses: ./.github/actions/gh-api-update-status with: gh-token: ${{ secrets.GITHUB_TOKEN }} From 8c0ca4073a34bb3a16e8a729d67d0269c388657f Mon Sep 17 00:00:00 2001 From: David Arthur Date: Mon, 9 Sep 2024 12:47:12 -0400 Subject: [PATCH 28/39] simulate failure --- .github/workflows/build.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b8dbe5a4feea5..dc903fadfa505 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -120,9 +120,10 @@ jobs: -PmaxParallelForks=2 \ -PmaxTestRetries=1 -PmaxTestRetryFailures=10 \ -PcommitId=xxxxxxxxxxxxxxxx \ - test + :metadata:test exitcode="$?" echo "exitcode=$exitcode" >> $GITHUB_OUTPUT + exit 1 - name: Archive JUnit reports uses: actions/upload-artifact@v4 id: junit-upload-artifact From eb3a652883156d24b22085627e297bdef600a8cf Mon Sep 17 00:00:00 2001 From: David Arthur Date: Mon, 9 Sep 2024 12:47:43 -0400 Subject: [PATCH 29/39] add conditions to steps --- .github/workflows/ci-complete.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-complete.yml b/.github/workflows/ci-complete.yml index 0b808dd32902e..30cd895a33825 100644 --- a/.github/workflows/ci-complete.yml +++ b/.github/workflows/ci-complete.yml @@ -60,7 +60,10 @@ jobs: with: java-version: ${{ matrix.java }} develocity-access-key: ${{ secrets.GE_ACCESS_TOKEN }} - - uses: actions/download-artifact@v4 + - name: Download build scan archive + id: download-build-scan + uses: actions/download-artifact@v4 + continue-on-error: true with: github-token: ${{ github.token }} run-id: ${{ github.event.workflow_run.id }} @@ -68,13 +71,15 @@ jobs: path: ~/.gradle/build-scan-data # This is where Gradle buffers unpublished build scan data when --no-scan is given - name: Publish Scan id: publish-build-scan + continue-on-error: true + if: ${{ steps.download-build-scan.outcome == 'success' }} run: | ./gradlew --info buildScanPublishPrevious > gradle.out SCAN_URL=$(grep '^https://.*$' gradle.out) echo "Published build scan to $SCAN_URL" echo "build-scan-url=$SCAN_URL" >> $GITHUB_OUTPUT - name: Handle failed publish - if: failure() + if: ${{ steps.publish-build-scan.outcome == 'failure' }} uses: ./.github/actions/gh-api-update-status with: gh-token: ${{ secrets.GITHUB_TOKEN }} @@ -85,6 +90,7 @@ jobs: context: 'Gradle Build Scan / Java ${{ matrix.java }}' state: 'error' - name: Update Status Check + if: ${{ steps.publish-build-scan.outcome == 'success' }} uses: ./.github/actions/gh-api-update-status with: gh-token: ${{ secrets.GITHUB_TOKEN }} From 6f1bfad423bcc93b58112f1f2b908d735c190c64 Mon Sep 17 00:00:00 2001 From: David Arthur Date: Mon, 9 Sep 2024 12:52:26 -0400 Subject: [PATCH 30/39] add summary --- .github/actions/gh-api-update-status/action.yml | 1 - .github/workflows/ci-complete.yml | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/actions/gh-api-update-status/action.yml b/.github/actions/gh-api-update-status/action.yml index 585df26d0a019..6a699d948ede0 100644 --- a/.github/actions/gh-api-update-status/action.yml +++ b/.github/actions/gh-api-update-status/action.yml @@ -56,4 +56,3 @@ runs: -f "state=${{ inputs.state }}" -f "target_url=${{ inputs.url }}" \ -f "description=${{ inputs.description }}" \ -f "context=${{ inputs.context }}" - diff --git a/.github/workflows/ci-complete.yml b/.github/workflows/ci-complete.yml index 30cd895a33825..e5721e447bc26 100644 --- a/.github/workflows/ci-complete.yml +++ b/.github/workflows/ci-complete.yml @@ -69,6 +69,10 @@ jobs: run-id: ${{ github.event.workflow_run.id }} name: build-scan-test-${{ matrix.java }} path: ~/.gradle/build-scan-data # This is where Gradle buffers unpublished build scan data when --no-scan is given + - name: Handle missing scan + if: ${{ steps.download-build-scan.outcome == 'failure' }} + run: | + echo "Could not download build scans from ${{ github.event.workflow_run.html_url }} " >> $GITHUB_STEP_SUMMARY - name: Publish Scan id: publish-build-scan continue-on-error: true From 89396aef5707b9eba8e32309511e59266fadecaf Mon Sep 17 00:00:00 2001 From: David Arthur Date: Mon, 9 Sep 2024 12:58:47 -0400 Subject: [PATCH 31/39] remove failure --- .github/workflows/build.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index dc903fadfa505..0d7a466930d67 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -123,7 +123,6 @@ jobs: :metadata:test exitcode="$?" echo "exitcode=$exitcode" >> $GITHUB_OUTPUT - exit 1 - name: Archive JUnit reports uses: actions/upload-artifact@v4 id: junit-upload-artifact From e18df31639e03d15d483ee8d7d6aea5975ab5497 Mon Sep 17 00:00:00 2001 From: David Arthur Date: Mon, 9 Sep 2024 13:05:01 -0400 Subject: [PATCH 32/39] simulate failure --- .github/workflows/ci-complete.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci-complete.yml b/.github/workflows/ci-complete.yml index e5721e447bc26..1ebf285b89895 100644 --- a/.github/workflows/ci-complete.yml +++ b/.github/workflows/ci-complete.yml @@ -82,6 +82,7 @@ jobs: SCAN_URL=$(grep '^https://.*$' gradle.out) echo "Published build scan to $SCAN_URL" echo "build-scan-url=$SCAN_URL" >> $GITHUB_OUTPUT + exit 1 - name: Handle failed publish if: ${{ steps.publish-build-scan.outcome == 'failure' }} uses: ./.github/actions/gh-api-update-status From 27ad4d9ecd1945907c8384914b39c69afd72f9fd Mon Sep 17 00:00:00 2001 From: David Arthur Date: Mon, 9 Sep 2024 13:10:03 -0400 Subject: [PATCH 33/39] remove failure --- .github/workflows/ci-complete.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci-complete.yml b/.github/workflows/ci-complete.yml index 1ebf285b89895..e5721e447bc26 100644 --- a/.github/workflows/ci-complete.yml +++ b/.github/workflows/ci-complete.yml @@ -82,7 +82,6 @@ jobs: SCAN_URL=$(grep '^https://.*$' gradle.out) echo "Published build scan to $SCAN_URL" echo "build-scan-url=$SCAN_URL" >> $GITHUB_OUTPUT - exit 1 - name: Handle failed publish if: ${{ steps.publish-build-scan.outcome == 'failure' }} uses: ./.github/actions/gh-api-update-status From 748909ad02ed675e321c2aa0e5df1ab6d32d385b Mon Sep 17 00:00:00 2001 From: David Arthur Date: Mon, 9 Sep 2024 13:11:28 -0400 Subject: [PATCH 34/39] run all tests --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0d7a466930d67..b8dbe5a4feea5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -120,7 +120,7 @@ jobs: -PmaxParallelForks=2 \ -PmaxTestRetries=1 -PmaxTestRetryFailures=10 \ -PcommitId=xxxxxxxxxxxxxxxx \ - :metadata:test + test exitcode="$?" echo "exitcode=$exitcode" >> $GITHUB_OUTPUT - name: Archive JUnit reports From 0a1423ebeba09c24b58475fdd436346040570934 Mon Sep 17 00:00:00 2001 From: David Arthur Date: Mon, 9 Sep 2024 13:12:20 -0400 Subject: [PATCH 35/39] cat the gradle stdout --- .github/workflows/ci-complete.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci-complete.yml b/.github/workflows/ci-complete.yml index e5721e447bc26..f8a96cd0f4b76 100644 --- a/.github/workflows/ci-complete.yml +++ b/.github/workflows/ci-complete.yml @@ -80,6 +80,7 @@ jobs: run: | ./gradlew --info buildScanPublishPrevious > gradle.out SCAN_URL=$(grep '^https://.*$' gradle.out) + cat gradle.out echo "Published build scan to $SCAN_URL" echo "build-scan-url=$SCAN_URL" >> $GITHUB_OUTPUT - name: Handle failed publish From c745f1120b4b26d79f41094481b8ddf142a1b248 Mon Sep 17 00:00:00 2001 From: David Arthur Date: Mon, 9 Sep 2024 14:06:50 -0400 Subject: [PATCH 36/39] PR feedback --- .github/workflows/ci-complete.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-complete.yml b/.github/workflows/ci-complete.yml index f8a96cd0f4b76..b45b23645a751 100644 --- a/.github/workflows/ci-complete.yml +++ b/.github/workflows/ci-complete.yml @@ -81,7 +81,7 @@ jobs: ./gradlew --info buildScanPublishPrevious > gradle.out SCAN_URL=$(grep '^https://.*$' gradle.out) cat gradle.out - echo "Published build scan to $SCAN_URL" + echo "Published build scan to $SCAN_URL" >> $GITHUB_STEP_SUMMARY echo "build-scan-url=$SCAN_URL" >> $GITHUB_OUTPUT - name: Handle failed publish if: ${{ steps.publish-build-scan.outcome == 'failure' }} From f17700e40329a182851e7923c293d52bb854843c Mon Sep 17 00:00:00 2001 From: David Arthur Date: Mon, 9 Sep 2024 14:55:06 -0400 Subject: [PATCH 37/39] more PR feedback --- .github/workflows/build.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 60f2a132b7e4f..e65f6f9c8ecce 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -63,7 +63,10 @@ jobs: # --build-cache: Let Gradle restore the build cache # --info: For now, we'll generate lots of logs while setting up the GH Actions # --scan: Attempt to publish build scans in PRs. This will only work on PRs from apache/kafka, not public forks. - run: ./gradlew --build-cache --info --scan check -x test + run: | + ./gradlew --build-cache --info + ${{ inputs.is-public-fork == 'true' && '--no-scan' || '--scan' }} \ + check -x test - name: Archive check reports if: always() uses: actions/upload-artifact@v4 @@ -85,7 +88,7 @@ jobs: strategy: fail-fast: false matrix: - java: [ 17, 11 ] + java: [ 17, 11 ] # If we change these, make sure to adjust ci-complete.yml name: JUnit tests Java ${{ matrix.java }} steps: - name: Checkout code From 93a9216b965110319eb50195e370239580d28947 Mon Sep 17 00:00:00 2001 From: David Arthur Date: Mon, 9 Sep 2024 14:55:35 -0400 Subject: [PATCH 38/39] missed slash --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e65f6f9c8ecce..0a6adc5d68876 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -64,7 +64,7 @@ jobs: # --info: For now, we'll generate lots of logs while setting up the GH Actions # --scan: Attempt to publish build scans in PRs. This will only work on PRs from apache/kafka, not public forks. run: | - ./gradlew --build-cache --info + ./gradlew --build-cache --info \ ${{ inputs.is-public-fork == 'true' && '--no-scan' || '--scan' }} \ check -x test - name: Archive check reports From a7e801facf9755763f17b3b065263fc7b9509063 Mon Sep 17 00:00:00 2001 From: David Arthur Date: Mon, 9 Sep 2024 14:56:39 -0400 Subject: [PATCH 39/39] document no-scan --- .github/workflows/build.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0a6adc5d68876..b36f3d4e38828 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -62,7 +62,8 @@ jobs: # Gradle flags # --build-cache: Let Gradle restore the build cache # --info: For now, we'll generate lots of logs while setting up the GH Actions - # --scan: Attempt to publish build scans in PRs. This will only work on PRs from apache/kafka, not public forks. + # --scan: Publish the build scan. This will only work on PRs from apache/kafka and trunk + # --no-scan: For public fork PRs, we won't attempt to publish the scan run: | ./gradlew --build-cache --info \ ${{ inputs.is-public-fork == 'true' && '--no-scan' || '--scan' }} \