Skip to content

Commit 067795e

Browse files
bltgoxberry
andauthored
fix(ci): Introduce trusted/untrusted regression workflow split (#15142)
* Introduce trusted/untrusted regression workflow split This commit splits the regression flow into an untrusted pull_request event triggered flow and a trusted workflow_run event triggered flow. This accomplishes the same basic goal as the existing workflow run excepting that we do not require the PR contributor to have access to project secrets, meaning that dependabot, open-source contributors et al will be able to participate in the regression detector. This commit brings the regression detector up to feature parity with the soak tests. Because of the nature of the workflow_run this PR will not post regression detector results: the workflow_run must be present in `master` branch before it will kick on. I had originally intended to split this work into two PRs but decided against this as landing the `regression_trusted.yml` separately would temporarily double the load on the regression detector, which felt undesirable from a cost control perspective. Signed-off-by: Brian L. Troutwine <[email protected]> * /tmp -> runner.temp, per @goxberry Signed-off-by: Brian L. Troutwine <[email protected]> * regression_trusted: add rest namespace to actions `actions/github-script` made a change in version 5.0.0 adding a `rest` namespace to its `github` namespace, so calls that used to read `github.actions.Something` should now read `github.rest.actions.Something`. Signed-off-by: Geoffrey M. Oxberry <[email protected]> * remove pagination, fix quote bug Signed-off-by: Brian L. Troutwine <[email protected]> * Use @goxberry's comment Signed-off-by: Brian L. Troutwine <[email protected]> Signed-off-by: Brian L. Troutwine <[email protected]> Signed-off-by: Geoffrey M. Oxberry <[email protected]> Co-authored-by: Geoffrey M. Oxberry <[email protected]>
1 parent b8f8b18 commit 067795e

File tree

2 files changed

+568
-225
lines changed

2 files changed

+568
-225
lines changed

.github/workflows/regression.yml

Lines changed: 29 additions & 225 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,6 @@ jobs:
4242
comparison-tag: ${{ steps.comparison.outputs.COMPARISON_TAG }}
4343
baseline: ${{ steps.baseline.outputs.BASELINE }}
4444
baseline-tag: ${{ steps.baseline.outputs.BASELINE_TAG }}
45-
46-
cpus: ${{ steps.system.outputs.CPUS }}
47-
memory: ${{ steps.system.outputs.MEMORY }}
48-
49-
replicas: ${{ steps.experimental-meta.outputs.REPLICAS }}
50-
warmup-seconds: ${{ steps.experimental-meta.outputs.WARMUP_SECONDS }}
51-
total-samples: ${{ steps.experimental-meta.outputs.TOTAL_SAMPLES }}
52-
p-value: ${{ steps.experimental-meta.outputs.P_VALUE }}
53-
smp-version: ${{ steps.experimental-meta.outputs.SMP_CRATE_VERSION }}
5445
steps:
5546
- uses: actions/checkout@v3
5647
with:
@@ -62,27 +53,6 @@ jobs:
6253
run: |
6354
echo "PR_NUMBER=${{ github.event.number }}" >> $GITHUB_OUTPUT
6455
65-
- name: Setup experimental metadata
66-
id: experimental-meta
67-
run: |
68-
export WARMUP_SECONDS="45"
69-
export REPLICAS="10"
70-
export TOTAL_SAMPLES="600"
71-
export P_VALUE="0.1"
72-
export SMP_CRATE_VERSION="0.5.0"
73-
74-
echo "warmup seconds: ${WARMUP_SECONDS}"
75-
echo "replicas: ${REPLICAS}"
76-
echo "total samples: ${TOTAL_SAMPLES}"
77-
echo "regression p-value: ${P_VALUE}"
78-
echo "smp crate version: ${SMP_CRATE_VERSION}"
79-
80-
echo "WARMUP_SECONDS=${WARMUP_SECONDS}" >> $GITHUB_OUTPUT
81-
echo "REPLICAS=${REPLICAS}" >> $GITHUB_OUTPUT
82-
echo "TOTAL_SAMPLES=${TOTAL_SAMPLES}" >> $GITHUB_OUTPUT
83-
echo "P_VALUE=${P_VALUE}" >> $GITHUB_OUTPUT
84-
echo "SMP_CRATE_VERSION=${SMP_CRATE_VERSION}" >> $GITHUB_OUTPUT
85-
8656
- name: Setup baseline variables
8757
id: baseline
8858
run: |
@@ -109,35 +79,6 @@ jobs:
10979
echo "COMPARISON=${COMPARISON_SHA}" >> $GITHUB_OUTPUT
11080
echo "COMPARISON_TAG=${COMPARISON_TAG}" >> $GITHUB_OUTPUT
11181
112-
- name: Setup system details
113-
id: system
114-
run: |
115-
export CPUS="8"
116-
export MEMORY="30g"
117-
118-
echo "cpus total: ${CPUS}"
119-
echo "memory total: ${MEMORY}"
120-
121-
echo "CPUS=${CPUS}" >> $GITHUB_OUTPUT
122-
echo "MEMORY=${MEMORY}" >> $GITHUB_OUTPUT
123-
124-
confirm-valid-credentials:
125-
name: Confirm AWS credentials are minimally valid
126-
runs-on: ubuntu-22.04
127-
needs:
128-
- compute-metadata
129-
steps:
130-
- name: Configure AWS Credentials
131-
uses: aws-actions/configure-aws-credentials@v1-node16
132-
with:
133-
aws-access-key-id: ${{ secrets.SINGLE_MACHINE_PERFORMANCE_BOT_ACCESS_KEY_ID }}
134-
aws-secret-access-key: ${{ secrets.SINGLE_MACHINE_PERFORMANCE_BOT_SECRET_ACCESS_KEY }}
135-
aws-region: us-west-2
136-
137-
- name: Download SMP binary
138-
run: |
139-
aws s3 cp s3://smp-cli-releases/v${{ needs.compute-metadata.outputs.smp-version }}/x86_64-unknown-linux-gnu/smp ${{ runner.temp }}/bin/smp
140-
14182
##
14283
## BUILD
14384
##
@@ -146,7 +87,6 @@ jobs:
14687
name: Build baseline Vector container
14788
runs-on: [linux, soak-builder]
14889
needs:
149-
- confirm-valid-credentials
15090
- compute-metadata
15191
steps:
15292
- uses: colpal/actions-clean@v1
@@ -162,22 +102,6 @@ jobs:
162102
id: buildx
163103
uses: docker/[email protected]
164104

165-
- name: Configure AWS Credentials
166-
uses: aws-actions/configure-aws-credentials@v1-node16
167-
with:
168-
aws-access-key-id: ${{ secrets.SINGLE_MACHINE_PERFORMANCE_BOT_ACCESS_KEY_ID }}
169-
aws-secret-access-key: ${{ secrets.SINGLE_MACHINE_PERFORMANCE_BOT_SECRET_ACCESS_KEY }}
170-
aws-region: us-west-2
171-
172-
- name: Login to Amazon ECR
173-
id: login-ecr
174-
uses: aws-actions/amazon-ecr-login@v1
175-
176-
- name: Docker Login to ECR
177-
uses: docker/login-action@v2
178-
with:
179-
registry: ${{ steps.login-ecr.outputs.registry }}
180-
181105
- name: Build 'vector' target image
182106
uses: docker/build-push-action@v3
183107
with:
@@ -186,15 +110,20 @@ jobs:
186110
cache-to: type=gha,mode=max
187111
file: regression/Dockerfile
188112
builder: ${{ steps.buildx.outputs.name }}
113+
outputs: type=docker,dest=${{ runner.temp }}/baseline-image.tar
189114
tags: |
190-
${{ steps.login-ecr.outputs.registry }}/${{ secrets.SINGLE_MACHINE_PERFORMANCE_TEAM_ID }}-vector:${{ needs.compute-metadata.outputs.pr-number }}-${{ needs.compute-metadata.outputs.baseline-tag }}
191-
push: true
115+
vector:${{ needs.compute-metadata.outputs.pr-number }}-${{ needs.compute-metadata.outputs.baseline-tag }}
116+
117+
- name: Upload image as artifact
118+
uses: actions/upload-artifact@v3
119+
with:
120+
name: baseline-image
121+
path: "${{ runner.temp }}/baseline-image.tar"
192122

193123
build-comparison:
194124
name: Build comparison Vector container
195125
runs-on: [linux, soak-builder]
196126
needs:
197-
- confirm-valid-credentials
198127
- compute-metadata
199128
steps:
200129
- uses: colpal/actions-clean@v1
@@ -210,22 +139,6 @@ jobs:
210139
id: buildx
211140
uses: docker/[email protected]
212141

213-
- name: Configure AWS Credentials
214-
uses: aws-actions/configure-aws-credentials@v1-node16
215-
with:
216-
aws-access-key-id: ${{ secrets.SINGLE_MACHINE_PERFORMANCE_BOT_ACCESS_KEY_ID }}
217-
aws-secret-access-key: ${{ secrets.SINGLE_MACHINE_PERFORMANCE_BOT_SECRET_ACCESS_KEY }}
218-
aws-region: us-west-2
219-
220-
- name: Login to Amazon ECR
221-
id: login-ecr
222-
uses: aws-actions/amazon-ecr-login@v1
223-
224-
- name: Docker Login to ECR
225-
uses: docker/login-action@v2
226-
with:
227-
registry: ${{ steps.login-ecr.outputs.registry }}
228-
229142
- name: Build 'vector' target image
230143
uses: docker/build-push-action@v3
231144
with:
@@ -234,144 +147,35 @@ jobs:
234147
cache-to: type=gha,mode=max
235148
file: regression/Dockerfile
236149
builder: ${{ steps.buildx.outputs.name }}
150+
outputs: type=docker,dest=${{ runner.temp }}/comparison-image.tar
237151
tags: |
238-
${{ steps.login-ecr.outputs.registry }}/${{ secrets.SINGLE_MACHINE_PERFORMANCE_TEAM_ID }}-vector:${{ needs.compute-metadata.outputs.pr-number }}-${{ needs.compute-metadata.outputs.comparison-tag }}
239-
push: true
240-
241-
##
242-
## SUBMIT
243-
##
244-
245-
submit-job:
246-
name: Submit regression job
247-
runs-on: ubuntu-22.04
248-
needs:
249-
- compute-metadata
250-
- build-baseline
251-
- build-comparison
252-
steps:
253-
- uses: actions/checkout@v3
254-
255-
- name: Configure AWS Credentials
256-
uses: aws-actions/configure-aws-credentials@v1-node16
257-
with:
258-
aws-access-key-id: ${{ secrets.SINGLE_MACHINE_PERFORMANCE_BOT_ACCESS_KEY_ID }}
259-
aws-secret-access-key: ${{ secrets.SINGLE_MACHINE_PERFORMANCE_BOT_SECRET_ACCESS_KEY }}
260-
aws-region: us-west-2
261-
262-
- name: Login to Amazon ECR
263-
id: login-ecr
264-
uses: aws-actions/amazon-ecr-login@v1
265-
266-
- name: Download SMP binary
267-
run: |
268-
aws s3 cp s3://smp-cli-releases/v${{ needs.compute-metadata.outputs.smp-version }}/x86_64-unknown-linux-gnu/smp ${{ runner.temp }}/bin/smp
152+
vector:${{ needs.compute-metadata.outputs.pr-number }}-${{ needs.compute-metadata.outputs.comparison-tag }}
269153
270-
- name: Submit job
271-
env:
272-
RUST_LOG: debug
273-
run: |
274-
chmod +x ${{ runner.temp }}/bin/smp
275-
276-
${{ runner.temp }}/bin/smp --team-id ${{ secrets.SINGLE_MACHINE_PERFORMANCE_TEAM_ID }} job submit \
277-
--total-samples ${{ needs.compute-metadata.outputs.total-samples }} \
278-
--warmup-seconds ${{ needs.compute-metadata.outputs.warmup-seconds }} \
279-
--replicas ${{ needs.compute-metadata.outputs.replicas }} \
280-
--baseline-image ${{ steps.login-ecr.outputs.registry }}/${{ secrets.SINGLE_MACHINE_PERFORMANCE_TEAM_ID }}-vector:${{ needs.compute-metadata.outputs.pr-number }}-${{ needs.compute-metadata.outputs.baseline-tag }} \
281-
--comparison-image ${{ steps.login-ecr.outputs.registry }}/${{ secrets.SINGLE_MACHINE_PERFORMANCE_TEAM_ID }}-vector:${{ needs.compute-metadata.outputs.pr-number }}-${{ needs.compute-metadata.outputs.comparison-tag }} \
282-
--baseline-sha ${{ needs.compute-metadata.outputs.baseline }} \
283-
--comparison-sha ${{ needs.compute-metadata.outputs.comparison }} \
284-
--target-config-dir ${{ github.workspace }}/regression/ \
285-
--target-name vector \
286-
--submission-metadata ${{ runner.temp }}/submission-metadata
287-
288-
- uses: actions/upload-artifact@v3
154+
- name: Upload image as artifact
155+
uses: actions/upload-artifact@v3
289156
with:
290-
name: vector-submission-metadata
291-
path: ${{ runner.temp }}/submission-metadata
292-
293-
- name: Await job
294-
timeout-minutes: 60
295-
env:
296-
RUST_LOG: info
297-
run: |
298-
chmod +x ${{ runner.temp }}/bin/smp
299-
300-
${{ runner.temp }}/bin/smp --team-id ${{ secrets.SINGLE_MACHINE_PERFORMANCE_TEAM_ID }} job status \
301-
--wait \
302-
--wait-delay-seconds 60 \
303-
--submission-metadata ${{ runner.temp }}/submission-metadata
304-
305-
- name: Handle cancellation if necessary
306-
if: ${{ cancelled() }}
307-
timeout-minutes: 60
308-
env:
309-
RUST_LOG: info
310-
run: |
311-
chmod +x ${{ runner.temp }}/bin/smp
312-
${{ runner.temp }}/bin/smp --team-id ${{ secrets.SINGLE_MACHINE_PERFORMANCE_TEAM_ID }} job cancel --submission-metadata ${{ runner.temp }}/submission-metadata
157+
name: comparison-image
158+
path: "${{ runner.temp }}/comparison-image.tar"
313159

314-
##
315-
## ANALYZE
316-
##
317-
318-
## NOTE intentionally left as an example. The SMP capture files are quite
319-
## large, 1.5Gb. In the future we won't sync capture files at all, doing
320-
## analysis in the background and shipping the analysis. That said, at this
321-
## stage, it's still useful to know that you can sync if you want.
322-
323-
download-analysis:
324-
name: Download regression analysis & upload report
160+
transmit-metadata:
161+
name: Transmit metadata to trusted workflow
325162
runs-on: ubuntu-22.04
326163
needs:
327-
- submit-job
328164
- compute-metadata
329165
steps:
330-
- uses: actions/checkout@v3
331-
332-
- name: Configure AWS Credentials
333-
uses: aws-actions/configure-aws-credentials@v1-node16
334-
with:
335-
aws-access-key-id: ${{ secrets.SINGLE_MACHINE_PERFORMANCE_BOT_ACCESS_KEY_ID }}
336-
aws-secret-access-key: ${{ secrets.SINGLE_MACHINE_PERFORMANCE_BOT_SECRET_ACCESS_KEY }}
337-
aws-region: us-west-2
338-
339-
- name: Download SMP binary
340-
run: |
341-
aws s3 cp s3://smp-cli-releases/v${{ needs.compute-metadata.outputs.smp-version }}/x86_64-unknown-linux-gnu/smp ${{ runner.temp }}/bin/smp
342-
343-
- name: Download submission metadata
344-
uses: actions/download-artifact@v3
345-
with:
346-
name: vector-submission-metadata
347-
path: ${{ runner.temp }}/
348-
349-
- name: Sync regression report to local system
350-
env:
351-
RUST_LOG: info
166+
- name: Write out metadata
352167
run: |
353-
chmod +x ${{ runner.temp }}/bin/smp
354-
355-
${{ runner.temp }}/bin/smp --team-id ${{ secrets.SINGLE_MACHINE_PERFORMANCE_TEAM_ID }} job sync \
356-
--submission-metadata ${{ runner.temp }}/submission-metadata \
357-
--output-path "${{ runner.temp }}/outputs"
358-
359-
- name: Read regression report
360-
id: read-analysis
361-
uses: juliangruber/read-file-action@v1
362-
with:
363-
path: ${{ runner.temp }}/outputs/report.html
364-
365-
- name: Post report to PR
366-
uses: peter-evans/create-or-update-comment@v2
367-
if: ${{ github.actor != 'dependabot[bot]' }}
368-
with:
369-
issue-number: ${{ github.event.number }}
370-
edit-mode: append
371-
body: ${{ steps.read-analysis.outputs.content }}
372-
373-
- name: Upload regression report to artifacts
168+
echo "COMPARISON_TAG=${{ needs.compute-metadata.outputs.pr-number }}-${{ needs.compute-metadata.outputs.comparison-tag }}" > ${{ runner.temp }}/meta
169+
echo "COMPARISON_SHA=${{ needs.compute-metadata.outputs.comparison }}" >> ${{ runner.temp }}/meta
170+
echo "BASELINE_TAG=${{ needs.compute-metadata.outputs.pr-number }}-${{ needs.compute-metadata.outputs.baseline-tag }}" >> ${{ runner.temp }}/meta
171+
echo "BASELINE_SHA=${{ needs.compute-metadata.outputs.baseline }}" >> ${{ runner.temp }}/meta
172+
echo "CHECKOUT_SHA=${{ github.sha }}" >> ${{ runner.temp }}/meta
173+
echo "HEAD_SHA=${{ github.event.pull_request.head.sha }}" >> ${{ runner.temp }}/meta
174+
echo "BASE_SHA=${{ github.event.pull_request.base.sha }}" >> ${{ runner.temp }}/meta
175+
echo "GITHUB_EVENT_NUMBER=${{ github.event.number }}" >> ${{ runner.temp }}/meta
176+
177+
- name: Upload metadata
374178
uses: actions/upload-artifact@v3
375179
with:
376-
name: capture-artifacts
377-
path: ${{ runner.temp }}/outputs/*
180+
name: meta
181+
path: "${{ runner.temp }}/meta"

0 commit comments

Comments
 (0)