Skip to content

OCPBUGS-100315: Fix baremetal registry and pull secret after #1922 - #1937

Open
tusharjadhav3302 wants to merge 1 commit into
openshift-metal3:masterfrom
tusharjadhav3302:fix-baremetal-registry-creds-without-mirror
Open

OCPBUGS-100315: Fix baremetal registry and pull secret after #1922#1937
tusharjadhav3302 wants to merge 1 commit into
openshift-metal3:masterfrom
tusharjadhav3302:fix-baremetal-registry-creds-without-mirror

Conversation

@tusharjadhav3302

@tusharjadhav3302 tusharjadhav3302 commented Jul 29, 2026

Copy link
Copy Markdown

Summary

Fixes two regressions introduced by #1922 where the early exit 0 in
02_configure_host.sh for NODES_PLATFORM=baremetal skipped both local
registry setup and REGISTRY_CREDS file creation.

Problems fixed

1. Baremetal without mirroring (MIRROR_IMAGES unset)

write_pull_secret() in utils.sh unconditionally merged REGISTRY_CREDS
(private-mirror-ocp.json), causing:

jq: error: Could not open file /home/zuul/private-mirror-ocp.json: No such file or directory

Affects ShiftStack/RHOSO CI jobs on real baremetal hardware.

2. Baremetal with mirroring (MIRROR_IMAGES=true)

The local registry at port 5000 never starts, causing 04_setup_ironic.sh
to fail with "connection refused" when mirroring release images.
Affects virtual-baremetal CI using sushy-emulator (e.g. RHOSO uni04delta-ipv6 jobs).

Changes

02_configure_host.sh — registry setup in baremetal early-exit path

  • use_registry "podman": starts registry, creates REGISTRY_CREDS via podman login
  • use_registry "" (quay): starts registry
  • No registry: creates empty {} authfile for write_pull_secret() compatibility
  • Mirrors the existing pattern in the libvirt path (lines 471–487)

utils.sh — conditional REGISTRY_CREDS merge in write_pull_secret()

  • Guards REGISTRY_CREDS merge behind use_registry "" check
  • When mirroring is disabled: merges personal pull secret + CI registry token only
  • Applies to both OPENSHIFT_CI=true and the standard CI_TOKEN code paths

Root cause

#1922 assumed baremetal deployments never need a local registry. This is
true for "real" baremetal (standalone provisioning hosts pulling from
external registries), but not for:

  • Virtual-baremetal setups using MIRROR_IMAGES=true
  • Any baremetal path where write_pull_secret() is called without mirroring

Test plan

  • NODES_PLATFORM=baremetal, MIRROR_IMAGES unset: empty authfile created,
    write_pull_secret() succeeds without registry
  • NODES_PLATFORM=baremetal, MIRROR_IMAGES=true: registry starts,
    oc adm release mirror succeeds
  • NODES_PLATFORM=libvirt: no behavior change (early-exit block not reached)
  • Verified against ShiftStack RHOSO CI job failure on serval70 (2026-07-28)

Related

@openshift-ci
openshift-ci Bot requested review from cybertron and sadasu July 29, 2026 05:40
@openshift-ci

openshift-ci Bot commented Jul 29, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign andfasano 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

openshift-ci Bot commented Jul 29, 2026

Copy link
Copy Markdown

Hi @tusharjadhav3302. Thanks for your PR.

I'm waiting for a openshift-metal3 member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@openshift-ci openshift-ci Bot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jul 29, 2026
@tusharjadhav3302

Copy link
Copy Markdown
Author

@pfontani this is a follow-up to #1922 — would appreciate your review

@tusharjadhav3302

Copy link
Copy Markdown
Author

ci-framework has a workaround merged (openstack-k8s-operators/ci-framework#4078) that pre-creates the empty file. This PR fixes the root cause in dev-scripts itself so other consumers are not affected.

@fonta-rh fonta-rh 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.

Thanks for such a quick fix. I'd update the "quay" to "" if possible, to make it clearer that we're looking for a non-registry condition. It does work, though, I think, so it's not a blocker. Approving all the same (just informative, I don't have permissions)

Comment thread 02_configure_host.sh Outdated

# Other scripts may read REGISTRY_CREDS even when local registry mirroring
# is disabled; ensure a valid empty authfile exists before the early return.
if ! use_registry "quay"; then

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.

Are you using "quay" here because that's what is on the libvirt path? I think this works but it might be a little clearer if we also use "" like in utils.sh (there's nothing special about quay here, it's just not podman, I think). This also catches "podman" registry, which might not matter but it might also be unintended

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@fonta-rh
Updated to use_registry "" to match the guard in utils.sh.
Thanks for the review.

@tusharjadhav3302
tusharjadhav3302 force-pushed the fix-baremetal-registry-creds-without-mirror branch from 85f8453 to fe210fd Compare July 29, 2026 08:10
@dtantsur

Copy link
Copy Markdown
Member

/ok-to-test

@openshift-ci openshift-ci Bot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jul 29, 2026
@tusharjadhav3302

Copy link
Copy Markdown
Author

/retest

2 similar comments
@tusharjadhav3302

Copy link
Copy Markdown
Author

/retest

@tusharjadhav3302

Copy link
Copy Markdown
Author

/retest

@tusharjadhav3302
tusharjadhav3302 force-pushed the fix-baremetal-registry-creds-without-mirror branch from fe210fd to a4a05ad Compare July 30, 2026 11:25
@tusharjadhav3302 tusharjadhav3302 changed the title Fix missing REGISTRY_CREDS on baremetal without local registry Fix baremetal registry and pull secret after #1922 Jul 30, 2026
@imatza-rh

Copy link
Copy Markdown

/lgtm

@openshift-ci

openshift-ci Bot commented Jul 30, 2026

Copy link
Copy Markdown

@imatza-rh: changing LGTM is restricted to collaborators

Details

In response to this:

/lgtm

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.

@mkowalski

Copy link
Copy Markdown
Member

/retitle OCPBUGS-100315: Fix baremetal registry and pull secret after #1922

@openshift-ci openshift-ci Bot changed the title Fix baremetal registry and pull secret after #1922 OCPBUGS-100315: Fix baremetal registry and pull secret after #1922 Jul 30, 2026
@rebtoor

rebtoor commented Jul 30, 2026

Copy link
Copy Markdown

/retest-required

@mkowalski

Copy link
Copy Markdown
Member

One possible gap in the MIRROR_IMAGES=true baremetal case: registry DNS resolution.

In the libvirt path, an /etc/hosts entry for LOCAL_REGISTRY_DNS_NAME (default virthost.<cluster>.<domain>) is added before the podman login (02_configure_host.sh lines ~478–480), but that code sits after the baremetal exit 0, and the baremetal configure_dnsmasq() only adds api/ingress VIP records. So in the new baremetal block, podman login ${LOCAL_REGISTRY_DNS_NAME}:${LOCAL_REGISTRY_PORT} and the subsequent release-image mirroring in 04_setup_ironic.sh may fail on name resolution — unless the affected CI jobs already export a resolvable LOCAL_REGISTRY_DNS_NAME.

Suggest adding the /etc/hosts entry to the baremetal block too, e.g. before the use_registry checks:

sudo sed -i "/${LOCAL_REGISTRY_DNS_NAME}/d" /etc/hosts
echo "${PROVISIONING_HOST_EXTERNAL_IP} ${LOCAL_REGISTRY_DNS_NAME}" | sudo tee -a /etc/hosts

(and possibly a dnsmasq host record so cluster nodes can resolve the mirror as well).


This message was generated using AI. Please verify before acting on it.
Assisted-By: Claude Fable 5

PR openshift-metal3#1922 introduced NODES_PLATFORM=baremetal support for agent-based
installs but left gaps in the early-exit path of 02_configure_host.sh:

1. LOCAL_REGISTRY_DNS_NAME (default virthost.<cluster>.<domain>) has
   no /etc/hosts entry. The libvirt path adds this at line ~480, but
   that code sits after the `exit 0` and never runs for baremetal
   deployments. Without it, podman login and release-image mirroring
   fail on name resolution.

2. When MIRROR_IMAGES=true the local registry is not started and no
   podman login creates the authfile, causing downstream scripts to
   fail reading REGISTRY_CREDS.

3. write_pull_secret() unconditionally merges REGISTRY_CREDS into
   the combined pull secret even when no local registry is
   configured, injecting a blank or stale authfile.

Add the same sed+tee /etc/hosts pattern from the libvirt path,
set up the local registry and authfile when mirroring is enabled,
and gate the REGISTRY_CREDS merge in write_pull_secret() behind
use_registry checks.

Signed-off-by: tusharjadhav3302 <tjadhav@redhat.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@tusharjadhav3302
tusharjadhav3302 force-pushed the fix-baremetal-registry-creds-without-mirror branch from a4a05ad to 31e0472 Compare July 31, 2026 10:57
@tusharjadhav3302

Copy link
Copy Markdown
Author

One possible gap in the MIRROR_IMAGES=true baremetal case: registry DNS resolution.

In the libvirt path, an /etc/hosts entry for LOCAL_REGISTRY_DNS_NAME (default virthost.<cluster>.<domain>) is added before the podman login (02_configure_host.sh lines ~478–480), but that code sits after the baremetal exit 0, and the baremetal configure_dnsmasq() only adds api/ingress VIP records. So in the new baremetal block, podman login ${LOCAL_REGISTRY_DNS_NAME}:${LOCAL_REGISTRY_PORT} and the subsequent release-image mirroring in 04_setup_ironic.sh may fail on name resolution — unless the affected CI jobs already export a resolvable LOCAL_REGISTRY_DNS_NAME.

Suggest adding the /etc/hosts entry to the baremetal block too, e.g. before the use_registry checks:

sudo sed -i "/${LOCAL_REGISTRY_DNS_NAME}/d" /etc/hosts
echo "${PROVISIONING_HOST_EXTERNAL_IP} ${LOCAL_REGISTRY_DNS_NAME}" | sudo tee -a /etc/hosts

(and possibly a dnsmasq host record so cluster nodes can resolve the mirror as well).

This message was generated using AI. Please verify before acting on it. Assisted-By: Claude Fable 5

Added /etc/hosts entry to the baremetal block

@mkowalski

Copy link
Copy Markdown
Member

If I understand correctly, failure of e2e-metal-ipi-ovn-bgp-virt-ipv4 is now a signal for this PR. Can we run this job with this change and see if it brings the green result?

@openshift-ci

openshift-ci Bot commented Jul 31, 2026

Copy link
Copy Markdown

@tusharjadhav3302: The following tests 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/e2e-agent-5control-ipv4 31e0472 link false /test e2e-agent-5control-ipv4
ci/prow/e2e-metal-ipi-virtualmedia 31e0472 link false /test e2e-metal-ipi-virtualmedia

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

ok-to-test Indicates a non-member PR verified by an org member that is safe to test.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants