All skills
openshift avatar

/build-ho-image

@cfb745e official
by openshiftopenshift/hypershift543 stars
576

Build and push hypershift-operator container image. Auto-applies when testing HO changes that require deploying to a live cluster.

Use this Skill: https://skilld.dev/gh/openshift/hypershift/build-ho-image

This session only. Nothing lands on disk.

SKILL.md

≈37 tokens always: the name and description. ≈761 when used: this file.

Build HyperShift-Operator Image

This skill enables building and pushing custom hypershift-operator (HO) images for testing changes in a live HyperShift environment.

When to Use This Skill

This skill automatically applies when:

  • You've made changes to code in hypershift-operator/
  • You need to test HO changes against a live cluster
  • The user asks to build/push a HO image
  • You need to iterate on HO fixes with e2e tests

Prerequisites

Source the environment file before using this skill:

source dev/claude-env.sh

Image Registry Configuration

Environment variables from dev/claude-env.sh:

Variable Description
HO_IMAGE_REPO Container registry for HO images
RUNTIME Container runtime (podman/docker)

Building the HO Image

Step 1: Generate a Unique Tag

Use a tag that identifies the change (branch name, feature, or timestamp):

# Option 1: Use branch name
TAG=$(git rev-parse --abbrev-ref HEAD | tr '/' '-')

# Option 2: Use short commit hash
TAG=$(git rev-parse --short HEAD)

# Option 3: Use descriptive name + number for iterations
TAG="feature-name-1"

Step 2: Build the Image

The HO image uses the main Dockerfile:

$RUNTIME build -f Dockerfile --platform linux/amd64 -t $HO_IMAGE_REPO:$TAG .

Note: The build runs make hypershift, make hypershift-operator, make karpenter-operator, and make product-cli inside the container.

Step 3: Push the Image

$RUNTIME push $HO_IMAGE_REPO:$TAG

Quick One-Liner

Build and push in one command:

TAG="my-fix-1" && $RUNTIME build -f Dockerfile --platform linux/amd64 -t $HO_IMAGE_REPO:$TAG . && $RUNTIME push $HO_IMAGE_REPO:$TAG

Iteration Workflow

When iterating on HO fixes:

  1. Make code changes in hypershift-operator/
  2. Build and push image with incremented tag (e.g., fix-1, fix-2, fix-3)
  3. Reinstall HyperShift with new image
  4. Run e2e test or manual validation
  5. Analyze results
  6. Repeat until test passes

What Gets Built

The main Dockerfile builds:

  • hypershift CLI binary
  • hypershift-no-cgo binary
  • hypershift-operator binary
  • karpenter-operator binary
  • hcp (product CLI) binary

All are included in the final image.

Troubleshooting

Build Fails

  • Check that vendored dependencies are up to date: go mod vendor
  • Ensure code compiles locally: make hypershift-operator
  • Check for API generation issues: make api

Push Fails

  • Verify registry login: $RUNTIME login quay.io
  • Check repository permissions

Operator Not Running After Install

  • Check operator logs: kubectl logs -n hypershift deployment/operator
  • Verify image pull succeeded: kubectl describe pod -n hypershift -l app=operator
  • Ensure cluster can pull from registry

Changes Not Reflected

  • Make sure you're using the correct image tag
  • Check if old pods are still running: kubectl get pods -n hypershift
  • Force rollout: kubectl rollout restart deployment/operator -n hypershift

Source: SKILL.md on GitHub

No alerts3mo3 checks · Risk SAFE
  • Gen Agent Trust Hub3mo

    This skill provides a standard developer workflow for building and pushing HyperShift-Operator container images. It uses common tools like container runtimes (Podman/Docker), Git, and Make, following best practices for local environment configuration.

  • Socket3mo

    No alerts

  • Snyk3mo

    Risk: LOW · No issues

Signed by skilld at cfb745e. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub yesterday.

Activeupdated 8 months ago
  • hypershift
  • container-image
  • docker
  • podman
  • kubernetes
  • operator
  • openshift
  • build

README badge

README badge for openshift/hypershift/build-ho-image

Builds and pushes a custom hypershift-operator container image for testing code changes against a live HyperShift cluster. Automates the container build process (which compiles the operator binary, CLI tools, and related binaries) and image push, with a workflow for iterating on fixes via e2e tests.

Generated from the current SKILL.md.

Does this skill work with Docker and Podman?
Yes. The skill uses the `$RUNTIME` environment variable from `dev/claude-env.sh`, which can be set to either docker or podman.
What binaries are included in the built image?
The image includes hypershift, hypershift-no-cgo, hypershift-operator, karpenter-operator, and hcp (product CLI) binaries.
Do I need to source the environment file before using this skill?
Yes. You must source `dev/claude-env.sh` before building, as it sets `HO_IMAGE_REPO` and `RUNTIME`.
What should I do if the operator pod is not running after pushing a new image?
Check operator logs with `kubectl logs -n hypershift deployment/operator`, verify image pull with `kubectl describe pod`, and force a rollout restart with `kubectl rollout restart deployment/operator -n hypershift`.
What platforms does the build support?
The build is configured for linux/amd64 via the `--platform` flag in the Dockerfile build command.

Generated from the current SKILL.md. These answers refresh after source changes.