Skip to content

feat(ci): decide e2e-ocp-helm runs after the PR image is published - #5764

Closed
subhashkhileri wants to merge 14 commits into
redhat-developer:mainfrom
subhashkhileri:rhidp-16423-e2e-ocp-gate
Closed

subhashkhileri wants to merge 14 commits into
redhat-developer:mainfrom
subhashkhileri:rhidp-16423-e2e-ocp-gate

Conversation

@subhashkhileri

@subhashkhileri subhashkhileri commented Nov 2, 2026 •

Copy link
Copy Markdown
Member

Summary

The mandatory e2e-ocp-helm Prow check claims an ephemeral OCP cluster from the Hive pool on every run. Between 2026-09-16 and 2026-11-02 it claimed 792 clusters, and about 340 of those (43%) were avoidable:

Waste Claims
Renovate PRs re-tested on every rebase (6 PRs; #5466 alone ran 116 times) 238
rhdh-bot [skip-e2e] PRs claimed a cluster, then exited 0 76
PRs that only touched docs, tooling, the cluster-free harness or CI for other platforms 44
Runs that held a cluster for up to 60 min waiting for the PR image, then timed out 18

This PR adds a Decide e2e-ocp-helm job to pr-podman-push.yaml. It runs after the PR image is published and decides:

PR image build ─► Podman PR Push ─► Decide e2e-ocp-helm
                                     ├─ run  : rhdh-bot comments `/test e2e-ocp-helm`
                                     ├─ skip : status ci/prow/e2e-ocp-helm = success (reason)
                                     ├─ wait : status = pending ("comment /test e2e-ocp-helm")
                                     └─ fail : status = failure (image build/publish problem)
scripts/e2e-gate/
├── rules.mts          # path rules, bot rules, trusted associations
├── decide.mts         # pure decision function
├── decide.test.mts    # 74 node:test cases
├── gate.mts           # GitHub API I/O (status / comment)
└── README.md

The scripts are TypeScript run directly by Node 24 (.nvmrc) with type stripping, so the job with secrets has no yarn install step.

Companion change: openshift/release#88148 makes the Prow job manual-only and keeps it required. Merge this PR first: until #88148 lands, Prow still reports on every push before the gate runs, and the gate leaves Prow results alone.

Design decisions

Decision Why
Decide after the image is published, outside Prow Prow claims the cluster before any step runs, so a check inside the job is too late.
Prow results win Once Prow reports ci/prow/e2e-ocp-helm on a commit, the gate never overwrites it or requests a second run.
Image failures before any "wait" A Renovate or untrusted PR with no image gets fail, not "comment /test" (which would wait 60 min for nothing).
Drafts wait; marking ready does nothing Re-running on ready_for_review would rebuild the image and need the trigger backported to every release branch. About 2 PRs a week on main need a /test or push after marking ready instead.
Renovate/Dependabot wait for a manual /test They rebase many times before merge; each rebase used to claim a cluster.
Trust matches Prow Org members (private ones too, checked with rhdh-bot's token), collaborators, or ok-to-test. Only then does rhdh-bot post /test.
Unknown paths run A missing rule costs a cluster, never a skipped test. Renames count under the old and new path.
[skip-build] fallback mirrors Prow Uses the same directory list as the Prow step's next-image fallback; other changes with no image fail.
Gate errors are visible If the gate crashes, it sets error with a link (unless Prow already reported), so Tide never waits on a missing status.
One copy of the rules workflow_run runs from main, so main decides for every release branch.
rpms.lock.yaml stays skipped Same as today's skip_if_only_changed; the bot's lockfile PRs are [skip-build], so there is no image to test.

Which issue(s) does this PR fix

Evidence

Testing

  • node --test "scripts/e2e-gate/*.test.mts": 74 passed. The new E2E OCP Gate Tests workflow runs the same command.
  • tsc --noEmit --strict on the gate scripts: clean.
  • actionlint on the changed workflows: no new findings.
  • Replay against historical Prow data, as above.
  • Not tested end to end: workflow_run jobs only run from main, so the gate can't run from this PR.

Merge Danger

Door: two-way. Blast radius: PR checks

How to revert

Revert this PR and openshift/release#88148.

PR acceptance criteria

  • GitHub Actions are completed and successful
  • Unit Tests are updated and passing
  • E2E Tests are updated and passing (not applicable: no product or e2e code change)
  • Documentation is updated if necessary (scripts/e2e-gate/README.md, docs/e2e-tests/CI.md)
  • Add a screenshot if the change is UX/UI related (not applicable)

How to test changes / Special notes to the reviewer

  • Uses the existing RHDH_BOT_TOKEN secret, because rhdh-bot is an org member and Prow accepts its /test. Its comments bypass /ok-to-test, so the gate posts /test only for trusted authors (see Design decisions). Only rhdh-bot's own marker comment counts as an earlier request.
  • Setting the status for skipped PRs only needs statuses: write on GITHUB_TOKEN.
  • Draft PRs get a pending status instead of a run, matching Prow's current behaviour of not auto-running on drafts. pr-build-image.yaml is unchanged.
  • The gate checks out only the default branch (sparse) and reads the PR through the API. It never runs PR code.
  • auto-approve-bot-prs.yaml no longer adds /override ci/prow/e2e-ocp-helm to its approval review. Prow rejects /override from github-actions[bot] as unauthorized, so the line never took effect: it only produced a rejection comment on every bot PR (152 since 2026-09-15). The gate now handles bot PRs that need no cluster.

Assisted-by: Claude Code

The e2e-ocp-helm Prow check claims an ephemeral OCP cluster on every run.
Between 2026-09-16 and 2026-11-02 it claimed 792 clusters and about 43% of
those claims were avoidable: Renovate rebases, rhdh-bot [skip-e2e] PRs that
claimed and then exited, PRs that only touched docs, tooling, the
cluster-free harness or CI for other platforms, and runs that held a cluster
while waiting for the PR image.

Add a "Decide e2e-ocp-helm" job to pr-podman-push.yaml. It runs after the
PR image is published and either has rhdh-bot comment /test e2e-ocp-helm or
sets the required ci/prow/e2e-ocp-helm status itself (skip, wait for a
manual /test, or fail with the reason). The rules and decision logic are
TypeScript run directly by Node from .nvmrc, with unit tests and no install
step. The gate only reports until the E2E_GATE_MODE repository variable is
set to "enforce", which happens together with the openshift/release change
that makes the Prow job manual-only.

Refs: RHIDP-16423

Assisted-by: Claude Code
Co-Authored-By: Claude Code
Signed-off-by: Subhash Khileri <skhileri@redhat.com>
Comment thread scripts/e2e-gate/gate.mts Fixed
Comment thread .github/e2e-gate/gate.mts Fixed
Comment thread scripts/e2e-gate/gate.mts Fixed
Comment thread scripts/e2e-gate/gate.mts Fixed
@codecov

codecov Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.94%. Comparing base (c977f1a) to head (3e630f8).
⚠️ Report is 14 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5764      +/-   ##
==========================================
- Coverage   78.65%   72.94%   -5.71%     
==========================================
  Files          67       60       -7     
  Lines         726      573     -153     
  Branches      100       83      -17     
==========================================
- Hits          571      418     -153     
  Misses        154      154              
  Partials        1        1              
Flag Coverage Δ *Carryforward flag
rhdh 69.00% <ø> (-6.70%) ⬇️
rhdh-e2e-frontend 71.23% <ø> (ø) Carriedforward from d8daf83

*This pull request uses carry forward flags. Click here to find out more.

Components Coverage Δ
Backend plugins ∅ <ø> (∅)
Backend app 78.94% <ø> (ø)
Frontend app 68.40% <ø> (ø)

Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c977f1a...3e630f8. Read the comment docs.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Prow rejects /override from github-actions[bot] as unauthorized, so the
line never had an effect and only added a rejection comment to every bot
PR. Bot PRs that need no cluster are now handled by the e2e-ocp-helm gate.

Assisted-by: Claude Code
Co-Authored-By: Claude Code
Signed-off-by: Subhash Khileri <skhileri@redhat.com>
@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

The container image build workflow finished with status: cancelled.

@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Image was built and published successfully. It is available at:

Prow never auto-ran presubmits on drafts, but the image build runs on
them, so the gate would have posted /test on every draft push. Drafts
now get a pending status, and ready_for_review re-runs the image build
and the gate.

Assisted-by: Claude Code
Co-Authored-By: Claude Code
Signed-off-by: Subhash Khileri <skhileri@redhat.com>
@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Image was built and published successfully. It is available at:

- Drop the explicit checkout ref. In a workflow_run job checkout already
  uses the default branch head; the github.event expression made Sonar
  read it as a fork checkout.
- Strip control characters from API values before logging them.

Assisted-by: Claude Code
Co-Authored-By: Claude Code
Signed-off-by: Subhash Khileri <skhileri@redhat.com>
Assisted-by: Claude Code
Co-Authored-By: Claude Code
Signed-off-by: Subhash Khileri <skhileri@redhat.com>
@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

The container image build workflow finished with status: cancelled.

@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Image was built and published successfully. It is available at:

- Never overwrite a ci/prow/e2e-ocp-helm status Prow already reported,
  and never request a second run for a commit Prow has tested.
- Only count earlier /test requests posted by rhdh-bot, so a spoofed
  marker cannot suppress the run.
- Classify a renamed file under its old path too.
- Check image build/publish failures before Renovate and untrusted
  "comment /test" answers, which would wait 60 minutes for no image.
- Ignore cancelled image builds; the newer build decides.
- Trust private redhat-developer members, as Prow does.
- Match the [skip-build] fallback directories to the Prow step's list.
- Keep cluster/gke/gcloud.sh and cluster/eks/aws.sh running: cleanup.sh
  sources them in the OCP Helm job.
- Set an error status if the gate fails or cannot find the PR, so Tide
  never waits on a status that will not arrive.

Assisted-by: Claude Code
Co-Authored-By: Claude Code
Signed-off-by: Subhash Khileri <skhileri@redhat.com>
@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Image was built and published successfully. It is available at:

Drop the ready_for_review trigger from pr-build-image.yaml. It rebuilt
the image only to re-run the gate, and pull_request reads the workflow
from the base branch, so every release branch would need it too. Drafts
still wait; the next push or a manual /test starts the check.

Assisted-by: Claude Code
Co-Authored-By: Claude Code
Signed-off-by: Subhash Khileri <skhileri@redhat.com>
Comment thread scripts/e2e-gate/gate.mts Fixed
The gate acts as soon as it merges. Until openshift/release stops
auto-running e2e-ocp-helm, Prow reports on each push long before the
gate runs, and the gate leaves Prow results alone, so there is nothing
to stage.

Assisted-by: Claude Code
Co-Authored-By: Claude Code
Signed-off-by: Subhash Khileri <skhileri@redhat.com>
@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

The container image build workflow finished with status: cancelled.

@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Image was built and published successfully. It is available at:

- Report gate errors from gate.mts, reusing prowStatus, instead of a bash
  step that duplicated the context and bot login.
- Check for an existing Prow result before fetching files and membership;
  fetch those two in parallel.
- Skip cancelled builds in the job condition instead of starting a runner.
- Share request headers, trim duplicated comments, merge overlapping tests.

Assisted-by: Claude Code
Co-Authored-By: Claude Code
Signed-off-by: Subhash Khileri <skhileri@redhat.com>
- Validate the org and login before building the membership URL.
- Parse the Link header without a backtracking regex.
- Use top-level await instead of a promise chain.

Assisted-by: Claude Code
Co-Authored-By: Claude Code
Signed-off-by: Subhash Khileri <skhileri@redhat.com>
@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

The container image build workflow finished with status: cancelled.

Assisted-by: Claude Code
Co-Authored-By: Claude Code
Signed-off-by: Subhash Khileri <skhileri@redhat.com>
@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

The container image build workflow finished with status: cancelled.

@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Image was built and published successfully. It is available at:

Record why each part of the gate works the way it does, and fold the
scattered explanation paragraphs into one table.

Assisted-by: Claude Code
Co-Authored-By: Claude Code
Signed-off-by: Subhash Khileri <skhileri@redhat.com>
@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Image was built and published successfully. It is available at:

Assisted-by: Claude Code
Co-Authored-By: Claude Code
Signed-off-by: Subhash Khileri <skhileri@redhat.com>
@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Image was built and published successfully. It is available at:

- Mark skip statuses with [prow:skip-retest]. Tide only treats a required
  job as passed when a ProwJob exists or the success status carries this
  sentinel, so without it Tide started the job itself before merge.
- Run for install-methods/operator.sh: gcloud.sh sources it in every job.
- Take PUBLISH_RESULT from the push step, not the whole job, so a failed
  comment step after a successful push no longer fails the check.
- Ignore the gate's own statuses when looking for a Prow result, and check
  again just before writing, so a Prow result is never overwritten.
- Report cancelled builds for the current head instead of staying silent.
- Set the error status from a final gh step, so it also covers failures in
  checkout or Node setup.
- Never skip when GitHub truncates the file list (3000 files).
- Set a pending status before requesting /test, so a dropped request shows
  on the PR.
- Treat unexpected org membership answers as errors, not "untrusted".
- Reword the skipped-image failure message.

Assisted-by: Claude Code
Co-Authored-By: Claude Code
Signed-off-by: Subhash Khileri <skhileri@redhat.com>
@sonarqubecloud

sonarqubecloud Bot commented Nov 4, 2026

Copy link
Copy Markdown

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Image was built and published successfully. It is available at:

@github-actions

Copy link
Copy Markdown
Contributor

This PR is stale because it has been open 7 days with no activity. Remove stale label or comment or this will be closed in 21 days.

@github-actions github-actions Bot added the Stale label Nov 12, 2026
@subhashkhileri

Copy link
Copy Markdown
Member Author

Superseded by #5778 (pipeline controller approach, with openshift/release#88206). Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants