|
1 | 1 | # Regression Detection Suite |
2 | 2 | # |
3 | 3 | # This workflow runs under the following conditions: |
4 | | -# - Once per day, based on a schedule |
5 | | -# - On demand, triggered from https://github.com/vectordotdev/vector/actions/workflows/regression_v2.yml |
| 4 | +# - Once per week, based on a schedule |
| 5 | +# - On demand, triggered from https://github.com/vectordotdev/vector/actions/workflows/regression.yml |
| 6 | +# - On demand, via the `/ci-run-regression` (or `/ci-run-all`) PR review comment, |
| 7 | +# which invokes this workflow via `workflow_call` from `ci-review-trigger.yml`. |
6 | 8 | # |
7 | 9 | # The workflow accepts two optional inputs: |
8 | | -# - The baseline SHA: |
| 10 | +# - The baseline ref: |
9 | 11 | # - If not specified, the SHA from 7 days ago on origin/master is used. |
10 | | -# - The comparison SHA: |
| 12 | +# - The comparison ref: |
11 | 13 | # - If not specified, the current HEAD of origin/master is used. |
12 | 14 | # |
| 15 | +# Both inputs accept any git ref that `git rev-parse` can resolve: a full commit |
| 16 | +# SHA, a short SHA, a branch name (e.g. `origin/master`), or a tag. |
| 17 | +# |
13 | 18 | # This workflow runs regression detection experiments, performing relative |
14 | 19 | # evaluations of the baseline SHA and comparison SHA. The exact SHAs are determined |
15 | 20 | # by how the workflow is triggered. |
|
26 | 31 | workflow_dispatch: |
27 | 32 | inputs: |
28 | 33 | baseline-sha: |
29 | | - description: "The SHA to use as the baseline (optional). If not provided, it defaults to the SHA from 7 days ago." |
| 34 | + description: "Baseline git ref (full/short SHA, branch such as `origin/master`, or tag). Defaults to the SHA from 7 days ago." |
| 35 | + required: false |
| 36 | + comparison-sha: |
| 37 | + description: "Comparison git ref (full/short SHA, branch such as `origin/master`, or tag). Defaults to the current HEAD of origin/master." |
| 38 | + required: false |
| 39 | + workflow_call: |
| 40 | + inputs: |
| 41 | + baseline-sha: |
| 42 | + description: "Baseline git ref (full/short SHA, branch such as `origin/master`, or tag). Defaults to the SHA from 7 days ago." |
30 | 43 | required: false |
| 44 | + type: string |
31 | 45 | comparison-sha: |
32 | | - description: "The SHA to use for comparison (optional). If not provided, it defaults to the current HEAD of the origin/master branch." |
| 46 | + description: "Comparison git ref (full/short SHA, branch such as `origin/master`, or tag). Defaults to the current HEAD of origin/master." |
33 | 47 | required: false |
| 48 | + type: string |
34 | 49 | schedule: |
35 | 50 | - cron: "0 7 * * 1" # Runs at 7 AM UTC on Mondays |
36 | 51 |
|
@@ -60,39 +75,32 @@ jobs: |
60 | 75 |
|
61 | 76 | - name: Set and Validate SHAs |
62 | 77 | id: set_and_validate_shas |
| 78 | + env: |
| 79 | + BASELINE_INPUT: ${{ inputs.baseline-sha }} |
| 80 | + COMPARISON_INPUT: ${{ inputs.comparison-sha }} |
63 | 81 | run: | |
64 | | - # Set baseline SHA |
65 | | - if [ -z "${{ github.event.inputs.baseline-sha }}" ]; then |
| 82 | + # Resolve baseline ref to a full commit SHA |
| 83 | + if [ -z "${BASELINE_INPUT}" ]; then |
66 | 84 | BASELINE_SHA=$(git rev-list -n 1 --before="7 days ago" origin/master) |
67 | 85 | echo "Using baseline SHA from 7 days ago: ${BASELINE_SHA}" |
68 | 86 | else |
69 | | - BASELINE_SHA="${{ github.event.inputs.baseline-sha }}" |
70 | | - echo "Using provided baseline SHA: ${BASELINE_SHA}" |
| 87 | + if ! BASELINE_SHA=$(git rev-parse --verify "${BASELINE_INPUT}^{commit}" 2>/dev/null); then |
| 88 | + echo "Invalid baseline ref: '${BASELINE_INPUT}'. Expected a full/short SHA, branch (e.g. origin/master), or tag." |
| 89 | + exit 1 |
| 90 | + fi |
| 91 | + echo "Resolved baseline input '${BASELINE_INPUT}' to SHA: ${BASELINE_SHA}" |
71 | 92 | fi |
72 | 93 |
|
73 | | - # Validate baseline SHA |
74 | | - if [ -n "${BASELINE_SHA}" ] && git cat-file -e "${BASELINE_SHA}^{commit}"; then |
75 | | - echo "Baseline SHA is valid." |
76 | | - else |
77 | | - echo "Invalid baseline SHA: ${BASELINE_SHA}." |
78 | | - exit 1 |
79 | | - fi |
80 | | -
|
81 | | - # Set comparison SHA |
82 | | - if [ -z "${{ github.event.inputs.comparison-sha }}" ]; then |
| 94 | + # Resolve comparison ref to a full commit SHA |
| 95 | + if [ -z "${COMPARISON_INPUT}" ]; then |
83 | 96 | COMPARISON_SHA=$(git rev-parse origin/master) |
84 | | - echo "Using current HEAD for comparison SHA: ${COMPARISON_SHA}" |
| 97 | + echo "Using current HEAD of origin/master as comparison SHA: ${COMPARISON_SHA}" |
85 | 98 | else |
86 | | - COMPARISON_SHA="${{ github.event.inputs.comparison-sha }}" |
87 | | - echo "Using provided comparison SHA: ${COMPARISON_SHA}" |
88 | | - fi |
89 | | -
|
90 | | - # Validate comparison SHA |
91 | | - if [ -n "${COMPARISON_SHA}" ] && git cat-file -e "${COMPARISON_SHA}^{commit}"; then |
92 | | - echo "Comparison SHA is valid." |
93 | | - else |
94 | | - echo "Invalid comparison SHA: ${COMPARISON_SHA}." |
95 | | - exit 1 |
| 99 | + if ! COMPARISON_SHA=$(git rev-parse --verify "${COMPARISON_INPUT}^{commit}" 2>/dev/null); then |
| 100 | + echo "Invalid comparison ref: '${COMPARISON_INPUT}'. Expected a full/short SHA, branch (e.g. origin/master), or tag." |
| 101 | + exit 1 |
| 102 | + fi |
| 103 | + echo "Resolved comparison input '${COMPARISON_INPUT}' to SHA: ${COMPARISON_SHA}" |
96 | 104 | fi |
97 | 105 |
|
98 | 106 | # Set tags and export them |
@@ -192,10 +200,6 @@ jobs: |
192 | 200 | needs: |
193 | 201 | - should-run-gate |
194 | 202 | - resolve-inputs |
195 | | - # Job-level permissions for artifact upload |
196 | | - permissions: |
197 | | - contents: read # Required to checkout code |
198 | | - actions: write # Required to upload artifacts |
199 | 203 | steps: |
200 | 204 | - uses: colpal/actions-clean@36e6ca1abd35efe61cb60f912bd7837f67887c8a # v1.1.1 |
201 | 205 |
|
@@ -235,10 +239,6 @@ jobs: |
235 | 239 | needs: |
236 | 240 | - should-run-gate |
237 | 241 | - resolve-inputs |
238 | | - # Job-level permissions for artifact upload |
239 | | - permissions: |
240 | | - contents: read # Required to checkout code |
241 | | - actions: write # Required to upload artifacts |
242 | 242 | steps: |
243 | 243 | - uses: colpal/actions-clean@36e6ca1abd35efe61cb60f912bd7837f67887c8a # v1.1.1 |
244 | 244 |
|
@@ -392,10 +392,8 @@ jobs: |
392 | 392 | - resolve-inputs |
393 | 393 | - upload-baseline-image-to-ecr |
394 | 394 | - upload-comparison-image-to-ecr |
395 | | - # Job-level permissions for artifact upload |
396 | 395 | permissions: |
397 | 396 | contents: read # Required to checkout code |
398 | | - actions: write # Required to upload artifacts |
399 | 397 | id-token: write # Required for GitHub OIDC token exchange |
400 | 398 | steps: |
401 | 399 | - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
@@ -513,10 +511,8 @@ jobs: |
513 | 511 | - should-run-gate |
514 | 512 | - submit-job |
515 | 513 | - resolve-inputs |
516 | | - # Job-level permissions for artifact upload |
517 | 514 | permissions: |
518 | 515 | contents: read # Required to checkout code |
519 | | - actions: write # Required to upload artifacts |
520 | 516 | id-token: write # Required for GitHub OIDC token exchange |
521 | 517 | steps: |
522 | 518 | - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
|
0 commit comments