Build CPO Image

Builds and pushes control-plane-operator container images for testing HyperShift changes on live clusters.

538|560|Updated Jan 18, 2021
One-click install
npx skills add https://github.com/openshift/hypershift --skill build-cpo-image
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Build CPO Image
Source: https://github.com/openshift/hypershift/tree/main/.claude/skills/dev/build-cpo-image
Command: npx skills add https://github.com/openshift/hypershift --skill build-cpo-image

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Testing changes to the HyperShift control-plane-operator requires a custom container image deployed to a live cluster, and manually managing tags, builds, and pushes is repetitive and error-prone.

Core Features & Use Cases

  • Image Build and Push: Builds the CPO image from Dockerfile.control-plane using podman or docker and pushes it to a configured registry.
  • Tag Management: Generates unique tags from branch names, commit hashes, or iteration counters to track successive fixes.
  • Iteration Workflow: Supports a tight loop of code change, image build, e2e test run, and result analysis until tests pass.
  • Use Case: After modifying code in control-plane-operator/, build and push an image tagged fix-1, run e2e tests against it, then iterate with fix-2 until the tests pass.

Quick Start

Source dev/claude-env.sh, then ask the assistant to build and push a CPO image with a descriptive tag for your current change.

Frequently Asked Questions about Build CPO Image

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I build a control-plane-operator image for HyperShift?

Build the CPO image with the container runtime using Dockerfile.control-plane, targeting linux/amd64, then push it to your registry. The Dockerfile compiles the control-plane-operator and control-plane-pki-operator binaries inside the container, so no local pre-build is needed.

How do I test CPO changes on a live HyperShift cluster?

Push a uniquely tagged CPO image to your registry, then run the e2e tests with that image tag in the test flags. Iterate by incrementing the tag, such as fix-1, fix-2, until the tests pass.

Does the CPO image build work with both podman and docker?

Yes, the build commands use the RUNTIME environment variable, which can be set to either podman or docker in dev/claude-env.sh. Both runtimes support the same build and push commands shown.

Why does the CPO image build fail?

Builds commonly fail when vendored dependencies are stale or the code does not compile. Run go mod vendor and verify compilation locally with make control-plane-operator before rebuilding the image.

Why is my pushed CPO image not used by the cluster?

Verify the image tag matches the e2e flags exactly and confirm the push succeeded. Also ensure the cluster can pull from the registry, which may require public access or registry authentication.