Skip to content

Commit 8b2447a

Browse files
authored
fix(ci): address issues in integration test suite workflow (vectordotdev#17928)
- Author membership using the get-user-teams-membership doesn't work for contributor PRs because the GHA requires a GH token with proper scopes, which they don't have. Fix=check if secrets are defined in the environment. - This and a couple other workflows had a logic bug in that they could be added to the merge queue if the main dep job were skipped (i.e due to a bug in the workflow).
1 parent 22b6c2b commit 8b2447a

File tree

3 files changed

+26
-25
lines changed

3 files changed

+26
-25
lines changed

.github/workflows/integration.yml

+20-23
Original file line numberDiff line numberDiff line change
@@ -46,25 +46,10 @@ jobs:
4646
int_tests: true
4747
secrets: inherit
4848

49-
detect-user:
50-
name: Detect user team membership
51-
runs-on: ubuntu-latest
52-
outputs:
53-
IS_TEAM_MEMBER: ${{ steps.author.outputs.isTeamMember }}
54-
steps:
55-
- name: Get PR author
56-
if: github.event_name == 'pull_request'
57-
id: author
58-
uses: tspascoal/get-user-teams-membership@v2
59-
with:
60-
username: ${{ github.actor }}
61-
team: 'Vector'
62-
GITHUB_TOKEN: ${{ secrets.GH_PAT_ORG }}
63-
6449
integration-tests:
6550
name: Integration Tests
6651
runs-on: [linux, ubuntu-20.04-4core]
67-
needs: [changes, detect-user]
52+
needs: changes
6853
if: always() && (
6954
github.event_name == 'merge_group' || (
7055
needs.changes.outputs.all-int == 'true'
@@ -110,6 +95,17 @@ jobs:
11095

11196
- run: docker image prune -af ; docker container prune -f
11297

98+
- name: Determine if secrets are defined (PR author is team member).
99+
if: github.event_name == 'pull_request'
100+
env:
101+
GH_PAT_ORG: ${{ secrets.GH_PAT_ORG }}
102+
run: |
103+
if [[ "$GH_PAT_ORG" != "" ]] ; then
104+
echo "PR_HAS_ACCESS_TO_SECRETS=true" >> "$GITHUB_ENV"
105+
else
106+
echo "PR_HAS_ACCESS_TO_SECRETS=false" >> "$GITHUB_ENV"
107+
fi
108+
113109
- if: ${{ github.event_name == 'merge_group' || needs.changes.outputs.all-int == 'true' || needs.changes.outputs.amqp == 'true' }}
114110
name: amqp
115111
uses: nick-fields/retry@v2
@@ -119,7 +115,7 @@ jobs:
119115
command: bash scripts/ci-integration-test.sh amqp
120116

121117
- if: (github.event_name == 'merge_group' || needs.changes.outputs.all-int == 'true' || needs.changes.outputs.appsignal == 'true') &&
122-
(github.event_name != 'pull_request' || needs.detect-user.outputs.IS_TEAM_MEMBER == 'true')
118+
(github.event_name != 'pull_request' || env.PR_HAS_ACCESS_TO_SECRETS == 'true')
123119
name: appsignal
124120
uses: nick-fields/retry@v2
125121
with:
@@ -136,7 +132,7 @@ jobs:
136132
command: bash scripts/ci-integration-test.sh aws
137133

138134
- if: (github.event_name == 'merge_group' || needs.changes.outputs.all-int == 'true' || needs.changes.outputs.axiom == 'true') &&
139-
(github.event_name != 'pull_request' || needs.detect-user.outputs.IS_TEAM_MEMBER == 'true')
135+
(github.event_name != 'pull_request' || env.PR_HAS_ACCESS_TO_SECRETS == 'true')
140136
name: axiom
141137
uses: nick-fields/retry@v2
142138
with:
@@ -161,7 +157,7 @@ jobs:
161157
command: bash scripts/ci-integration-test.sh clickhouse
162158

163159
- if: (github.event_name == 'merge_group' || needs.changes.outputs.all-int == 'true' || needs.changes.outputs.databend == 'true') &&
164-
(github.event_name != 'pull_request' || needs.detect-user.outputs.IS_TEAM_MEMBER == 'true')
160+
(github.event_name != 'pull_request' || env.PR_HAS_ACCESS_TO_SECRETS == 'true')
165161
name: databend
166162
uses: nick-fields/retry@v2
167163
with:
@@ -170,7 +166,7 @@ jobs:
170166
command: bash scripts/ci-integration-test.sh databend
171167

172168
- if: (github.event_name == 'merge_group' || needs.changes.outputs.all-int == 'true' || needs.changes.outputs.datadog == 'true') &&
173-
(github.event_name != 'pull_request' || needs.detect-user.outputs.IS_TEAM_MEMBER == 'true')
169+
(github.event_name != 'pull_request' || env.PR_HAS_ACCESS_TO_SECRETS == 'true')
174170
name: datadog-agent
175171
uses: nick-fields/retry@v2
176172
with:
@@ -179,7 +175,7 @@ jobs:
179175
command: bash scripts/ci-integration-test.sh datadog-agent
180176

181177
- if: (github.event_name == 'merge_group' || needs.changes.outputs.all-int == 'true' || needs.changes.outputs.datadog == 'true') &&
182-
(github.event_name != 'pull_request' || needs.detect-user.outputs.IS_TEAM_MEMBER == 'true')
178+
(github.event_name != 'pull_request' || env.PR_HAS_ACCESS_TO_SECRETS == 'true')
183179
name: datadog-logs
184180
uses: nick-fields/retry@v2
185181
with:
@@ -188,7 +184,7 @@ jobs:
188184
command: bash scripts/ci-integration-test.sh datadog-logs
189185

190186
- if: (github.event_name == 'merge_group' || needs.changes.outputs.all-int == 'true' || needs.changes.outputs.datadog == 'true') &&
191-
(github.event_name != 'pull_request' || needs.detect-user.outputs.IS_TEAM_MEMBER == 'true')
187+
(github.event_name != 'pull_request' || env.PR_HAS_ACCESS_TO_SECRETS == 'true')
192188
name: datadog-metrics
193189
uses: nick-fields/retry@v2
194190
with:
@@ -197,7 +193,7 @@ jobs:
197193
command: bash scripts/ci-integration-test.sh datadog-metrics
198194

199195
- if: (github.event_name == 'merge_group' || needs.changes.outputs.all-int == 'true' || needs.changes.outputs.datadog == 'true') &&
200-
(github.event_name != 'pull_request' || needs.detect-user.outputs.IS_TEAM_MEMBER == 'true')
196+
(github.event_name != 'pull_request' || env.PR_HAS_ACCESS_TO_SECRETS == 'true')
201197
name: datadog-traces
202198
uses: nick-fields/retry@v2
203199
with:
@@ -398,6 +394,7 @@ jobs:
398394
runs-on: ubuntu-latest
399395
if: always()
400396
needs:
397+
- changes
401398
- integration-tests
402399
env:
403400
FAILED: ${{ contains(needs.*.result, 'failure') }}

.github/workflows/k8s_e2e.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,11 @@ jobs:
225225
final-result:
226226
name: K8s E2E Suite
227227
runs-on: ubuntu-latest
228-
needs: test-e2e-kubernetes
228+
needs:
229+
- changes
230+
- build-x86_64-unknown-linux-gnu
231+
- compute-k8s-test-plan
232+
- test-e2e-kubernetes
229233
if: always()
230234
env:
231235
FAILED: ${{ contains(needs.*.result, 'failure') }}

.github/workflows/test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ jobs:
127127
name: Test Suite
128128
runs-on: ubuntu-20.04
129129
if: always()
130-
needs: checks
130+
needs: [changes, checks]
131131
env:
132132
FAILED: ${{ contains(needs.*.result, 'failure') }}
133133
steps:

0 commit comments

Comments
 (0)