Skip to content

OCPBUGS-68350: In OCB to check when a image is removed the old build is triggered again and the MC should start updating directly and no new MOSB should be triggred#6150

Open
eric200428 wants to merge 2 commits into
openshift:mainfrom
eric200428:OCPBUG-6835
Open

OCPBUGS-68350: In OCB to check when a image is removed the old build is triggered again and the MC should start updating directly and no new MOSB should be triggred#6150
eric200428 wants to merge 2 commits into
openshift:mainfrom
eric200428:OCPBUG-6835

Conversation

@eric200428
Copy link
Copy Markdown
Contributor

@eric200428 eric200428 commented Jun 5, 2026

-Problem
When a MachineOSBuild (MOSB) image is deleted from the registry and automatically rebuilt, reapplying the same MachineConfig (MC) incorrectly triggers a new MOSB instead of directly updating the
MachineConfigPool (MCP) with the rebuilt image. The expected behavior is that the MCP should update immediately using the existing rebuilt MOSB without creating an unnecessary new build.

- What I did
Add an early check in reconcilePoolChange to skip builds when the rendered MachineConfig hasn't changed. Allowing the MachineConfigPool to update directly with the existing rebuilt image

- How to verify it
Steps:

  1. Apply MOSC and wait for MOSB-1 to complete
  2. Apply MC and wait for MOSB-2 and MCP to complete
  3. Delete the MOSB-1 image tag from the registry
  4. Delete the MC
  5. Wait for MOSB-1 to automatically re-trigger and complete
  6. Re-apply the same MC

Expected:

  • MCP should update directly (no MOSB-3 created)
  • Check logs for: "pool : Configuration unchanged (), no action needed"
  • Only 2 MOSBs should exist (MOSB-1 and MOSB-2)

- Description for the changelog
Fixed an issue where reapplying an unchanged MachineConfig would incorrectly trigger a new MachineOSBuild after an image rebuild. The MachineConfigPool now updates directly when the rendered configuration hasn't changed, preventing unnecessary builds.

Summary by CodeRabbit

  • Bug Fixes
    • Avoids redundant reconciliation steps when a machine configuration is unchanged and a current build marker is present, preventing unnecessary build-triggering logic and improving overall efficiency and stability.

Signed-off-by: Eric <ebragg@redhat.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-robot openshift-ci-robot added jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. labels Jun 5, 2026
@openshift-ci-robot
Copy link
Copy Markdown
Contributor

@eric200428: This pull request references Jira Issue OCPBUGS-68350, which is valid. The bug has been moved to the POST state.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (5.0.0) matches configured target version for branch (5.0.0)
  • bug is in the state New, which is one of the valid states (NEW, ASSIGNED, POST)

Requesting review from QA contact:
/cc @sergiordlr

The bug has been updated to refer to the pull request using the external bug tracker.

Details

In response to this:

-Problem
When a MachineOSBuild (MOSB) image is deleted from the registry and automatically rebuilt, reapplying the same MachineConfig (MC) incorrectly triggers a new MOSB instead of directly updating the
MachineConfigPool (MCP) with the rebuilt image. The expected behavior is that the MCP should update immediately using the existing rebuilt MOSB without creating an unnecessary new build.

- What I did
Add an early check in reconcilePoolChange to skip builds when the rendered MachineConfig hasn't changed. Allowing the MachineConfigPool to update directly with the existing rebuilt image

- How to verify it
Steps:

  1. Apply MOSC and wait for MOSB-1 to complete
  2. Apply MC and wait for MOSB-2 and MCP to complete
  3. Delete the MOSB-1 image tag from the registry
  4. Delete the MC
  5. Wait for MOSB-1 to automatically re-trigger and complete
  6. Re-apply the same MC

Expected:

  • MCP should update directly (no MOSB-3 created)
  • Check logs for: "pool : Configuration unchanged (), no action needed"
  • Only 2 MOSBs should exist (MOSB-1 and MOSB-2)

- Description for the changelog
Fixed an issue where reapplying an unchanged MachineConfig would incorrectly trigger a new MachineOSBuild after an image rebuild. The MachineConfigPool now updates directly when the rendered configuration hasn't changed, preventing unnecessary builds.

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 openshift-eng/jira-lifecycle-plugin repository.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 5, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Enterprise

Run ID: dcaee4c1-9bc8-44fe-8f80-918391391241

📥 Commits

Reviewing files that changed from the base of the PR and between ce58f78 and 23696fb.

📒 Files selected for processing (1)
  • pkg/controller/build/reconciler.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • pkg/controller/build/reconciler.go

Walkthrough

Adds an early-return in reconcilePoolChange: when the pool's rendered configuration name is unchanged and the current-build annotation is present, the function logs at verbosity 4 and returns nil, skipping MachineOSBuild trigger/reuse logic.

Changes

Rendered Configuration Change Detection

Layer / File(s) Summary
Early return for unchanged rendered config
pkg/controller/build/reconciler.go
reconcilePoolChange now detects when the rendered configuration name is unchanged and returns early before trigger-point logic, preventing unnecessary MachineOSBuild reconciliation.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Suggested reviewers

  • umohnani8
🚥 Pre-merge checks | ✅ 5 | ❌ 10

❌ Failed checks (10 inconclusive)

Check name Status Explanation Resolution
Stable And Deterministic Test Names ❓ Inconclusive Repository clone failed, so this custom check could not run with code access. Retry the review run. If this persists, inspect pre-merge custom-check logs for infrastructure or agent runtime failures.
Test Structure And Quality ❓ Inconclusive Repository clone failed, so this custom check could not run with code access. Retry the review run. If this persists, inspect pre-merge custom-check logs for infrastructure or agent runtime failures.
Microshift Test Compatibility ❓ Inconclusive Repository clone failed, so this custom check could not run with code access. Retry the review run. If this persists, inspect pre-merge custom-check logs for infrastructure or agent runtime failures.
Single Node Openshift (Sno) Test Compatibility ❓ Inconclusive Repository clone failed, so this custom check could not run with code access. Retry the review run. If this persists, inspect pre-merge custom-check logs for infrastructure or agent runtime failures.
Topology-Aware Scheduling Compatibility ❓ Inconclusive Repository clone failed, so this custom check could not run with code access. Retry the review run. If this persists, inspect pre-merge custom-check logs for infrastructure or agent runtime failures.
Ote Binary Stdout Contract ❓ Inconclusive Repository clone failed, so this custom check could not run with code access. Retry the review run. If this persists, inspect pre-merge custom-check logs for infrastructure or agent runtime failures.
Ipv6 And Disconnected Network Test Compatibility ❓ Inconclusive Repository clone failed, so this custom check could not run with code access. Retry the review run. If this persists, inspect pre-merge custom-check logs for infrastructure or agent runtime failures.
No-Weak-Crypto ❓ Inconclusive Repository clone failed, so this custom check could not run with code access. Retry the review run. If this persists, inspect pre-merge custom-check logs for infrastructure or agent runtime failures.
Container-Privileges ❓ Inconclusive Repository clone failed, so this custom check could not run with code access. Retry the review run. If this persists, inspect pre-merge custom-check logs for infrastructure or agent runtime failures.
No-Sensitive-Data-In-Logs ❓ Inconclusive Repository clone failed, so this custom check could not run with code access. Retry the review run. If this persists, inspect pre-merge custom-check logs for infrastructure or agent runtime failures.
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: an early return when rendered config is unchanged and annotation is present, preventing unnecessary MOSB creation. However, the title is grammatically awkward with typos ('triggred' instead of 'triggered') and awkwardly phrased, making it less clear than it could be.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

Tools execution failed with the following error:

Failed to run tools: 13 INTERNAL: Received RST_STREAM with code 2 (Internal server error)


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented Jun 5, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: eric200428
Once this PR has been reviewed and has the lgtm label, please assign yuqi-zhang for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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-robot
Copy link
Copy Markdown
Contributor

@eric200428: This pull request references Jira Issue OCPBUGS-68350, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (5.0.0) matches configured target version for branch (5.0.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, POST)

Requesting review from QA contact:
/cc @sergiordlr

Details

In response to this:

-Problem
When a MachineOSBuild (MOSB) image is deleted from the registry and automatically rebuilt, reapplying the same MachineConfig (MC) incorrectly triggers a new MOSB instead of directly updating the
MachineConfigPool (MCP) with the rebuilt image. The expected behavior is that the MCP should update immediately using the existing rebuilt MOSB without creating an unnecessary new build.

- What I did
Add an early check in reconcilePoolChange to skip builds when the rendered MachineConfig hasn't changed. Allowing the MachineConfigPool to update directly with the existing rebuilt image

- How to verify it
Steps:

  1. Apply MOSC and wait for MOSB-1 to complete
  2. Apply MC and wait for MOSB-2 and MCP to complete
  3. Delete the MOSB-1 image tag from the registry
  4. Delete the MC
  5. Wait for MOSB-1 to automatically re-trigger and complete
  6. Re-apply the same MC

Expected:

  • MCP should update directly (no MOSB-3 created)
  • Check logs for: "pool : Configuration unchanged (), no action needed"
  • Only 2 MOSBs should exist (MOSB-1 and MOSB-2)

- Description for the changelog
Fixed an issue where reapplying an unchanged MachineConfig would incorrectly trigger a new MachineOSBuild after an image rebuild. The MachineConfigPool now updates directly when the rendered configuration hasn't changed, preventing unnecessary builds.

Summary by CodeRabbit

  • Bug Fixes
  • Eliminated unnecessary reconciliation operations when machine configuration remains unchanged, improving system efficiency.

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 openshift-eng/jira-lifecycle-plugin repository.

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/controller/build/reconciler.go`:
- Around line 1393-1397: The early-return that checks if oldRendered ==
newRendered must not run when missingAnnotation is true; update the logic around
the oldRendered/newRendered comparison to first evaluate missingAnnotation (or
move the missingAnnotation assignment earlier) and only return early when
oldRendered == newRendered AND missingAnnotation is false so the code still
proceeds to the build creation/continue path when missingAnnotation is true
(refer to the variables oldRendered, newRendered, missingAnnotation and the
subsequent build creation/continue logic in this reconciler function).
🪄 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: 4345e3c2-140f-4d45-be70-d0942d96d51f

📥 Commits

Reviewing files that changed from the base of the PR and between dc8e496 and ce58f78.

📒 Files selected for processing (1)
  • pkg/controller/build/reconciler.go

Comment thread pkg/controller/build/reconciler.go
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented Jun 5, 2026

@eric200428: 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/unit 23696fb link true /test unit

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.

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

Labels

jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants