-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(ci): correctly validate comment author in k8s e2e job (#17818)
- Loading branch information
1 parent
812929b
commit b8e3dbe
Showing
1 changed file
with
28 additions
and
29 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,9 +42,31 @@ 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: | ||
if: 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: validate | ||
uses: ./.github/workflows/changes.yml | ||
with: | ||
base_ref: ${{ github.event.pull_request.base.ref }} | ||
|
@@ -54,22 +76,14 @@ jobs: | |
build-x86_64-unknown-linux-gnu: | ||
name: Build - x86_64-unknown-linux-gnu | ||
runs-on: [linux, ubuntu-20.04-4core] | ||
needs: changes | ||
needs: [changes, validate] | ||
if: 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 | ||
CARGO_PROFILE_RELEASE_CODEGEN_UNITS: 256 | ||
CARGO_INCREMENTAL: 0 | ||
steps: | ||
- name: Validate issue comment | ||
if: github.event_name == 'issue_comment' | ||
uses: tspascoal/get-user-teams-membership@v2 | ||
with: | ||
username: ${{ github.actor }} | ||
team: 'Vector' | ||
GITHUB_TOKEN: ${{ secrets.GH_PAT_ORG }} | ||
|
||
- name: (PR comment) Get PR branch | ||
if: ${{ github.event_name == 'issue_comment' }} | ||
uses: xt0rted/pull-request-comment-branch@v2 | ||
|
@@ -127,19 +141,11 @@ jobs: | |
compute-k8s-test-plan: | ||
name: Compute K8s test plan | ||
runs-on: ubuntu-latest | ||
needs: changes | ||
needs: [changes, validate] | ||
if: github.event_name != 'pull_request' || needs.changes.outputs.k8s == 'true' | ||
outputs: | ||
matrix: ${{ steps.set-matrix.outputs.matrix }} | ||
steps: | ||
- name: Validate issue comment | ||
if: github.event_name == 'issue_comment' | ||
uses: tspascoal/get-user-teams-membership@v2 | ||
with: | ||
username: ${{ github.actor }} | ||
team: 'Vector' | ||
GITHUB_TOKEN: ${{ secrets.GH_PAT_ORG }} | ||
|
||
- uses: actions/[email protected] | ||
id: set-matrix | ||
with: | ||
|
@@ -189,6 +195,7 @@ 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 | ||
strategy: | ||
|
@@ -239,21 +246,13 @@ jobs: | |
final-result: | ||
name: K8s E2E Suite | ||
runs-on: ubuntu-latest | ||
needs: test-e2e-kubernetes | ||
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')))) | ||
env: | ||
FAILED: ${{ contains(needs.*.result, 'failure') }} | ||
steps: | ||
- name: Validate issue comment | ||
if: github.event_name == 'issue_comment' | ||
uses: tspascoal/get-user-teams-membership@v2 | ||
with: | ||
username: ${{ github.actor }} | ||
team: 'Vector' | ||
GITHUB_TOKEN: ${{ secrets.GH_PAT_ORG }} | ||
|
||
- name: (PR comment) Get PR branch | ||
if: success() && github.event_name == 'issue_comment' | ||
uses: xt0rted/pull-request-comment-branch@v2 | ||
|