Skip to content

Commit b72e84a

Browse files
committed
standardizing approach for required-tests-with-occasional-overrides
Signed-off-by: grokspawn <jordan@nimblewidget.com>
1 parent bcb3d07 commit b72e84a

3 files changed

Lines changed: 29 additions & 19 deletions

File tree

.github/workflows/crd-diff.yaml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,25 @@ 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
1716
run: |
1817
make verify-crd-compatibility \
1918
CRD_DIFF_ORIGINAL_REF="git://${{ github.event.pull_request.base.sha }}?path=" \
2019
CRD_DIFF_UPDATED_REF="git://${{ github.event.pull_request.head.sha }}?path="
20+
- name: Check for override label
21+
if: ${{ failure() && steps.verify-crd-compatibility.outcome == 'failure' }}
22+
run: |
23+
if gh api repos/$OWNER/$REPO/pulls/$PR --jq '.labels.[].name' | grep -q "${OVERRIDE_LABEL}"; then
24+
echo "Found ${OVERRIDE_LABEL} label, overriding failed results."
25+
exit 0
26+
fi
27+
env:
28+
GH_TOKEN: ${{ github.token }}
29+
OWNER: ${{ github.repository_owner }}
30+
REPO: ${{ github.event.repository.name }}
31+
PR: ${{ github.event.pull_request.number }}
32+
OVERRIDE_LABEL: "crd-diff-override"

.github/workflows/go-verdiff.yaml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,26 @@ 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
1819
env:
1920
GH_TOKEN: ${{ github.token }}
2021
OWNER: ${{ github.repository_owner }}
2122
REPO: ${{ github.event.repository.name }}
2223
PR: ${{ github.event.pull_request.number }}
24+
- name: Check for override label
25+
if: ${{ failure() && steps.check-version.outcome == 'failure' }}
26+
run: |
27+
if gh api repos/$OWNER/$REPO/pulls/$PR --jq '.labels.[].name' | grep -q "${OVERRIDE_LABEL}"; then
28+
echo "Found ${OVERRIDE_LABEL} label, overriding failed results."
29+
exit 0
30+
fi
31+
env:
32+
GH_TOKEN: ${{ github.token }}
33+
OWNER: ${{ github.repository_owner }}
34+
REPO: ${{ github.event.repository.name }}
35+
PR: ${{ github.event.pull_request.number }}
36+
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)