feat: add Shipwright in-cluster build support to setup-k8s.sh#148
Open
moonlight16 wants to merge 3 commits into
Open
feat: add Shipwright in-cluster build support to setup-k8s.sh#148moonlight16 wants to merge 3 commits into
moonlight16 wants to merge 3 commits into
Conversation
Adds deploy/knative/setup-shipwright-build.sh plus templated Build manifests so anyone on a Kubernetes cluster with Shipwright installed can build the harness/sandbox images in-cluster and feed the resulting refs straight into setup-k8s.sh --image/--sandbox-image, instead of needing a local Docker daemon or pushing over the internet. Assisted-By: Claude (Anthropic AI) <noreply@anthropic.com> Signed-off-by: Jeremy Cohn <Jeremy.Cohn@ibm.com>
… name Live-cluster testing showed that reusing the hardcoded "serverless-harness" Build object name silently overwrote an existing Build's revision/output image. Default the Build name to include --tag (serverless-harness-<tag>) so a test run with a different tag can't collide with an existing Build, add --build-name to target a specific Build on purpose, and warn before overwriting a Build whose revision/output differs from what this run would set. Assisted-By: Claude (Anthropic AI) <noreply@anthropic.com> Signed-off-by: Jeremy Cohn <Jeremy.Cohn@ibm.com>
--build-name combined with --with-sandbox produced identical harness/ sandbox Build names instead of acting as a prefix, contradicting its own help text. Sandbox now gets "-sandbox" appended. warn_if_build_exists_with_different_spec swallowed all kubectl errors as "no existing Build" via `2>/dev/null || return 0`, and used grep substring matching on raw JSON that produces false negatives on plausible inputs (e.g. v2.1.0 vs 2.1.0). Now distinguishes real kubectl errors from NotFound, and compares exact jsonpath-extracted fields instead of substrings. Assisted-By: Claude (Anthropic AI) <noreply@anthropic.com> Signed-off-by: Jeremy Cohn <Jeremy.Cohn@ibm.com>
Member
Author
|
Note on the failing
Remediation (a dependency bump, |
moonlight16
marked this pull request as ready for review
July 22, 2026 18:06
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Background
The Kind and OpenShift setup paths each have a way to get images built for the
cluster —
setup-kind.shbuilds locally andkind loads them, andsetup-ocp.shcan lean on OpenShift's built-in
oc new-build. The generic Kubernetes path added in#142 (
setup-k8s.sh) consumes prebuilt image refs via--image/--sandbox-image,since vanilla Kubernetes has no standard in-cluster build system to build them for you.
This PR adds an in-cluster build option for that path, using
Shipwright: a small driver script that builds the harness
(and optionally sandbox) image straight from a git branch to a registry the cluster
can already reach — no local Docker daemon and nothing pushed over the internet — and
prints the resulting image refs ready to hand to
setup-k8s.sh. It's opt-in andchanges nothing for users who already build their images elsewhere.
What's included
deploy/knative/setup-shipwright-build.sh— driver script that creates a ShipwrightBuild+BuildRun, waits for it to complete, and printsHARNESS_IMAGE=/SANDBOX_IMAGE=lines that feed directly into
setup-k8s.sh --image/--sandbox-image.Buildmanifests underdeploy/knative/shipwright/(build-harness.yaml,build-sandbox.yaml).deploy/knative/README-k8s.mdwith usage instructions and where this fitsalongside the local-build path.
the Shipwright
Buildobject's name (serverless-harness), so re-running it couldsilently overwrite an existing Build of the same name and clobber its config. Fixed by
deriving the default Build name from
--tag(e.g.serverless-harness-<tag>), adding--build-nameto opt into targeting a specific existing Build on purpose, and warningbefore overwriting a Build whose spec differs from what the current run would set.
--build-name, when combined with--with-sandbox, produced identical harness/sandboxBuild names instead of acting as a prefix; and the guard's existence check swallowed real
kubectl errors as "no existing Build" and used unreliable substring matching. Fixed both.
Test plan
This is a draft PR — code review and live-cluster testing (including a re-verification
pass of the latest fix) are complete. Remaining before marking ready: the user's own final
review.
harness image in-cluster via
setup-shipwright-build.sh.commit above).
--build-namenow produces distinct harness/sandbox Build names, the guard warns ona genuine revision/image mismatch, does not false-positive on an idempotent re-run,
and does not misreport a not-yet-created Build as an error. Production
Build/serverless-harnessandBuild/serverless-harness-sandboxwere unchangedthroughout, and all test objects were cleaned up afterward.
Assisted-By: Claude (Anthropic AI) noreply@anthropic.com