Skip to content

Fix breaking-changes test to skip cluster-init when kubeconfigs unavailable - #4811

Merged
openshift-merge-bot[bot] merged 1 commit into
openshift:mainfrom
deepsm007:fix-breaking-changes
Nov 6, 2025
Merged

openshift-merge-bot[bot] merged 1 commit into
openshift:mainfrom
deepsm007:fix-breaking-changes

Conversation

@deepsm007

Copy link
Copy Markdown
Contributor

/cc @openshift/test-platform

@openshift-ci-robot

Copy link
Copy Markdown
Contributor

Pipeline controller notification
This repository is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. Review these jobs and use /test <job> to manually trigger optional jobs most likely to be impacted by the proposed changes.

@openshift-ci
openshift-ci Bot requested a review from a team November 5, 2025 18:15
@coderabbitai

coderabbitai Bot commented Nov 5, 2025 •

Copy link
Copy Markdown

Walkthrough

Modified error handling in kubeclient creation to log warnings and continue iterating rather than halting on missing/invalid kubeconfigs. Added conditional guard in test script to execute cluster-init update only when KUBECONFIG_DIR environment variable is set and points to an existing directory.

Changes

Cohort / File(s) Summary
Error handling in kubeclient initialization
cmd/cluster-init/cmd/onboard/config/update.go
Changed error handling during kubeclient creation from aborting processing to logging a warning and continuing to the next cluster, effectively skipping clusters with invalid or missing kubeconfigs
Conditional cluster-init execution
test/validate-generation-breaking-changes.sh
Wrapped cluster-init update in a conditional check that verifies KUBECONFIG_DIR is set and points to an existing directory; update executes conditionally with kubeconfig parameters derived from environment variables, otherwise skipped with a log message

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • The Go file's control flow change from aborting to skipping clusters on error requires verification that the behavioral shift is intentional and doesn't mask critical failures
  • The shell script conditional logic needs validation to ensure proper environment variable handling and fallback behavior
  • Cross-file consistency check: verify that the shell script skip logic aligns with the Go code's error handling approach
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 5, 2025

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
cmd/cluster-init/cmd/onboard/config/update.go (1)

95-96: Error handling approach looks good for CI resilience.

The change from failing immediately to logging and continuing is appropriate for the breaking-changes test scenario where kubeconfigs may be unavailable. The log message clearly identifies the skipped cluster and the reason.

However, consider that if all clusters fail due to missing kubeconfigs, the function still returns success (nil at line 106). This might be the intended behavior for CI environments, but verify this won't mask legitimate configuration issues in production workflows.

Consider adding a summary log after the loop to track how many clusters were successfully processed vs. skipped, which would make debugging easier:

	successCount := 0
	skipCount := 0
	for clusterName, clusterInstall := range clusterInstalls {
		ctrlClient, kubeClient, config, err := newKubeClients(kubeconfigs, clusterName)
		clusterInstall.Config = config
		if err != nil {
			log.WithField("cluster", clusterName).WithError(err).Warn("Skipping cluster due to missing or invalid kubeconfig")
			skipCount++
			continue
		}
		if err := addClusterInstallRuntimeInfo(ctx, clusterInstall, ctrlClient); err != nil {
			return err
		}
		if err := runConfigSteps(ctx, log, true, clusterInstall, ctrlClient, kubeClient); err != nil {
			return fmt.Errorf("update config for cluster %s: %w", clusterName, err)
		}
		successCount++
	}
	log.WithField("processed", successCount).WithField("skipped", skipCount).Info("Cluster update summary")
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting

📥 Commits

Reviewing files that changed from the base of the PR and between 6f95488 and 8ad8b86.

📒 Files selected for processing (2)
  • cmd/cluster-init/cmd/onboard/config/update.go (1 hunks)
  • test/validate-generation-breaking-changes.sh (2 hunks)
🔇 Additional comments (1)
test/validate-generation-breaking-changes.sh (1)

68-85: Conditional guard implementation is solid.

The check correctly uses ${KUBECONFIG_DIR:-} to safely handle unset variables (compatible with set -o nounset at line 4) and -d to verify the directory exists before attempting cluster-init update. The skip message clearly explains why the step was bypassed.

The structure preserves the original error-detection logic (lines 72-82) when cluster-init does run, while gracefully degrading when kubeconfigs are unavailable—aligning well with the resilient error handling added to update.go.

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Nov 6, 2025
@openshift-ci-robot

Copy link
Copy Markdown
Contributor

Scheduling required tests:
/test e2e

Scheduling tests matching the pipeline_run_if_changed or not excluded by pipeline_skip_if_only_changed parameters:
/test integration-optional-test

@openshift-ci

openshift-ci Bot commented Nov 6, 2025

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: deepsm007, Prucek

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci

openshift-ci Bot commented Nov 6, 2025

Copy link
Copy Markdown
Contributor

@deepsm007: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/breaking-changes 8ad8b86 link false /test breaking-changes

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@openshift-merge-bot
openshift-merge-bot Bot merged commit 2c7f1cc into openshift:main Nov 6, 2025
14 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants