Skip to content

chore(ci): Improve cluster creation and teardown for GHA E2E#21604

Open
msugakov wants to merge 6 commits into
masterfrom
misha/iterate-on-gha-e2e
Open

chore(ci): Improve cluster creation and teardown for GHA E2E#21604
msugakov wants to merge 6 commits into
masterfrom
misha/iterate-on-gha-e2e

Conversation

@msugakov

@msugakov msugakov commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Description

I suggest that this PR should be reviewed by commits. I provided descriptions in each commit's message.

User-facing documentation

Testing and quality

  • the change is production ready: the change is GA, or otherwise the functionality is gated by a feature flag
  • CI results are inspected

Automated testing

No change.

How I validated my change

  1. Clicked through GHA workflows here, for the happy case, to see that the cluster deletion really ran.
  2. Induced failures in Test cluster teardown #21617 and also checked GHA runs there.

msugakov added 2 commits July 8, 2026 09:52
so that we have something remaining in infra to investigate in case
of failures.

Also, don't swallow the error of the cluster deletion.
Otherwise, how do we know that we can't delete clusters any more.
I could not easily fix the `actions/create-gke-cluster` action
because it requires deeper thinking into pre/post hook. At the same
time, I saw that all other tests don't use the action and create
the cluster directly.

After seeing that #21230
was created to enable use of spot VMs, it's clearly possible to use
those through `provision_gke_cluster()` function with `GKE_SPOT` env
variable.

Thus, I consider the `actions/create-gke-cluster` action to be
redundant and I got rid of it.

By the way, this also should fix the cluster name uniqueness
problem in `e2e-db-backup-restore-test`.
@msugakov msugakov added e2e-gke-upgrade-tests Triggers GHA-based gke-upgrade-tests on draft PRs e2e-db-backup-restore-test Triggers GHA-based e2e-db-backup-restore-test on draft PRs e2e-nongroovy-tests Triggers GHA-based e2e-nongroovy-tests on draft PRs e2e-byodb-test Triggers GHA-based e2e-byodb-test on draft PRs labels Jul 8, 2026
@openshift-ci

openshift-ci Bot commented Jul 8, 2026

Copy link
Copy Markdown

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

In the spirit of #21230
@msugakov msugakov force-pushed the misha/iterate-on-gha-e2e branch from bbb373c to cc63fd9 Compare July 8, 2026 09:00
@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Central YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: bdb21147-4746-4d24-859e-6f72d00df6fd

📥 Commits

Reviewing files that changed from the base of the PR and between 1fa0dfd and 14097d7.

📒 Files selected for processing (4)
  • .github/workflows/e2e-byodb-test.yaml
  • .github/workflows/e2e-db-backup-restore-test.yaml
  • .github/workflows/e2e-gke-upgrade-tests.yaml
  • .github/workflows/e2e-nongroovy-tests.yaml
🚧 Files skipped from review as they are similar to previous changes (4)
  • .github/workflows/e2e-gke-upgrade-tests.yaml
  • .github/workflows/e2e-db-backup-restore-test.yaml
  • .github/workflows/e2e-byodb-test.yaml
  • .github/workflows/e2e-nongroovy-tests.yaml

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes
    • Improved reliability of end-to-end test workflows by only tearing down clusters after successful cluster creation, with more consistent teardown error handling.
    • Updated GKE-based test jobs to provision clusters using spot/spot-enabled capacity for consistent provisioning.
  • Chores
    • Simplified GKE cluster provisioning by removing the shared composite action and creating/managing clusters directly within the workflows.

Walkthrough

CI workflows for GKE-based end-to-end tests now gate teardown or deletion on successful cluster creation, add explicit step ids, set GKE_SPOT values, and inline GKE provisioning in the DB backup/restore job.

Changes

GKE cluster provisioning and conditional teardown

Layer / File(s) Summary
e2e-byodb-test conditional teardown
.github/workflows/e2e-byodb-test.yaml
Adds GKE_SPOT to cluster creation and gates teardown on create-cluster success while removing the teardown failure fallback echo.
e2e-nongroovy-tests conditional teardown
.github/workflows/e2e-nongroovy-tests.yaml
Adds create-cluster id and GKE_SPOT to cluster creation, gates teardown on create-cluster success, and removes the teardown failure fallback echo.
e2e-gke-upgrade-tests conditional cluster deletion
.github/workflows/e2e-gke-upgrade-tests.yaml
Assigns create-cluster ids in the central, postgres, and sensor jobs and gates cluster deletion on each step's success outcome.
e2e-db-backup-restore-test inline provisioning and teardown
.github/workflows/e2e-db-backup-restore-test.yaml
Replaces the cluster setup path with inline Cloud SDK setup, GKE creation via scripts/ci/gke.sh, roxctl build, cluster wait logic, and a conditional teardown step guarded by create-cluster success and CLUSTER_NAME.

Estimated code review effort: 2 (Simple) | ~12 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately summarizes the CI cluster creation and teardown changes.
Description check ✅ Passed The description covers the required sections and provides testing and validation notes, with only minor checklist items left unchecked.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch misha/iterate-on-gha-e2e

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Jul 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 50.32%. Comparing base (ae147b5) to head (14097d7).
⚠️ Report is 10 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #21604      +/-   ##
==========================================
- Coverage   50.37%   50.32%   -0.06%     
==========================================
  Files        2844     2844              
  Lines      218476   218476              
