From a14a89f2b865c5404bc545984db30d49e9a00b39 Mon Sep 17 00:00:00 2001 From: Thilo Fromm Date: Fri, 26 May 2023 09:48:49 +0200 Subject: [PATCH 1/3] workflows/pr-comment,run-kola: fix concurrency + results comment This change includes 2 unrelated small fixes to the "PR comment command" build+test feature: 1. The concurrency group now contains the PR number, ensuring that builds for multiple PRs can run in parallel. This addresses an issue in which starting a build on a PR would cancel a running build of another PR. 2. Post test results to the PR where the build command was issued on. The add-pr-comment step's condition was not updated when switching to PR comment commands for starting builds, so the step would only run if the action was triggered by a PR change event. Since we now trigger on issue_comment, the step never ran. Signed-off-by: Thilo Fromm --- .github/workflows/pr-comment-build-dispatcher.yaml | 2 +- .github/workflows/run-kola-tests.yaml | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr-comment-build-dispatcher.yaml b/.github/workflows/pr-comment-build-dispatcher.yaml index a3ab744540..fc18fbb4f3 100644 --- a/.github/workflows/pr-comment-build-dispatcher.yaml +++ b/.github/workflows/pr-comment-build-dispatcher.yaml @@ -7,7 +7,7 @@ permissions: pull-requests: write concurrency: - group: ${{ github.workflow }}-pr-command-${{ github.head_ref || github.ref_name }} + group: ${{ github.workflow }}-pr-command-${{ github.event.issue.pull_request.number }} cancel-in-progress: true jobs: diff --git a/.github/workflows/run-kola-tests.yaml b/.github/workflows/run-kola-tests.yaml index 53846d852a..8f4234a5e7 100644 --- a/.github/workflows/run-kola-tests.yaml +++ b/.github/workflows/run-kola-tests.yaml @@ -351,8 +351,9 @@ jobs: cat test-results.md >> "$GITHUB_STEP_SUMMARY" - - name: If started from a PR, post test summary to PR - if: ${{ github.event_name == 'pull_request' }} + - name: If started from a PR event or a PR comment command, post test summary to PR + if: ${{ github.event_name == 'pull_request' || github.event.issue.pull_request }} uses: mshick/add-pr-comment@v2 with: + issue: ${{ github.event.pull_request.number || github.event.issue.pull_request.number }} message-path: "scripts/test-results.md" From af686c0f411021daa1511a01c48e68a1b188d3b4 Mon Sep 17 00:00:00 2001 From: Thilo Fromm Date: Fri, 26 May 2023 10:07:00 +0200 Subject: [PATCH 2/3] workflows/pr-comment-dispatcher: post link to workflow run Signed-off-by: Thilo Fromm --- .github/workflows/pr-comment-build-dispatcher.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/pr-comment-build-dispatcher.yaml b/.github/workflows/pr-comment-build-dispatcher.yaml index fc18fbb4f3..a982e2c134 100644 --- a/.github/workflows/pr-comment-build-dispatcher.yaml +++ b/.github/workflows/pr-comment-build-dispatcher.yaml @@ -49,6 +49,12 @@ jobs: $res + - name: Post a link to the workflow run to the PR + uses: mshick/add-pr-comment@v2 + with: + issue: ${{ github.event.issue.pull_request.number }} + message: "Build action triggered: [${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})" + update_sdk: needs: check_maintainer_membership if: ( always() && needs.check_maintainer_membership.result == 'success' From 5e1a2c270d9d8239bcf91e518004954eb1c5a93c Mon Sep 17 00:00:00 2001 From: Thilo Fromm Date: Tue, 30 May 2023 18:13:11 +0200 Subject: [PATCH 3/3] workflows/pr-comment-builds: remove always() condition Signed-off-by: Thilo Fromm --- .github/workflows/pr-comment-build-dispatcher.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pr-comment-build-dispatcher.yaml b/.github/workflows/pr-comment-build-dispatcher.yaml index a982e2c134..4d334d2601 100644 --- a/.github/workflows/pr-comment-build-dispatcher.yaml +++ b/.github/workflows/pr-comment-build-dispatcher.yaml @@ -57,8 +57,8 @@ jobs: update_sdk: needs: check_maintainer_membership - if: ( always() && needs.check_maintainer_membership.result == 'success' - && contains(github.event.comment.body, '/update-sdk') ) + if: ( needs.check_maintainer_membership.result == 'success' + && contains(github.event.comment.body, '/update-sdk') ) name: "Build an updated SDK container" # SDK build needs access to bincache ssh secret secrets: inherit @@ -66,8 +66,8 @@ jobs: build_image: needs: [ check_maintainer_membership, update_sdk ] - if: ( always() && needs.check_maintainer_membership.result == 'success' - && ( contains(github.event.comment.body, '/build-image') || needs.update_sdk.result == 'success' ) ) + if: ( needs.check_maintainer_membership.result == 'success' + && ( contains(github.event.comment.body, '/build-image') || needs.update_sdk.result == 'success' ) ) name: "Build the OS image" uses: ./.github/workflows/ci.yaml with: