Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
95bf99d
X-Smart-Branch-Parent: master
jschnath Oct 13, 2026
80f8906
Add a local prototype for pull-request test selection.
vikin91 Sep 30, 2026
bdc9873
Drop Python bytecode from the test-selection prototype.
vikin91 Sep 30, 2026
f31d23a
Give an explicit /test priority when the comment list is missing.
vikin91 Sep 30, 2026
8ad29fe
Keep fork pull requests and /test timestamps on the existing rules.
vikin91 Sep 30, 2026
66bed99
Add pydoc and rename files
vikin91 Sep 30, 2026
3962b86
Set defaults to match the current state
vikin91 Sep 30, 2026
1fdd9db
Fix the docs-only rule
vikin91 Sep 30, 2026
cd1dce9
Improve the log format
vikin91 Sep 30, 2026
834ea1b
Write numbered logs and drop generated decision comments.
vikin91 Sep 30, 2026
de44adf
Skip end-to-end jobs when a pull request only touches CI tooling.
vikin91 Sep 30, 2026
844b4d2
Rename the path match modes so the diff is the subject.
vikin91 Sep 30, 2026
65af9e4
Compact log
vikin91 Sep 30, 2026
55277ae
Rule: always run style
vikin91 Sep 30, 2026
329e620
Add pycache to gitignore
vikin91 Oct 1, 2026
675b797
A clash between run and skip runs the job.
vikin91 Oct 1, 2026
56160f2
Add resolver edge-case tests and fixtures.
vikin91 Oct 1, 2026
245a10f
Keep the match line when a rule's targets all clash.
vikin91 Oct 1, 2026
dc2a902
Reject a remaining rule that is not last.
vikin91 Oct 1, 2026
0e2fc07
Say "all N changed files" when an any-file rule hits the whole diff.
vikin91 Oct 1, 2026
6abea1b
Explain 'when' conditions using sets arithmetics
vikin91 Oct 1, 2026
d9a82aa
Add matching example to readme
vikin91 Oct 2, 2026
8ab219e
Style: Allow resolver to be a big file
vikin91 Oct 2, 2026
e91acdd
Add more test domain rules
jschnath Oct 8, 2026
5457183
Wire test jobs to read CI decisions
jschnath Oct 9, 2026
2d88e22
Fix CI selector test suite for updated rules
jschnath Oct 14, 2026
4793530
[CI-TEST] Add sensor detector file to validate test selection
jschnath Oct 15, 2026
754419f
[CI-TEST] Test UI-only rule - expect ui tests only
jschnath Oct 15, 2026
14f5217
[CI-TEST] Test docs-only rule
jschnath Oct 15, 2026
ce7a58d
[CI-TEST] Test tree-may-have-changed rule (go.mod)
jschnath Oct 15, 2026
f14030b
[CI-TEST] Clean up test validations
jschnath Oct 15, 2026
ddb3809
[CI-TEST] Test ci-tooling rule
jschnath Oct 15, 2026
823b574
[CI-TEST] Test scanner-only rule
jschnath Oct 15, 2026
c7bfd9b
[CI-TEST] Test central-sensor-communication (central/alert)
jschnath Oct 15, 2026
b484b03
[CI-TEST] Test central-sensor-shared-pkg (pkg/grpc)
jschnath Oct 15, 2026
759f74a
[CI-TEST] Complete - All major rules validated ✅
jschnath Oct 15, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .github/workflows/check-crd-compatibility.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,36 +35,55 @@ jobs:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}

- name: Read the CI decision
id: ci-decision
if: github.event_name == 'pull_request'
env:
CI_ENFORCE: ${{ contains(github.event.pull_request.labels.*.name, 'ci-dispatcher-enforce') }}
CI_REPO: ${{ github.repository }}
CI_PR: ${{ github.event.pull_request.number }}
CI_COMMIT: ${{ github.event.pull_request.head.sha }}
CI_BASE: ${{ github.event.pull_request.base.sha }}
CI_HEAD: ${{ github.event.pull_request.head.sha }}
PR_LABELS: ${{ join(github.event.pull_request.labels.*.name, ',') }}
run: ci/select/gha-gate.sh check-crd-compatibility

- uses: ./.github/actions/job-preamble
if: steps.ci-decision.outputs.action != 'skip'
with:
gcp-account: ${{ secrets.GCP_SERVICE_ACCOUNT_STACKROX_CI }}

- name: Checkout crd-schema-checker
if: steps.ci-decision.outputs.action != 'skip'
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # ratchet:actions/checkout@v7.0.0
with:
repository: openshift/crd-schema-checker
path: .crd-schema-checker
ref: c313b6407231f6d1aabfb602f0823708f8c6b9fb # 2025-09-05

- name: Build crd-schema-checker
if: steps.ci-decision.outputs.action != 'skip'
run: |
make -C .crd-schema-checker

- name: Get previous released version
if: steps.ci-decision.outputs.action != 'skip'
id: get_previous_released_version
run: |
make -C operator bundle-post-process
released_version="$(make --no-print-directory -C operator replaced-version)"
echo "released_version=$released_version" >> "$GITHUB_OUTPUT"

- name: Checkout previous released version
if: steps.ci-decision.outputs.action != 'skip'
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # ratchet:actions/checkout@v7.0.0
with:
fetch-depth: 0
ref: ${{ steps.get_previous_released_version.outputs.released_version }}
path: .old-stackrox

- name: Run crd-schema-checker for platform operator
if: steps.ci-decision.outputs.action != 'skip'
run: |
set -e
old_path=.old-stackrox/operator/config/crd/bases
Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/ci-decision.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: CI decision

# Prints the decision for a pull request. It does not start or stop other
# jobs. The label ci-dispatcher-enforce is read by the jobs that follow
# the decision.

on:
pull_request:
types:
- opened
- reopened
- synchronize
- labeled
- unlabeled

permissions:
contents: read

jobs:
decision:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # ratchet:actions/checkout@v7.0.0
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}

- name: Print the CI decision
env:
CI_ENFORCE: ${{ contains(github.event.pull_request.labels.*.name, 'ci-dispatcher-enforce') }}
CI_REPO: ${{ github.repository }}
CI_PR: ${{ github.event.pull_request.number }}
CI_COMMIT: ${{ github.event.pull_request.head.sha }}
CI_BASE: ${{ github.event.pull_request.base.sha }}
CI_HEAD: ${{ github.event.pull_request.head.sha }}
PR_LABELS: ${{ join(github.event.pull_request.labels.*.name, ',') }}
run: ci/select/gha-gate.sh
67 changes: 65 additions & 2 deletions .github/workflows/e2e-dispatch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ on:
- reopened
- synchronize
- ready_for_review
- labeled
- unlabeled

permissions:
contents: read
Expand All @@ -36,6 +38,26 @@ jobs:
wait-for-konflux-images: ${{ steps.determine.outputs.wait-for-konflux-images }}
jobs: ${{ steps.determine.outputs.jobs }}
steps:
- name: Checkout
if: github.event_name == 'pull_request'
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # ratchet:actions/checkout@v7.0.0
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}

- name: Resolve the CI decision
if: github.event_name == 'pull_request'
env:
CI_ENFORCE: ${{ contains(github.event.pull_request.labels.*.name, 'ci-dispatcher-enforce') }}
CI_REPO: ${{ github.repository }}
CI_PR: ${{ github.event.pull_request.number }}
CI_COMMIT: ${{ github.event.pull_request.head.sha }}
CI_BASE: ${{ github.event.pull_request.base.sha }}
CI_HEAD: ${{ github.event.pull_request.head.sha }}
PR_LABELS: ${{ join(github.event.pull_request.labels.*.name, ',') }}
CI_DECISION_OUT: ${{ runner.temp }}/ci-decision.txt
run: ci/select/gha-gate.sh

- name: Determine whether should dispatch workflows
id: determine
shell: python
Expand All @@ -48,6 +70,8 @@ jobs:
input__ui_only_change: ${{ needs.detect-changes.outputs.ui_only }}
input__repo: ${{ github.repository }}
input__pr_number: ${{ github.event.pull_request.number }}
input__enforce: ${{ github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'ci-dispatcher-enforce') }}
input__decision_file: ${{ github.event_name == 'pull_request' && format('{0}/ci-decision.txt', runner.temp) || '' }}
run: |
import json
import os
Expand Down Expand Up @@ -120,12 +144,51 @@ jobs:
print(line)
file.write(line + '\n')

jobs = {job.name: job.should_run(input) for job in jobs_registry}
enforce = os.environ.get('input__enforce') == 'true'
decision_jobs = None
enrolled = set()
decision_path = os.environ.get('input__decision_file') or ''
if enforce and decision_path:
import sys
sys.path.insert(0, 'ci/select')
from decisionlib import DecisionError, parse_decision, parse_defaults
try:
with open(decision_path, encoding='utf-8') as handle:
decision_jobs = parse_decision(handle.read()).jobs
with open('ci/decision-defaults', encoding='utf-8') as handle:
enrolled = set(parse_defaults(handle.read()))
except (OSError, DecisionError) as exc:
print(f'CI decision unreadable ({exc}); using decision-defaults')
try:
with open('ci/decision-defaults', encoding='utf-8') as handle:
defaults = parse_defaults(handle.read())
except (OSError, DecisionError) as fallback_error:
print(f'decision-defaults unreadable ({fallback_error}); keeping the old dispatch rules')
else:
enrolled = set(defaults)
decision_jobs = {name for name, opinion in defaults.items() if opinion == 'run'}

def follows_decision(job):
# Fork pull requests never run these jobs. The decision
# list must not bypass the rejection in should_run.
if input.is_fork == 'true':
return False
# A target this project does not list keeps the old dispatch rule.
if decision_jobs is None or job.name not in enrolled:
return job.should_run(input)
return job.name in decision_jobs
Comment thread
coderabbitai[bot] marked this conversation as resolved.

jobs = {job.name: follows_decision(job) for job in jobs_registry}

write('jobs', json.dumps(jobs))

# Find out when we can complete the workflow early by not even waiting for GHA-built images.
wait_for_gha_images = input.event_name != 'pull_request' or input.is_draft != 'true' or any(jobs.values())
if input.is_fork == 'true':
wait_for_gha_images = False
elif decision_jobs is not None and 'wait-for-images' in enrolled:
wait_for_gha_images = 'wait-for-images' in decision_jobs
else:
wait_for_gha_images = input.event_name != 'pull_request' or input.is_draft != 'true' or any(jobs.values())
write('wait-for-gha-images', str(wait_for_gha_images).lower())

# Waiting for konflux-built images in PR request context requires the 'konflux-build' PR label.
Expand Down
19 changes: 19 additions & 0 deletions .github/workflows/scanner-db-integration-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,40 @@ jobs:
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # ratchet:actions/checkout@v7.0.0
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}

- name: Read the CI decision
id: ci-decision
if: github.event_name == 'pull_request'
env:
CI_ENFORCE: ${{ contains(github.event.pull_request.labels.*.name, 'ci-dispatcher-enforce') }}
CI_REPO: ${{ github.repository }}
CI_PR: ${{ github.event.pull_request.number }}
CI_COMMIT: ${{ github.event.pull_request.head.sha }}
CI_BASE: ${{ github.event.pull_request.base.sha }}
CI_HEAD: ${{ github.event.pull_request.head.sha }}
PR_LABELS: ${{ join(github.event.pull_request.labels.*.name, ',') }}
run: ci/select/gha-gate.sh db-integration-tests

- uses: ./.github/actions/job-preamble
if: steps.ci-decision.outputs.action != 'skip'
with:
gcp-account: ${{ secrets.GCP_SERVICE_ACCOUNT_STACKROX_CI }}

- name: Run Postgres
if: steps.ci-decision.outputs.action != 'skip'
run: |
su postgres -c 'initdb -D /tmp/data'
su postgres -c 'pg_ctl -D /tmp/data start'

- name: Cache Go dependencies
if: steps.ci-decision.outputs.action != 'skip'
uses: ./.github/actions/cache-go-dependencies

- name: Is Postgres ready
if: steps.ci-decision.outputs.action != 'skip'
run: pg_isready -h 127.0.0.1

- name: DB Integration tests
if: steps.ci-decision.outputs.action != 'skip'
run: make -C scanner db-integration-test
Loading
Loading