Skip to content

Add operator payload builder scripts - #102

Open
jaypoulz wants to merge 1 commit into
openshift-eng:mainfrom
jaypoulz:jpoulin/operator-payload-builder
Open

Add operator payload builder scripts#102
jaypoulz wants to merge 1 commit into
openshift-eng:mainfrom
jaypoulz:jpoulin/operator-payload-builder

Conversation

@jaypoulz

@jaypoulz jaypoulz commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Build scripts for creating custom OCP payloads with operator image overrides. Allows testing custom operator code before merging upstream.

Features:

  • build-operators.sh: Build and push operator images to registry
  • ocp-create-payload: Create custom payload with operator overrides
  • Configurable operator profiles via operators.conf
  • Template files for user configuration

Summary by CodeRabbit

  • New Features

    • Added tools to build and publish customized operator images.
    • Added support for creating OpenShift payload images with operator overrides, configurable releases, registries, profiles, and deployment targets.
    • Added templates for operator build profiles and environment settings.
  • Documentation

    • Added comprehensive setup, configuration, usage, deployment, authentication, troubleshooting, and advanced workflow guidance for custom operator payloads.
    • Added an overview linking to the new operator payload builder.

@openshift-ci
openshift-ci Bot requested a review from eggfoobar August 6, 2026 22:36
@openshift-ci

openshift-ci Bot commented Aug 6, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jaypoulz

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 requested a review from jerpeter1 August 6, 2026 22:36
@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 6, 2026
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Adds an Operator Payload Builder with configuration templates, operator image build and push automation, custom OpenShift payload creation, validation, registry checks, deployment guidance, and troubleshooting documentation.

Changes

Operator payload workflow

Layer / File(s) Summary
Configuration and workflow documentation
helpers/operator-payload/profile.env.template, helpers/operator-payload/operators.conf.template, helpers/operator-payload/.gitignore, helpers/README.md, helpers/operator-payload/README.md
Adds environment and operator profile templates, ignores local configuration files, and documents the build and payload workflow.
Operator image build and push workflow
helpers/operator-payload/build-operators.sh
Adds configuration parsing, registry validation, command-line options, branch overrides, operator image builds and pushes, failure tracking, and final status reporting.
Custom payload creation
helpers/operator-payload/ocp-create-payload
Adds profile validation, base-release detection, operator image override construction, authentication checks, and oc adm release new execution.

Estimated code review effort: 4 (Complex) | ~45 minutes

Suggested reviewers: eggfoobar, jerpeter1

Sequence Diagram(s)

sequenceDiagram
  participant Operator
  participant build_operators as build-operators.sh
  participant Registry
  participant ocp_create_payload as ocp-create-payload
  participant OpenShift
  Operator->>build_operators: provide operator profiles and options
  build_operators->>Registry: validate access
  build_operators->>Registry: push operator images
  build_operators-->>Operator: report build results
  Operator->>ocp_create_payload: provide payload profiles and options
  ocp_create_payload->>Registry: verify authentication
  ocp_create_payload->>OpenShift: run oc adm release new with overrides
  OpenShift-->>Operator: return custom payload result
Loading

Caution

Pre-merge checks failed

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

  • Ignore

❌ Failed checks (2 errors, 2 warnings)

Check name Status Explanation Resolution
No-Sensitive-Data-In-Logs ❌ Error ocp-create-payload enables set -x and prints user-supplied release, target, namespace, and auth paths; build-operators.sh also logs repository paths and image refs that may contain internal hostnam... Remove set -x and avoid logging raw user/configuration values. Redact or omit repository paths, registry references, and authentication paths from normal and error output.
No-Injection-Vectors ❌ Error Both scripts source the user-controlled, gitignored profile.env directly, so arbitrary shell commands in configuration execute when the scripts start. Parse profile.env as allowlisted KEY=VALUE data without source/eval, then validate registry paths and image values before use.
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Ai-Attribution ⚠️ Warning The HEAD commit names Claude Sonnet 4.5 and uses a Co-Authored-By trailer; it has no Assisted-by or Generated-by trailer. Replace the AI Co-Authored-By trailer with the required Red Hat Assisted-by or Generated-by trailer, using the project-approved attribution format.
✅ Passed checks (7 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding scripts that build custom operator payloads.
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.
No-Weak-Crypto ✅ Passed The PR contains no MD5, SHA1, DES, RC4, Blowfish, ECB, custom crypto, or secret/token comparisons; auth is delegated to oc/podman registry tooling.
Container-Privileges ✅ Passed The PR adds scripts, documentation, and templates, not container or Kubernetes manifests; scans found no privileged, host namespace, SYS_ADMIN, allowPrivilegeEscalation, or root execution declarati...
No-Hardcoded-Secrets ✅ Passed The 942 added lines contain only credential placeholders, auth-file paths, and runtime token commands; no literal API keys, passwords, private keys, credential URLs, or long base64 secrets were found.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 11

🤖 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 `@helpers/operator-payload/build-operators.sh`:
- Around line 1-3: Replace the shebang in
helpers/operator-payload/build-operators.sh at lines 1-3 with #!/usr/bin/bash,
and make the same shebang change in helpers/operator-payload/ocp-create-payload
at lines 1-11.
- Around line 79-107: Rename the local variables in get_operator_config and
get_config within helpers/operator-payload/build-operators.sh (lines 79-107) to
meaningful uppercase names, updating every reference consistently. Apply the
same uppercase naming convention to config_file, current_section, profile, and
key in helpers/operator-payload/ocp-create-payload (lines 69-97), preserving
behavior.
- Around line 147-191: Update helpers/operator-payload/build-operators.sh lines
147-191 and its shebang to use /usr/bin/bash; honor default_branch when
branch_override is absent, and use an isolated worktree or restore the original
ref so every success and failure path leaves the repository checkout unchanged.
Keep the existing override behavior and cleanup handling intact.
helpers/operator-payload/operators.conf.template lines 5-27 requires no direct
change; it documents the default_branch configuration consumed by the build
script.
- Around line 253-275: Validate that each value-taking option has a following
argument and that the argument is not another option before reading or assigning
it. Update the option-parsing logic in
helpers/operator-payload/build-operators.sh for -n/--namespace and -t/--tag, and
in helpers/operator-payload/ocp-create-payload for -n, -t, -b, and -o; reject
missing or option-like values with the script’s existing usage/error behavior
while preserving valid parsing.
- Around line 222-238: Update both podman push invocations in the push block to
include --authfile="${auth_file}", preserving their existing verbose and tail
behavior. Also change the script shebang to #!/usr/bin/bash.

In `@helpers/operator-payload/ocp-create-payload`:
- Around line 24-29: Update the initialization flow in the payload script so
profile.env is sourced before deriving NAMESPACE, TAG, and DEFAULT_AUTH_FILE
from QUAY_NAMESPACE, IMAGE_TAG, and REGISTRY_AUTH_FILE. Preserve explicit
CLI-provided values by applying profile-derived defaults only when those options
were not already set, and keep TARGET_IMAGE behavior consistent with the
existing runtime defaults.

In `@helpers/operator-payload/profile.env.template`:
- Around line 1-2: Make the OCP_VERSION setting in profile.env.template
effective by updating ocp-create-payload to read and use it before automatic
release detection, allowing it to override the -b or SNO-derived release;
alternatively, remove the OCP_VERSION template entry so the configuration no
longer advertises an unsupported override.
- Around line 5-11: Quote the angle-bracket namespace placeholders in
helpers/operator-payload/profile.env.template lines 5-11 and the copyable Bash
block in helpers/operator-payload/README.md lines 63-74, including the
QUAY_NAMESPACE and TARGET_IMAGE assignments, so Bash treats them as literal
values rather than redirection syntax.

In `@helpers/operator-payload/README.md`:
- Around line 1-3: Add a Prerequisites section near the beginning of the README,
listing the required bash, git, podman, and oc tools, plus registry access and
write permission for the target namespace.
- Around line 98-102: Update the build-operators.sh workflow description in the
README to state that it always pushes each built image to the registry, unless
the script already supports a documented --no-push option; do not describe
pushing as optional without documenting that flag and its behavior.
- Around line 167-173: Update the podman login instructions in the README to
avoid passing the CI token through the -p argument; pipe the output of oc whoami
-t into podman login and use --password-stdin while preserving the existing
registry and authfile options.
🪄 Autofix

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 YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: dcb4171d-46f8-4153-9dd1-3b980a133a74

📥 Commits

Reviewing files that changed from the base of the PR and between e52b2a8 and 3e514b8.

📒 Files selected for processing (7)
  • helpers/README.md
  • helpers/operator-payload/.gitignore
  • helpers/operator-payload/README.md
  • helpers/operator-payload/build-operators.sh
  • helpers/operator-payload/ocp-create-payload
  • helpers/operator-payload/operators.conf.template
  • helpers/operator-payload/profile.env.template

Comment thread helpers/operator-payload/build-operators.sh Outdated
Comment thread helpers/operator-payload/build-operators.sh
Comment thread helpers/operator-payload/build-operators.sh
Comment thread helpers/operator-payload/build-operators.sh
Comment thread helpers/operator-payload/build-operators.sh
Comment on lines +1 to +2
# Base OCP release image (auto-detected from config_sno.sh or specify here)
# OCP_VERSION=registry.ci.openshift.org/ocp/release-5:5.0.0-0.nightly-2026-07-01-125918

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.

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Make OCP_VERSION effective or remove it.

The template states that OCP_VERSION can override the base release. ocp-create-payload only uses -b or the SNO configuration. It ignores OCP_VERSION.

Read OCP_VERSION before automatic release detection, or remove this setting from the template.

🤖 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 `@helpers/operator-payload/profile.env.template` around lines 1 - 2, Make the
OCP_VERSION setting in profile.env.template effective by updating
ocp-create-payload to read and use it before automatic release detection,
allowing it to override the -b or SNO-derived release; alternatively, remove the
OCP_VERSION template entry so the configuration no longer advertises an
unsupported override.

Comment thread helpers/operator-payload/profile.env.template Outdated
Comment thread helpers/operator-payload/README.md
Comment thread helpers/operator-payload/README.md Outdated
Comment thread helpers/operator-payload/README.md
@jaypoulz
jaypoulz force-pushed the jpoulin/operator-payload-builder branch 3 times, most recently from 57e8b4d to 8fab06c Compare August 7, 2026 18:50
Build scripts for creating custom OCP payloads with operator image overrides.
Allows testing custom operator code before merging upstream.

Features:
- build-operators.sh: Build and push operator images to registry
- ocp-create-payload: Create custom payload with operator overrides
- Configurable operator profiles via operators.conf
- Template files for user configuration

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Signed-off-by: Jeremy Poulin <jpoulin@redhat.com>
@jaypoulz
jaypoulz force-pushed the jpoulin/operator-payload-builder branch from 8fab06c to 3c1ff21 Compare August 7, 2026 19:05
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant