Skip to content

Commit 208d638

Browse files
committed
standardizing approach for required-tests-with-occasional-overrides
Signed-off-by: grokspawn <[email protected]>
1 parent bcb3d07 commit 208d638

File tree

3 files changed

+25
-19
lines changed

3 files changed

+25
-19
lines changed

.github/workflows/crd-diff.yaml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,26 @@ jobs:
88
- uses: actions/checkout@v6
99
with:
1010
fetch-depth: 0
11-
1211
- uses: actions/setup-go@v6
1312
with:
1413
go-version-file: go.mod
15-
1614
- name: Run make verify-crd-compatibility
15+
id: verify-crd-compatibility
16+
continue-on-error: true
1717
run: |
1818
make verify-crd-compatibility \
1919
CRD_DIFF_ORIGINAL_REF="git://${{ github.event.pull_request.base.sha }}?path=" \
2020
CRD_DIFF_UPDATED_REF="git://${{ github.event.pull_request.head.sha }}?path="
21+
- name: Check for override label
22+
if: ${{ failure() && steps.verify-crd-compatibility.outcome == 'failure' }}
23+
run: |
24+
if gh api repos/$OWNER/$REPO/pulls/$PR --jq '.labels.[].name' | grep -q "${OVERRIDE_LABEL}"; then
25+
echo "Found ${OVERRIDE_LABEL} label, overriding failed results."
26+
exit 0
27+
fi
28+
env:
29+
GH_TOKEN: ${{ github.token }}
30+
OWNER: ${{ github.repository_owner }}
31+
REPO: ${{ github.event.repository.name }}
32+
PR: ${{ github.event.pull_request.number }}
33+
OVERRIDE_LABEL: "crd-diff-override"

.github/workflows/go-verdiff.yaml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,21 @@ jobs:
1111
with:
1212
fetch-depth: 0
1313
- name: Check golang version
14+
id: check-version
15+
continue-on-error: true
1416
run: |
15-
export LABELS="$(gh api repos/$OWNER/$REPO/pulls/$PR --jq '.labels.[].name')"
1617
hack/tools/check-go-version.sh -b "${{ github.event.pull_request.base.sha }}"
1718
shell: bash
19+
- name: Check for override label
20+
if: ${{ failure() && steps.check-version.outcome == 'failure' }}
21+
run: |
22+
if gh api repos/$OWNER/$REPO/pulls/$PR --jq '.labels.[].name' | grep -q "${OVERRIDE_LABEL}"; then
23+
echo "Found ${OVERRIDE_LABEL} label, overriding failed results."
24+
exit 0
25+
fi
1826
env:
1927
GH_TOKEN: ${{ github.token }}
2028
OWNER: ${{ github.repository_owner }}
2129
REPO: ${{ github.event.repository.name }}
2230
PR: ${{ github.event.pull_request.number }}
31+
OVERRIDE_LABEL: "go-verdiff-override"

hack/tools/check-go-version.sh

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ fi
4646
GO_MAJOR=${MAX_VER[0]}
4747
GO_MINOR=${MAX_VER[1]}
4848
GO_PATCH=${MAX_VER[2]}
49-
OVERRIDE_LABEL="override-go-verdiff"
5049

5150
RETCODE=0
5251

@@ -118,19 +117,4 @@ for f in $(find . -name "*.mod"); do
118117
fi
119118
done
120119

121-
for l in ${LABELS}; do
122-
if [ "$l" == "${OVERRIDE_LABEL}" ]; then
123-
if [ ${RETCODE} -eq 1 ]; then
124-
echo ""
125-
echo "Found ${OVERRIDE_LABEL} label, overriding failed results."
126-
RETCODE=0
127-
fi
128-
fi
129-
done
130-
131-
if [ ${RETCODE} -eq 1 ]; then
132-
echo ""
133-
echo "This test result may be overridden by applying the (${OVERRIDE_LABEL}) label to this PR and re-running the CI job."
134-
fi
135-
136120
exit ${RETCODE}

0 commit comments

Comments
 (0)