==========================================
- Hits       110068   109956     -112     
- Misses     100426   100515      +89     
- Partials     7982     8005      +23     
Flag Coverage Δ
go-unit-tests 50.32% <ø> (-0.06%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

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

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

🚀 Build Images Ready

Images are ready for commit 14097d7. To use with deploy scripts:

export MAIN_IMAGE_TAG=4.12.x-414-g14097d7df4

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/workflows/e2e-gke-upgrade-tests.yaml (1)

81-86: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Cluster deletion is gated on a step that also downloads artifacts, not just cluster wait.

The wait-for-cluster step (central: Lines 80-86, postgres: Lines 225-231, sensor: Lines 369-375) runs both infractl wait and infractl artifacts ... --download-dir artifacts. Deletion (Lines 149, 293, 424) is gated on that same step's overall outcome. If infractl wait succeeds but the subsequent infractl artifacts download fails for an unrelated reason (network blip, storage issue, etc.), the step outcome becomes failure, and the cluster — which was successfully created and is healthy — will never be deleted, leaking infra/billing resources.

Consider splitting the wait and artifact-download into separate steps, or capturing the wait's own exit code so deletion is gated purely on cluster availability rather than the combined step outcome.

♻️ Example split (applies similarly to postgres/sensor jobs)
-    - name: Wait for the cluster and grab artifacts
-      id: wait-for-cluster
-      timeout-minutes: 25
-      run: |
-        infractl wait "${CLUSTER_NAME}"
-        infractl artifacts "${CLUSTER_NAME}" --download-dir artifacts > /dev/null
-        echo "KUBECONFIG=$(pwd)/artifacts/kubeconfig" >> "$GITHUB_ENV"
+    - name: Wait for the cluster
+      id: wait-for-cluster
+      timeout-minutes: 25
+      run: infractl wait "${CLUSTER_NAME}"
+
+    - name: Grab artifacts
+      run: |
+        infractl artifacts "${CLUSTER_NAME}" --download-dir artifacts > /dev/null
+        echo "KUBECONFIG=$(pwd)/artifacts/kubeconfig" >> "$GITHUB_ENV"

Also applies to: 149-149, 226-231, 293-293, 370-375, 424-424

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/e2e-gke-upgrade-tests.yaml around lines 81 - 86, The
`wait-for-cluster` step is combining cluster readiness and artifact download, so
later deletion gates on the whole step instead of just `infractl wait`. Split
the `infractl wait` and `infractl artifacts ... --download-dir artifacts` work
into separate steps in the workflow jobs, or otherwise preserve the wait result
independently; then update the deletion guards to reference the cluster-wait
step outcome for the `wait-for-cluster`/artifact sequence in each job (including
the postgres and sensor variants).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In @.github/workflows/e2e-gke-upgrade-tests.yaml:
- Around line 81-86: The `wait-for-cluster` step is combining cluster readiness
and artifact download, so later deletion gates on the whole step instead of just
`infractl wait`. Split the `infractl wait` and `infractl artifacts ...
--download-dir artifacts` work into separate steps in the workflow jobs, or
otherwise preserve the wait result independently; then update the deletion
guards to reference the cluster-wait step outcome for the
`wait-for-cluster`/artifact sequence in each job (including the postgres and
sensor variants).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Central YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: 911d8af7-51e7-4dd7-a662-e18fe8dd5edd

📥 Commits

Reviewing files that changed from the base of the PR and between 7c3828c and cc63fd9.

📒 Files selected for processing (5)
  • .github/actions/create-gke-cluster/action.yaml
  • .github/workflows/e2e-byodb-test.yaml
  • .github/workflows/e2e-db-backup-restore-test.yaml
  • .github/workflows/e2e-gke-upgrade-tests.yaml
  • .github/workflows/e2e-nongroovy-tests.yaml
💤 Files with no reviewable changes (1)
  • .github/actions/create-gke-cluster/action.yaml

@stackrox stackrox deleted a comment from openshift-ci Bot Jul 8, 2026
@msugakov msugakov mentioned this pull request Jul 8, 2026
@msugakov msugakov changed the title Tear down cluster only when the creation suceeded chore(ci): Tear down cluster only when the creation suceeded Jul 8, 2026
@msugakov msugakov changed the title chore(ci): Tear down cluster only when the creation suceeded chore(ci): Improve cluster creation and teardown for GHA E2E Jul 8, 2026
@msugakov msugakov marked this pull request as ready for review July 8, 2026 12:49
@msugakov msugakov requested a review from a team as a code owner July 8, 2026 12:49
@msugakov msugakov requested review from AlexVulaj and davdhacs July 8, 2026 13:48
Comment thread .github/workflows/e2e-gke-upgrade-tests.yaml Outdated
there's no need to source the script to call just one function in it.
The script allows passing the function and its arguments for such a
use.
`continue-on-error: true` should show orange warning icon which is
better than `|| true` or `|| echo` which results in the green one.
@msugakov msugakov enabled auto-merge (squash) July 8, 2026 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-review area/ci coderabbit-review e2e-byodb-test Triggers GHA-based e2e-byodb-test on draft PRs e2e-db-backup-restore-test Triggers GHA-based e2e-db-backup-restore-test on draft PRs e2e-gke-upgrade-tests Triggers GHA-based gke-upgrade-tests on draft PRs e2e-nongroovy-tests Triggers GHA-based e2e-nongroovy-tests on draft PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants