Conversation
hiroTamada
left a comment
There was a problem hiding this comment.
Looks good.
I personally dont like how we need to specify registry url. Should this be optional/default?
For hypeman run we try internal registry first and docker.io if registry name is not specified?
I agree. also it would be best if "hypeman push .." "hypeman pull ..." "hypeman run ..." are always consistent in whatever the user puts for the image name there. e.g. if I push by some name and that works then I should be able to run by that same name and it's running the image I just pushed |
DX Fixes Applied (ac17646)Addressed the consistency concerns raised by @sjmiller609. Here's what was wrong and what's fixed: Problem: Push / Run naming mismatchWhen you pushed an image via Fixes1. Strip registry host prefix on push (registry.go) The registry's manifest PUT handler was prepending
2. Backward-compat fallback in GetImage (images/manager.go) Added a fallback: if the normalized name isn't found, also try prepending the internal registry URL. This handles images that were stored with the old 3. Build Build results now return 4. Registry auth accepts user JWTs (middleware/oapi_auth.go)
5. Regenerated oapi code + added The Verified DX flowStill open
|
This comment has been minimized.
This comment has been minimized.
Build VM Networking Fixed (b2f5d1b)The build system now works end-to-end. Here's what was broken and what's fixed: Root cause: builder VMs couldn't reach the host registryThe builder VM was configured with
Fixes1. Registry URL rewriting for VMs (providers.go)
2. Proper BuildKit config in builder agent (builder_agent/main.go) Added 3. Multi-tenant iptables isolation (bridge.go) Changed iptables comments from generic 4. Registry auth path pattern fix (oapi_auth.go) Fixed 5. VM subnet auth fallback (oapi_auth.go)
Verified e2e flowBugbot responses
|
This comment has been minimized.
This comment has been minimized.
6f307c7 to
5dca4b0
Compare
✱ Stainless preview buildsThis PR will update the
|
|
Rebased onto main + addressed bugbot comment Bugbot: "Repo parsing breaks reserved path names"This is now a non-issue after rebasing. The base branch already switched from a regex to Rebase summaryRebased onto
All conflicts resolved carefully to preserve both sides' functionality. Builds and vets clean. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Bugbot Autofix prepared fixes for 2 of the 2 bugs found in the latest run.
Or push these changes by commenting: Preview (c3527c7dd6)diff --git a/lib/builds/manager.go b/lib/builds/manager.go
--- a/lib/builds/manager.go
+++ b/lib/builds/manager.go
@@ -622,14 +622,15 @@
if tag == "" {
tag = "latest"
}
- imageRef = req.ImageName
if _, err := m.imageManager.ImportLocalImage(buildCtx, repo, tag, result.ImageDigest); err != nil {
m.logger.Warn("failed to re-tag image", "build_id", id, "image_name", req.ImageName, "error", err)
// Don't fail the build - the image is still accessible via builds/{id}
} else {
m.logger.Info("re-tagged build image", "build_id", id, "from", buildRepo, "to", repo)
+ imageRef = req.ImageName
// Wait for the re-tagged image to be ready
- if err := m.waitForImageReady(buildCtx, repo); err != nil {
+ retaggedRef := repo + ":" + tag
+ if err := m.waitForImageReady(buildCtx, retaggedRef); err != nil {
m.logger.Warn("re-tagged image conversion timed out", "build_id", id, "image_name", req.ImageName, "error", err)
}
} |
Allows callers to specify a custom image name for build output. When set,
the image is pushed to {registry}/{image_name} instead of the default
{registry}/builds/{id} path. Propagated through CreateBuildRequest,
BuildConfig, builder agent, API multipart parsing, and OpenAPI spec.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
- Strip registry host prefix when storing pushed images so names are consistent between push and run (e.g., push "myapp" → stored as "docker.io/library/myapp:latest" → run "myapp" finds it) - Add fallback in GetImage to try internal registry prefix for backward compatibility with previously stored images - Build image_ref now returns short name (e.g., "mybuiltapp") instead of "localhost:8081/mybuiltapp" so it can be used directly with `run` - Allow regular user JWT tokens for registry /v2/ endpoints (enables `hypeman push` from CLI without special registry tokens) - Regenerate oapi code to include image_name field - Add `make run` target for running without live reload Co-authored-by: Cursor <[email protected]>
- Rewrite registry URL from localhost to gateway IP (10.101.0.1:8081) when configuring builder VMs, since localhost inside a VM refers to the VM itself, not the host - Add setupBuildKitConfig to builder agent: writes buildkitd.toml with http=true for the internal registry (fixes HTTPS connection failures) - Set DOCKER_CONFIG env var explicitly for buildctl to find credentials in rootlesskit user namespace - Fix registryPathPattern to support repository names with 3+ path segments (e.g., a/b/c) - addresses bugbot deep path concern - Pass subnet CIDR to JwtAuth middleware so VM IP-based auth fallback matches the actual configured subnet (was hardcoded to 10.102.x.x) - Use bridge-name-scoped iptables comments (e.g., hypeman-nat-vmbr-rgarcia) to prevent multi-tenant instances from overwriting each other's rules Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
- Fix registry_test.go: look up images by short repo name (without host prefix) to match how the registry stores them after the path-based storage change - Remove credential helper from builder_agent: auth is now handled server-side via anonymous guest tokens from the token endpoint - Token endpoint issues guest tokens for all anonymous scoped requests, enabling BuildKit mirror pulls and build pushes without client-side credentials - Update token tests to reflect new guest token behavior Co-authored-by: Cursor <[email protected]>
…name token scoping
- Revert token.go: remove guest tokens, restore original auth-required behavior
- Revert builder_agent: restore original Docker config.json auth setup (JWT as Basic auth)
- Revert token/auth tests to match original behavior
- Fix token scoping: always include builds/{id} in token (builder's push destination),
plus image_name repo when set
- Fix post-build flow: wait for builds/{id} then re-tag to image_name via ImportLocalImage
- Add extractImageTag helper for parsing tags from image names
The root cause was two bugs in the image_name implementation:
1. The registry JWT only granted push to image_name, but builder pushes to builds/{id}
2. waitForImageReady looked for image_name, but the image was stored as builds/{id}
Co-authored-by: Cursor <[email protected]>
…pers Remove stripImageTag and extractImageTag in favor of images.ParseNormalizedRef which already handles repo/tag splitting. Also drop speculative image_name repo from JWT since the builder never accesses it. Co-authored-by: Cursor <[email protected]>
… for readiness check
- Move `imageRef = req.ImageName` inside the success branch of
ImportLocalImage so metadata falls back to builds/{id} on failure
- Use `repo:tag` instead of just `repo` when calling waitForImageReady
so tagged images (e.g. myapp:v1.0) are checked correctly
Co-authored-by: Cursor <[email protected]>
…fallback - Remove --network=host from builder image docker build (not needed) - Remove registryURL fallback in images.GetImage — we don't need backward-compat lookups with host-prefixed names since this isn't in prod yet - Remove registryURL parameter from images.NewManager - Remove user JWT fallback for registry auth in middleware — main branch doesn't have it and it was added speculatively - Add back removed comment about WWW-Authenticate telling clients where to get a token - Fix comment about ImageName token behavior Co-authored-by: Cursor <[email protected]>
Tests were using the old pattern of registry-host-prefixed refs
(e.g., "localhost:5000/builds/{id}") but waitForImageReady now
takes the short repo name directly (e.g., "builds/{id}").
Co-authored-by: Cursor <[email protected]>
…en oapi - Remove unnecessary `var err error` in getImageByRef, use := instead - Revert lib/middleware/oapi_auth.go to main (no functional changes needed) - Regenerate lib/oapi/oapi.go to include image_name field after rebase Co-authored-by: Cursor <[email protected]>
51c86e7 to
e4389a3
Compare
- Revert 47 files that only had whitespace/fmt/import-order changes - Inline getImageByRef back into GetImage (no longer needed as separate method after removing the registryURL fallback) - PR now touches only 11 files with meaningful changes Co-authored-by: Cursor <[email protected]>
hiroTamada
left a comment
There was a problem hiding this comment.
clean design — builder stays simple (pushes to builds/{id}), server handles the re-tag. one minor nit on upfront validation.
Addresses review comment: validate image_name via ParseNormalizedRef
in the CreateBuild handler so users get an immediate 400 instead of
a successful build that silently falls back to builds/{id}.
Co-authored-by: Cursor <[email protected]>

Summary
image_nameparameter to the build system, allowing callers to specify a custom image name for build outputimage_nameis set, images are pushed to{registry}/{image_name}instead of the default{registry}/builds/{id}CreateBuildRequest,BuildConfig, builder agent output ref, API multipart form parsing, registry token scoping, and OpenAPI specTest plan
image_name— verify existingbuilds/{id}behavior unchangedimage_name=myapp— verify image pushed to{registry}/myapp🤖 Generated with Claude Code
Note
Medium Risk
Touches the build/registry image naming and readiness flow; mistakes could cause images to be stored under the wrong ref or builds to report ready before an image is usable.
Overview
Build creation now accepts an optional
image_nameparameter (API multipart + OpenAPI/OAPI types), validates it up front, and propagates it throughCreateBuildRequest/BuildConfig.Build completion flow is updated to always wait for conversion of
builds/{id}, then optionally re-tag the resulting digest to the requestedimage_nameviaImportLocalImageand (best-effort) wait for that tag to become ready; build metadataImageRefreflects the custom name only if re-tag succeeds.Registry/image handling is normalized to store and look up images by short repo name (no host prefix), updating conversion triggering, build/image wait logic, and associated tests;
providersalso rewritesRegistryURLwhen configured aslocalhost/127.0.0.1so builder VMs can reach the host registry. Adds amake runtarget for non-hot-reload execution.Written by Cursor Bugbot for commit 4f7d2bc. This will update automatically on new commits. Configure here.