Skip to content

Commit 6ffa565

Browse files
committed
RHOAIENG-58789: trust bots, lgtm/approved, scope xKS triggers
author_association misreports opendatahub-io members with private org visibility, so maintainers were having to re-add run-xks-e2e after every commit even for people who are actually trusted. Until a reliable org membership check is in place, accept the label as long as it is present on the PR instead of only on the labeled event. Bot-authored PRs (odh-release-bot, jira-autofix, dependabot) hit the same gap: author_association reports CONTRIBUTOR for them regardless of the app's actual permissions, confirmed on opendatahub-io#3768, opendatahub-io#3760, and opendatahub-io#3756. Trust those exact logins the same way trusted human associations are trusted. lgtm and approved are trusted too, but only at the exact labeled event, not whenever present. Prow strips lgtm from a PR on every new commit by default in this repo (no sticky_lgtm_team or store_tree_hash configured), so a malicious synchronize commit never carries the labeled action either label needs, even if Prow hasn't removed the stale lgtm yet. approved isn't auto-revoked on push, but that doesn't matter here since the check never inspects current label state, only the labeling event itself. Given that author_association gap, running the ODH xKS workflow on every PR relied too much on a trust signal that fails for most of the org. This workflow only exercises the kserve component on a Cloud Manager- provisioned cluster (make e2e-test-xks sets E2E_TEST_COMPONENT=kserve), so scope its trigger to kserve, cloudmanager, and config/rhaii paths (the manifests make deploy-rhaii-local deploys for this test) instead of running on every PR. The cloudmanager workflow already has its own path filter and keeps the label-and-authorization gate as its primary check, since that is where the actual secret risk is.
1 parent 7cbf50d commit 6ffa565

2 files changed

Lines changed: 45 additions & 2 deletions

File tree

.github/workflows/test-cloudmanager-e2e.yaml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,27 @@ jobs:
4242
- name: Check authorization
4343
env:
4444
AUTHOR_ASSOCIATION: ${{ github.event.pull_request.author_association }}
45+
AUTHOR_LOGIN: ${{ github.event.pull_request.user.login }}
4546
EVENT_ACTION: ${{ github.event.action }}
4647
LABEL_NAME: ${{ github.event.label.name }}
48+
HAS_LABEL: ${{ contains(github.event.pull_request.labels.*.name, 'run-xks-e2e') }}
4749
run: |
50+
TRUSTED_BOTS=("odh-release-bot[bot]" "jira-autofix[bot]" "dependabot[bot]")
4851
if [[ "$AUTHOR_ASSOCIATION" =~ ^(OWNER|MEMBER|COLLABORATOR)$ ]]; then
4952
echo "Trusted contributor — running automatically"
5053
exit 0
5154
fi
52-
if [[ "$EVENT_ACTION" == "labeled" && "$LABEL_NAME" == "run-xks-e2e" ]]; then
55+
for bot in "${TRUSTED_BOTS[@]}"; do
56+
if [[ "$AUTHOR_LOGIN" == "$bot" ]]; then
57+
echo "Trusted bot — running automatically"
58+
exit 0
59+
fi
60+
done
61+
if [[ "$EVENT_ACTION" == "labeled" && ( "$LABEL_NAME" == "lgtm" || "$LABEL_NAME" == "approved" ) ]]; then
62+
echo "Reviewer approval ($LABEL_NAME) — running automatically"
63+
exit 0
64+
fi
65+
if [[ "$HAS_LABEL" == "true" ]]; then
5366
echo "External contributor — approved via label"
5467
exit 0
5568
fi

.github/workflows/test-kind-odh-e2e.yaml

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,23 @@ on:
55
types: [opened, labeled, synchronize, reopened]
66
branches:
77
- main
8+
paths:
9+
- 'api/components/v1alpha1/kserve_types.go'
10+
- 'internal/controller/components/kserve/**'
11+
- 'config/rbac/components_kserve_editor_role.yaml'
12+
- 'config/rbac/components_kserve_viewer_role.yaml'
13+
- 'tests/e2e/kserve_test.go'
14+
- 'cmd/cloudmanager/**'
15+
- 'internal/controller/cloudmanager/**'
16+
- 'config/cloudmanager/**'
17+
- 'api/cloudmanager/**'
18+
- 'tests/e2e/cloudmanager/**'
19+
- 'pkg/controller/cloudmanager/**'
20+
- 'pkg/operatorconfig/cloudmanager.go'
21+
- 'pkg/utils/test/cloudmanager/**'
22+
- 'config/rhaii/**'
23+
- 'get_all_manifests.sh'
24+
- '.github/workflows/test-kind-odh-e2e.yaml'
825

926
permissions:
1027
contents: read
@@ -29,14 +46,27 @@ jobs:
2946
- name: Check authorization
3047
env:
3148
AUTHOR_ASSOCIATION: ${{ github.event.pull_request.author_association }}
49+
AUTHOR_LOGIN: ${{ github.event.pull_request.user.login }}
3250
EVENT_ACTION: ${{ github.event.action }}
3351
LABEL_NAME: ${{ github.event.label.name }}
52+
HAS_LABEL: ${{ contains(github.event.pull_request.labels.*.name, 'run-xks-e2e') }}
3453
run: |
54+
TRUSTED_BOTS=("odh-release-bot[bot]" "jira-autofix[bot]" "dependabot[bot]")
3555
if [[ "$AUTHOR_ASSOCIATION" =~ ^(OWNER|MEMBER|COLLABORATOR)$ ]]; then
3656
echo "Trusted contributor — running automatically"
3757
exit 0
3858
fi
39-
if [[ "$EVENT_ACTION" == "labeled" && "$LABEL_NAME" == "run-xks-e2e" ]]; then
59+
for bot in "${TRUSTED_BOTS[@]}"; do
60+
if [[ "$AUTHOR_LOGIN" == "$bot" ]]; then
61+
echo "Trusted bot — running automatically"
62+
exit 0
63+
fi
64+
done
65+
if [[ "$EVENT_ACTION" == "labeled" && ( "$LABEL_NAME" == "lgtm" || "$LABEL_NAME" == "approved" ) ]]; then
66+
echo "Reviewer approval ($LABEL_NAME) — running automatically"
67+
exit 0
68+
fi
69+
if [[ "$HAS_LABEL" == "true" ]]; then
4070
echo "External contributor — approved via label"
4171
exit 0
4272
fi

0 commit comments

Comments
 (0)