forked from vectordotdev/vector
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(ci): fix k8s validate comment job logic (vectordotdev#17841)
The comment validation job was incorrectly running on any workflow trigger that _wasn't_ the comment trigger. This resulted in the job running on contributor PRs and failing. On vector team member PRs, the job was being run excessively but passed because the validation passed. --------- Co-authored-by: Doug Smith <[email protected]>
- Loading branch information
1 parent
9c0d2f2
commit 99502bb
Showing
3 changed files
with
25 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -377,9 +377,9 @@ jobs: | |
uses: xt0rted/pull-request-comment-branch@v2 | ||
id: comment-branch | ||
|
||
- name: (PR comment) Submit PR result as ${{ needs.test-integration.result }} | ||
- name: (PR comment) Submit PR result as ${{ needs.integration-tests.result }} | ||
uses: myrotvorets/[email protected] | ||
with: | ||
sha: ${{ steps.comment-branch.outputs.head_sha }} | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
status: ${{ needs.test-integration.result }} | ||
status: ${{ needs.integration-tests.result }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,9 +16,8 @@ name: K8S E2E Suite | |
|
||
on: | ||
workflow_dispatch: | ||
workflow_call: | ||
pull_request: | ||
issue_comment: | ||
types: [created] | ||
merge_group: | ||
types: [checks_requested] | ||
schedule: | ||
|
@@ -27,7 +26,6 @@ on: | |
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.number || github.event.comment.html_url || github.event.merge_group.head_sha || github.event.schedule || github.sha }} | ||
|
||
cancel-in-progress: true | ||
|
||
env: | ||
|
@@ -42,31 +40,9 @@ env: | |
PROFILE: debug | ||
|
||
jobs: | ||
validate: | ||
name: Validate comment | ||
runs-on: ubuntu-latest | ||
if: | | ||
github.event_name != 'issue_comment' || | ||
( github.event.issue.pull_request && | ||
( contains(github.event.comment.body, '/ci-run-all') || | ||
contains(github.event.comment.body, '/ci-run-k8s') | ||
) | ||
) | ||
steps: | ||
- name: Get PR comment author | ||
id: comment | ||
uses: tspascoal/get-user-teams-membership@v2 | ||
with: | ||
username: ${{ github.actor }} | ||
team: 'Vector' | ||
GITHUB_TOKEN: ${{ secrets.GH_PAT_ORG }} | ||
|
||
- name: Validate author membership | ||
if: steps.comment.outputs.isTeamMember == 'false' | ||
run: exit 1 | ||
|
||
changes: | ||
needs: validate | ||
# Only evaluate files changed on pull request trigger | ||
if: github.event_name == 'pull_request' | ||
uses: ./.github/workflows/changes.yml | ||
with: | ||
base_ref: ${{ github.event.pull_request.base.ref }} | ||
|
@@ -76,8 +52,9 @@ jobs: | |
build-x86_64-unknown-linux-gnu: | ||
name: Build - x86_64-unknown-linux-gnu | ||
runs-on: [linux, ubuntu-20.04-4core] | ||
needs: [changes, validate] | ||
if: github.event_name != 'pull_request' || needs.changes.outputs.k8s == 'true' | ||
needs: changes | ||
# Run this job even if `changes` job is skipped (non- pull request trigger) | ||
if: ${{ !failure() && !cancelled() && (github.event_name != 'pull_request' || needs.changes.outputs.k8s == 'true') }} | ||
# cargo-deb requires a release build, but we don't need optimizations for tests | ||
env: | ||
CARGO_PROFILE_RELEASE_OPT_LEVEL: 0 | ||
|
@@ -141,8 +118,9 @@ jobs: | |
compute-k8s-test-plan: | ||
name: Compute K8s test plan | ||
runs-on: ubuntu-latest | ||
needs: [changes, validate] | ||
if: github.event_name != 'pull_request' || needs.changes.outputs.k8s == 'true' | ||
needs: changes | ||
# Run this job even if `changes` job is skipped | ||
if: ${{ !failure() && !cancelled() && (github.event_name != 'pull_request' || needs.changes.outputs.k8s == 'true') }} | ||
outputs: | ||
matrix: ${{ steps.set-matrix.outputs.matrix }} | ||
steps: | ||
|
@@ -195,9 +173,10 @@ jobs: | |
name: K8s ${{ matrix.kubernetes_version.version }} / ${{ matrix.container_runtime }} (${{ matrix.kubernetes_version.role }}) | ||
runs-on: [linux, ubuntu-20.04-4core] | ||
needs: | ||
- validate | ||
- build-x86_64-unknown-linux-gnu | ||
- compute-k8s-test-plan | ||
# because `changes` job might be skipped | ||
if: always() && needs.build-x86_64-unknown-linux-gnu.result == 'success' && needs.compute-k8s-test-plan.result == 'success' | ||
strategy: | ||
matrix: ${{ fromJson(needs.compute-k8s-test-plan.outputs.matrix) }} | ||
fail-fast: false | ||
|
@@ -246,20 +225,18 @@ jobs: | |
final-result: | ||
name: K8s E2E Suite | ||
runs-on: ubuntu-latest | ||
needs: [test-e2e-kubernetes, validate] | ||
if: | | ||
always() && (github.event_name != 'issue_comment' || (github.event.issue.pull_request | ||
&& (contains(github.event.comment.body, '/ci-run-k8s') || contains(github.event.comment.body, '/ci-run-all')))) | ||
needs: test-e2e-kubernetes | ||
if: always() | ||
env: | ||
FAILED: ${{ contains(needs.*.result, 'failure') }} | ||
steps: | ||
- name: (PR comment) Get PR branch | ||
if: success() && github.event_name == 'issue_comment' | ||
if: github.event_name == 'issue_comment' && env.FAILED != 'true' | ||
uses: xt0rted/pull-request-comment-branch@v2 | ||
id: comment-branch | ||
|
||
- name: (PR comment) Submit PR result as success | ||
if: success() && github.event_name == 'issue_comment' | ||
if: github.event_name == 'issue_comment' && env.FAILED != 'true' | ||
uses: myrotvorets/[email protected] | ||
with: | ||
sha: ${{ steps.comment-branch.outputs.head_sha }} | ||
|