Repository navigation
feat(ci): decide e2e-ocp-helm runs after the PR image is published #5764
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
subhashkhileri
wants to merge
14
commits into
redhat-developer:main
from
subhashkhileri:rhidp-16423-e2e-ocp-gate
Closed
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
e1ecfa3
feat(ci): decide e2e-ocp-helm runs after the PR image is published
subhashkhileri 041da16
chore(ci): drop the /override comment from auto-approved bot PRs
subhashkhileri 58c7833
fix(ci): keep the e2e-ocp-helm gate from running on draft PRs
subhashkhileri 27a7580
fix(ci): address SonarCloud findings in the e2e-ocp-helm gate
subhashkhileri 414e0fa
fix(ci): sort gate skip categories with localeCompare
subhashkhileri f2ce4d4
fix(ci): address review findings in the e2e-ocp-helm gate
subhashkhileri 26b3a6e
fix(ci): do not rebuild the PR image when a draft is marked ready
subhashkhileri 33663f0
fix(ci): drop the E2E_GATE_MODE report-only switch
subhashkhileri a32ab54
chore(e2e-gate): simplify gate script and drop YAML fallback
subhashkhileri cecfc62
chore(e2e-gate): address SonarCloud findings in gate.mts
subhashkhileri 5385df3
chore(e2e-gate): parse the Link header without a regex
subhashkhileri 1464d04
docs(e2e-gate): add design decisions to the gate README
subhashkhileri d8daf83
refactor(e2e-gate): move the gate scripts to scripts/e2e-gate
subhashkhileri 3e630f8
fix(e2e-gate): make skips stick in Tide and close status gaps
subhashkhileri File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| # Copyright Red Hat, Inc. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| name: E2E OCP Gate Tests | ||
|
|
||
| on: | ||
| pull_request: | ||
| paths: | ||
| - "scripts/e2e-gate/**" | ||
| - ".github/workflows/e2e-ocp-gate-tests.yaml" | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| test: | ||
| name: Unit tests | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - name: Set up Node.js | ||
| uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6.5.0 | ||
| with: | ||
| node-version-file: ".nvmrc" | ||
|
|
||
| - name: Run gate rule tests | ||
| run: node --test "scripts/e2e-gate/*.test.mts" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| # e2e-ocp-helm gate | ||
|
|
||
| The `ci/prow/e2e-ocp-helm` PR check claims an ephemeral OpenShift cluster on | ||
| every run, and a large share of those claims were avoidable (RHIDP-16423): | ||
| Renovate rebases, rhdh-bot `[skip-e2e]` PRs, PRs that changed no product code, | ||
| and runs that sat on a cluster waiting for the PR image. | ||
|
|
||
| Prow no longer starts the job on push. The **Decide e2e-ocp-helm** job in | ||
| [`pr-podman-push.yaml`](../../.github/workflows/pr-podman-push.yaml) runs once the PR | ||
| image is published and decides what the PR needs. | ||
|
|
||
| ## What the gate decides | ||
|
|
||
| | Decision | When | What happens | | ||
| | -------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | | ||
| | `skip` | Every changed file matches a no-cluster rule, or rhdh-bot opened a `[skip-e2e]` PR | Sets `ci/prow/e2e-ocp-helm` to success with the reason, marked `[prow:skip-retest]` | | ||
| | `fail` | The image build failed, publishing failed, or `[skip-build]` left no image for a product change | Sets the status to failure with the reason | | ||
| | `wait` | Renovate or Dependabot PR, an author Prow does not trust, or a draft PR | Sets the status to pending, asking for `/test e2e-ocp-helm` (and `/ok-to-test` for untrusted authors) | | ||
| | `run` | Anything else | Sets the status to pending, then rhdh-bot comments `/test e2e-ocp-helm` and Prow runs the job | | ||
|
|
||
| Rules are checked in this order. They live in [`rules.mts`](rules.mts); the | ||
| order is in [`decide.mts`](decide.mts). | ||
|
|
||
| ## Design decisions | ||
|
|
||
| | Decision | Why | | ||
| | ----------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| | Decide in GitHub Actions, after the image | Prow claims the cluster before any job step runs, so a check inside the job is too late. | | ||
| | Unknown paths run | A missing rule costs a cluster, never a skipped test. A renamed file counts under its old and new path. GitHub lists at most 3000 files, so a PR with that many never skips. | | ||
| | Skips carry `[prow:skip-retest]` | Tide counts a required job as passed only when a ProwJob exists or a success status carries this marker. Without it, Tide would start the job itself before merging a skipped PR. | | ||
| | Image problems before any `wait` | A PR with no image gets `fail`, not "comment `/test`", which would claim a cluster and wait 60 minutes for nothing. | | ||
| | `[skip-build]` directories mirror Prow | When the image build is skipped, the Prow step tests the `next` image only if every change is under its `DIRECTORIES_TO_CHECK`. `PREBUILT_IMAGE_OK_PATHS` must match it; anything else fails. | | ||
| | Renovate and Dependabot wait | They rebase many times before merge, and each rebase used to claim a cluster. | | ||
| | Trust matches Prow | rhdh-bot's `/test` bypasses `/ok-to-test`, so the gate only runs PRs from org members (private ones too, checked with rhdh-bot's token), collaborators, or PRs with `ok-to-test`. | | ||
| | 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. Comment `/test` or push instead. | | ||
| | Prow results win | Once Prow reports on a commit, the gate never overwrites it or requests a second run. A hidden marker in rhdh-bot's `/test` comment stops duplicate requests on re-runs. | | ||
| | Cancelled builds fail | A build cancelled for the current head fails the check, so the PR shows why it cannot merge. A build cancelled by a newer push is ignored because the head moved. | | ||
| | Gate errors set `error` | If any gate step fails, a final `gh` step sets `error` with a link to the run (unless Prow already reported), so Tide never waits on a status that will not arrive. A failed org membership check is an error, not "untrusted". | | ||
| | Still required for merge | openshift/release sets `require_manually_triggered_jobs: true`, so Tide waits for the status even though Prow no longer starts the job. | | ||
| | One copy of the rules | `workflow_run` jobs run from `main`, so `main` decides for every release branch. A PR cannot test its own gate changes. | | ||
| | Plain `node` and `fetch`, no installs | The job holds `RHDH_BOT_TOKEN`, so no third-party packages run in it. Node 24 runs the `.mts` files directly, like the other scripts in `scripts/`. `actions/github-script` would add Octokit but has no clean way to use a second token. | | ||
| | Never checks out PR code | The job checks out only the default branch and reads the PR through the API. | | ||
|
|
||
| ## Running the job by hand | ||
|
|
||
| Comment `/test e2e-ocp-helm` at any time; a Prow run replaces any status the | ||
| gate set. Use it for dependency PRs before merging, drafts or PRs just marked | ||
| ready, PRs whose image build was skipped, or a skipped change you still want | ||
| tested on a cluster. | ||
|
|
||
| ## Changing the rules | ||
|
|
||
| 1. Edit `rules.mts` and add a case to `decide.test.mts`. | ||
| 2. Run `node --test "scripts/e2e-gate/*.test.mts"` (Node from `.nvmrc`, no | ||
| install). | ||
| 3. The rules take effect once merged to `main`. |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.