forked from vectordotdev/vector
-
Notifications
You must be signed in to change notification settings - Fork 0
181 lines (154 loc) · 6.33 KB
/
regression.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
# Regression Detection
#
# This workflow runs our regression detection experiments, which are relative
# evaluations of the base SHA for the PR to whatever SHA was just pushed into
# the project (unless that SHA happens to be master branch HEAD). The goal is to
# give quick-ish feedback on all-up Vector for a variety of configs as to
# whether throughput performance has gone down, gotten more variable in the
# pushed SHA.
#
# Regression detection is always done relative to the pushed SHA, meaning any
# changes you introduce to the experiment will be picked up both for the base
# SHA variant and your current SHA. Tags are SHA-SHA. The first SHA is the one
# that triggered this workflow, the second is the one of the Vector being
# tested. For comparison images the two SHAs are identical.
name: Regression Detector
on:
pull_request:
paths-ignore:
- "docs/**"
- "rfcs/**"
- "website/**"
jobs:
cancel-previous:
runs-on: ubuntu-22.04
timeout-minutes: 3
steps:
- uses: styfle/[email protected]
with:
access_token: ${{ secrets.GITHUB_TOKEN }}
all_but_latest: true # can cancel workflows scheduled later
compute-metadata:
name: Compute metadata for regression experiments
runs-on: ubuntu-22.04
outputs:
pr-number: ${{ steps.pr-metadata.outputs.PR_NUMBER }}
comparison-sha: ${{ steps.comparison.outputs.COMPARISON }}
comparison-tag: ${{ steps.comparison.outputs.COMPARISON_TAG }}
baseline-sha: ${{ steps.baseline.outputs.BASELINE }}
baseline-tag: ${{ steps.baseline.outputs.BASELINE_TAG }}
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.base_ref }}
path: baseline-vector
- name: Setup PR metadata
id: pr-metadata
run: |
echo "PR_NUMBER=${{ github.event.number }}" >> $GITHUB_OUTPUT
- name: Setup baseline variables
id: baseline
run: |
pushd baseline-vector
export BASELINE_SHA=$(git rev-parse HEAD)
popd
export BASELINE_TAG="${{ github.event.pull_request.head.sha }}-${BASELINE_SHA}"
echo "baseline sha is: ${BASELINE_SHA}"
echo "baseline tag is: ${BASELINE_TAG}"
echo "BASELINE=${BASELINE_SHA}" >> $GITHUB_OUTPUT
echo "BASELINE_TAG=${BASELINE_TAG}" >> $GITHUB_OUTPUT
- name: Setup comparison variables
id: comparison
run: |
export COMPARISON_SHA=${{ github.event.pull_request.head.sha }}
export COMPARISON_TAG="${{ github.event.pull_request.head.sha }}-${{ github.event.pull_request.head.sha }}"
echo "comparison sha is: ${COMPARISON_SHA}"
echo "comparison tag is: ${COMPARISON_TAG}"
echo "COMPARISON=${COMPARISON_SHA}" >> $GITHUB_OUTPUT
echo "COMPARISON_TAG=${COMPARISON_TAG}" >> $GITHUB_OUTPUT
##
## BUILD
##
build-baseline:
name: Build baseline Vector container
runs-on: [linux, soak-builder]
needs:
- compute-metadata
steps:
- uses: colpal/actions-clean@v1
- uses: actions/checkout@v3
- uses: actions/checkout@v3
with:
ref: ${{ needs.compute-metadata.outputs.baseline-sha }}
path: baseline-vector
- name: Set up Docker Buildx
id: buildx
uses: docker/[email protected]
- name: Build 'vector' target image
uses: docker/build-push-action@v3
with:
context: baseline-vector/
cache-from: type=gha
cache-to: type=gha,mode=max
file: regression/Dockerfile
builder: ${{ steps.buildx.outputs.name }}
outputs: type=docker,dest=${{ runner.temp }}/baseline-image.tar
tags: |
vector:${{ needs.compute-metadata.outputs.pr-number }}-${{ needs.compute-metadata.outputs.baseline-tag }}
- name: Upload image as artifact
uses: actions/upload-artifact@v3
with:
name: baseline-image
path: "${{ runner.temp }}/baseline-image.tar"
build-comparison:
name: Build comparison Vector container
runs-on: [linux, soak-builder]
needs:
- compute-metadata
steps:
- uses: colpal/actions-clean@v1
- uses: actions/checkout@v3
- uses: actions/checkout@v3
with:
ref: ${{ needs.compute-metadata.outputs.comparison-sha }}
path: comparison-vector
- name: Set up Docker Buildx
id: buildx
uses: docker/[email protected]
- name: Build 'vector' target image
uses: docker/build-push-action@v3
with:
context: comparison-vector/
cache-from: type=gha
cache-to: type=gha,mode=max
file: regression/Dockerfile
builder: ${{ steps.buildx.outputs.name }}
outputs: type=docker,dest=${{ runner.temp }}/comparison-image.tar
tags: |
vector:${{ needs.compute-metadata.outputs.pr-number }}-${{ needs.compute-metadata.outputs.comparison-tag }}
- name: Upload image as artifact
uses: actions/upload-artifact@v3
with:
name: comparison-image
path: "${{ runner.temp }}/comparison-image.tar"
transmit-metadata:
name: Transmit metadata to trusted workflow
runs-on: ubuntu-22.04
needs:
- compute-metadata
steps:
- name: Write out metadata
run: |
echo "COMPARISON_TAG=${{ needs.compute-metadata.outputs.pr-number }}-${{ needs.compute-metadata.outputs.comparison-tag }}" > ${{ runner.temp }}/meta
echo "COMPARISON_SHA=${{ needs.compute-metadata.outputs.comparison-sha }}" >> ${{ runner.temp }}/meta
echo "BASELINE_TAG=${{ needs.compute-metadata.outputs.pr-number }}-${{ needs.compute-metadata.outputs.baseline-tag }}" >> ${{ runner.temp }}/meta
echo "BASELINE_SHA=${{ needs.compute-metadata.outputs.baseline-sha }}" >> ${{ runner.temp }}/meta
echo "CHECKOUT_SHA=${{ github.sha }}" >> ${{ runner.temp }}/meta
echo "HEAD_SHA=${{ github.event.pull_request.head.sha }}" >> ${{ runner.temp }}/meta
echo "BASE_SHA=${{ github.event.pull_request.base.sha }}" >> ${{ runner.temp }}/meta
echo "GITHUB_EVENT_NUMBER=${{ github.event.number }}" >> ${{ runner.temp }}/meta
- name: Upload metadata
uses: actions/upload-artifact@v3
with:
name: meta
path: "${{ runner.temp }}/meta"