Skip to content

DNM - for testing OCPBUGS-65645#6016

Draft
isabella-janssen wants to merge 2 commits into
openshift:mainfrom
isabella-janssen:ocpbugs-65645-claude-testing
Draft

DNM - for testing OCPBUGS-65645#6016
isabella-janssen wants to merge 2 commits into
openshift:mainfrom
isabella-janssen:ocpbugs-65645-claude-testing

Conversation

@isabella-janssen
Copy link
Copy Markdown
Member

@isabella-janssen isabella-janssen commented May 7, 2026

- What I did

- How to verify it

- Description for the changelog

Summary by CodeRabbit

  • New Features
    • Extension packages on CoreOS systems are now verified during node initialization. Nodes will not transition to the Done state if package validation fails.

isabella-janssen and others added 2 commits May 7, 2026 13:42
Resolves: OCPBUGS-65645

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@openshift-merge-bot
Copy link
Copy Markdown
Contributor

Pipeline controller notification
This repo 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. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: LGTM mode

@openshift-ci openshift-ci Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 7, 2026
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 7, 2026

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

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 7, 2026

Walkthrough

The changes add a first-boot extension package verification step to the CoreOS daemon's "Done" transition. Before completing the node update, the daemon now validates that all extension packages specified in the MachineConfig are present in the RPM database on EL-based systems, failing the transition if verification errors occur.

Changes

Extension Package Verification Gate

Layer / File(s) Summary
Extension Verification Implementation
pkg/daemon/update.go
New verifyExtensionPackages method validates that all extension packages from MachineConfig.Spec.Extensions are present in the RPM database on EL-based CoreOS variants. Maps configured extensions to expected package names, queries rpm -q for each, accumulates missing packages, and supports test failure injection via MCO_TEST_EXTENSION_FAILURE environment variable.
Done Transition Gate
pkg/daemon/daemon.go
Within updateConfigAndState, when the node reaches desired configuration before applying the resumed/Done logic, a conditional call to verifyExtensionPackages now gates the transition. Fails the Done transition if verification errors occur on CoreOS systems; non-EL nodes skip the check.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes


Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (1 error, 1 inconclusive)

Check name Status Explanation Resolution
Stable And Deterministic Test Names ❌ Error Test functions use dynamic test names via fmt.Sprintf("case#%d", idx) in 4 test cases, violating stable test name requirements. Replace fmt.Sprintf("case#%d", idx) with stable, descriptive test names. Add name field to test data structures instead.
Title check ❓ Inconclusive The title 'DNM - for testing OCPBUGS-65645' is vague and does not clearly summarize the main change; 'DNM' indicates a do-not-merge placeholder, and the phrasing does not convey the substantive functionality being added. Replace the title with a clear, descriptive summary of the main change, such as 'Verify extension packages are installed after reboot' to accurately reflect the core functionality being introduced.
✅ Passed checks (10 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
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.
Test Structure And Quality ✅ Passed No Ginkgo tests are modified in this PR. The custom check for Ginkgo test quality is not applicable since only production code changes (daemon.go, update.go) are included, no test files.
Microshift Test Compatibility ✅ Passed No new Ginkgo e2e tests are added in this PR. The changes are production code only (verifyExtensionPackages function), making the MicroShift compatibility check not applicable.
Single Node Openshift (Sno) Test Compatibility ✅ Passed No Ginkgo e2e tests are added in this PR. Changes are only to daemon implementation files (daemon.go and update.go), not to test files. The check for SNO compatibility is not applicable.
Topology-Aware Scheduling Compatibility ✅ Passed PR adds daemon-level extension verification on nodes. No scheduling constraints (affinity, nodeSelectors, replicas, PDBs) are introduced that would break SNO, Two-Node, or HyperShift topologies.
Ote Binary Stdout Contract ✅ Passed Code added is in machine-config-daemon, not OTE binary. Uses klog only (stderr). No fmt.Print or stdout writes. No contract violations detected.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed PR does not add Ginkgo e2e tests. It adds daemon implementation code and unit tests only. Custom check for Ginkgo test IPv6 compatibility is not applicable.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 7, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: isabella-janssen

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 added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 7, 2026
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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.

Inline comments:
In `@pkg/daemon/update.go`:
- Around line 1876-1891: The MCO_TEST_EXTENSION_FAILURE injection is only
checked inside the non-ExitCode==1 error branch so it never triggers on
successful rpm queries; after running exec.Command("rpm","-q",
pkg).CombinedOutput() (i.e., after obtaining out and err) move the
os.Getenv("MCO_TEST_EXTENSION_FAILURE") == "true" check out of the error-only
branch so it runs for the healthy path as well—if set, append "test-failing" to
missingPackages (and optionally klog.Warningf) before continuing; keep the
existing exitErr/ExitCode()==1 handling and the error return for other failures
unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 576b5f79-08d6-484b-acd5-b5ba4389ef55

📥 Commits

Reviewing files that changed from the base of the PR and between f9d91f6 and e718454.

📒 Files selected for processing (2)
  • pkg/daemon/daemon.go
  • pkg/daemon/update.go

Comment thread pkg/daemon/update.go
Comment on lines +1876 to +1891
out, err := exec.Command("rpm", "-q", pkg).CombinedOutput()
if err == nil {
continue
}
// Check if this is exit code 1 (package not installed) vs other errors
if errors.As(err, &exitErr) && exitErr.ExitCode() == 1 {
missingPackages = append(missingPackages, pkg)
klog.Warningf("Extension package %s not found in RPM database", pkg)
continue
}
if os.Getenv("MCO_TEST_EXTENSION_FAILURE") == "true" {
missingPackages = append(missingPackages, "test-failing")
}

// Other errors (execution failure, permission issues, etc.) should fail immediately
return fmt.Errorf("failed to query RPM database for package %q: %v: %s", pkg, err, strings.TrimSpace(string(out)))
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Test failure injection never triggers in the healthy path.

MCO_TEST_EXTENSION_FAILURE is only checked after rpm -q has already failed with a non-ExitCode()==1 error, so a normal successful verification can never be force-failed. If this hook is meant to exercise the new post-reboot guard, move the env-var check outside this error branch.

Suggested fix
 func (dn *CoreOSDaemon) verifyExtensionPackages(config *mcfgv1.MachineConfig) error {
 	// Only verify on RHCOS/SCOS nodes
 	if !dn.os.IsEL() {
 		return nil
 	}
+
+	if os.Getenv("MCO_TEST_EXTENSION_FAILURE") == "true" {
+		return fmt.Errorf("injected extension verification failure")
+	}
 
 	// Get the list of extensions from the config
 	extensions := config.Spec.Extensions
@@
-		if os.Getenv("MCO_TEST_EXTENSION_FAILURE") == "true" {
-			missingPackages = append(missingPackages, "test-failing")
-		}
-
 		// Other errors (execution failure, permission issues, etc.) should fail immediately
 		return fmt.Errorf("failed to query RPM database for package %q: %v: %s", pkg, err, strings.TrimSpace(string(out)))
 	}
🤖 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 `@pkg/daemon/update.go` around lines 1876 - 1891, The
MCO_TEST_EXTENSION_FAILURE injection is only checked inside the non-ExitCode==1
error branch so it never triggers on successful rpm queries; after running
exec.Command("rpm","-q", pkg).CombinedOutput() (i.e., after obtaining out and
err) move the os.Getenv("MCO_TEST_EXTENSION_FAILURE") == "true" check out of the
error-only branch so it runs for the healthy path as well—if set, append
"test-failing" to missingPackages (and optionally klog.Warningf) before
continuing; keep the existing exitErr/ExitCode()==1 handling and the error
return for other failures unchanged.

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. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant