Skip to content

feat: add RHCOS/OCP URL auto-resolution, checksum validation, and pre-release enforcement - #27

Merged
sudeeshjohn merged 2 commits into
IBM:mainfrom
sudeeshjohn:feat/ocp-rhcos-url-handling
Aug 3, 2026
Merged

feat: add RHCOS/OCP URL auto-resolution, checksum validation, and pre-release enforcement#27
sudeeshjohn merged 2 commits into
IBM:mainfrom
sudeeshjohn:feat/ocp-rhcos-url-handling

Conversation

@sudeeshjohn

Copy link
Copy Markdown
Collaborator

Summary

Extends the URL resolution and download pipeline for RHCOS images and OCP client binaries with integrity checking, smarter auto-resolution, and pre-release safety guardrails.

Changes

types/types.go

  • Add ChecksumURL field to RHCOSURLs so users can explicitly pin a checksum manifest URL under rhcos_images

cmd/root.go

  • Auto-resolve rhcos_images.checksum_url alongside kernel/initramfs/rootfs when rhcos_images is omitted (uses the same major.minor/latest/ base path on mirror.openshift.com)
  • Skip all URL auto-resolution for pre-release versions (ec, rc, candidate, nightly, alpha, beta) that have no stable mirror path — validation will enforce explicit user-provided URLs
  • Gate oc-mirror auto-resolver behind air-gapped + managed registry + non-ci so the ~500 MB binary is only downloaded when it will actually be used

services/downloader.go

  • Fetch the RHCOS sha256sum.txt manifest before downloading images and verify each image's hash, matching the integrity flow already in place for OCP client binaries

validation/validator.go

  • Emit clear, actionable error messages when required URLs are missing and the version is a pre-release, directing the user to provide them explicitly under ocp_client_config / rhcos_images

cmd/createtemplate.go

  • Hide the rhcos_images comment block in generated configs when --boot agent is used (Agent installer handles RHCOS dynamically)
  • Show the ocp_mirror_client override line only when --isolation-level air-gapped + managed registry + non-ci release — i.e. only when oc-mirror will actually be invoked

Behaviour matrix

Scenario OCP URLs RHCOS URLs oc-mirror
Standard connected, official Auto-resolved Auto-resolved + checksum verified Not downloaded
Air-gapped, managed registry, official Auto-resolved Auto-resolved + checksum verified Downloaded
Air-gapped, managed registry, ci Auto-resolved Auto-resolved + checksum verified Not downloaded
Pre-release version (any) User must provide User must provide Not downloaded
boot_method: agent Auto-resolved Skipped (not needed) Conditional

@sudeeshjohn
sudeeshjohn requested a review from mkumatag July 18, 2026 05:02
…-release enforcement

- Add ChecksumURL to RHCOSURLs; auto-resolve all RHCOS URLs (including
  checksum) from mirror.openshift.com when rhcos_images is omitted
- Verify RHCOS image integrity via sha256sum manifest before each download
- Skip URL auto-resolution for pre-release versions (ec, rc, candidate,
  nightly); require explicit URLs with actionable validation errors
- Gate oc-mirror download behind air-gapped + managed-registry + non-ci
- Hide rhcos_images block in generated config for agent boot
- Show ocp_mirror_client override only when oc-mirror is actually needed

Signed-off-by: SUDEESH JOHN <sudeeshjohn@in.ibm.com>
@sudeeshjohn
sudeeshjohn force-pushed the feat/ocp-rhcos-url-handling branch from c97543e to 610770c Compare July 22, 2026 04:49

@Karthik-K-N Karthik-K-N left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nothing major few questions and I think we can have used URLs and Constants in a file to better readibility.

Comment thread cmd/root.go Outdated
Comment thread cmd/root.go Outdated
Comment thread cmd/root.go Outdated
- Add utils/utils.go with three shared helpers:
    Contains(slice, item)       – replaces three identical copies in
                                  orchestrator, services/registry, cmd/scale
    IsValidVersion(version)     – validates MAJOR.MINOR.PATCH[‑suffix] format
    IsPreReleaseVersion(version)– moved from validator.go and cmd/root.go

- Remove duplicated contains() from orchestrator/orchestrator.go,
  services/registry.go, and cmd/scale.go; update all call sites to
  utils.Contains()

- Remove duplicated isPreReleaseVersion() from cmd/root.go and
  validation/validator.go; update all call sites to
  utils.IsPreReleaseVersion()

- Extract seven ppc64le mirror URL format strings in cmd/root.go into
  named constants (mirrorClientFmt, mirrorInstallerFmt, etc.) so the
  base path is defined once and easy to update

- Add openshift.version format validation in validateOpenShift():
  reject strings that do not match MAJOR.MINOR.PATCH[‑suffix] with a
  clear error message before any mirror-URL resolution runs

- Add debug logging in orchestrator when the interface alias check
  (ip addr show) fails and when the workspace-parent directory cannot
  be read; both previously silently returned without any trace

Signed-off-by: SUDEESH JOHN <sudeeshjohn@in.ibm.com>
@sudeeshjohn
sudeeshjohn requested review from Karthik-K-N and removed request for mkumatag August 3, 2026 05:31

@Karthik-K-N Karthik-K-N left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

/lgtm

Thank you.

@sudeeshjohn
sudeeshjohn merged commit 3762c45 into IBM:main Aug 3, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants