detached c8966e7

feat: replace docker push with native chunked registry push

commit
c8966e7cd8bd27b27c231d723bff39c2219915a8
author
brice · · 2026-03-14 14:08 UTC
parent
485dfa5
signature
unsigned
1 file · +7 -7
M internal/adapters/in/cli/push.go +7 -7
@@ -18,6 +18,7 @@ import (
1818 "github.com/bnema/gordon/internal/adapters/in/cli/ui/components"
1919 "github.com/bnema/gordon/internal/adapters/in/cli/ui/styles"
2020 "github.com/bnema/gordon/internal/domain"
21+ "github.com/bnema/gordon/pkg/registrypush"
2122 "github.com/bnema/gordon/pkg/validation"
2223 )
2324
@@ -473,9 +474,8 @@ func buildAndPush(ctx context.Context, version, platform, dockerfile string, bui
473474 }
474475
475476 // Build and load into local daemon (NOT --push).
476- // BuildKit's --push uses monolithic blob uploads that exceed
477- // Cloudflare's 100MB per-request limit. Loading locally then
478- // using docker push gives us chunked uploads (~5MB per request).
477+ // The native registry push client handles chunked uploads to stay
478+ // within Cloudflare's 100MB per-request limit.
479479 fmt.Println("\nBuilding image...")
480480 buildCmd := exec.CommandContext(ctx, "docker", buildImageArgs(ctx, version, platform, dockerfile, buildArgs, versionRef, latestRef)...) // #nosec G204
481481 buildCmd.Env = os.Environ() // VERSION is now passed as --build-arg VERSION=<value>
@@ -744,10 +744,10 @@ func dockerTag(ctx context.Context, src, dst string) error {
744744 }
745745
746746 func dockerPush(ctx context.Context, ref string) error {
747- cmd := exec.CommandContext(ctx, "docker", "push", ref) //nolint:gosec // binary is constant; image ref validated by OCI ref parser
748- cmd.Stdout = os.Stdout
749- cmd.Stderr = os.Stderr
750- return cmd.Run()
747+ pusher := registrypush.New(
748+ registrypush.WithProgress(os.Stderr),
749+ )
750+ return pusher.Push(ctx, ref)
751751 }
752752
753753 func dockerImageExists(ctx context.Context, image string) bool {
@@ -18,6 +18,7 @@ import (
18 "github.com/bnema/gordon/internal/adapters/in/cli/ui/components"18 "github.com/bnema/gordon/internal/adapters/in/cli/ui/components"
19 "github.com/bnema/gordon/internal/adapters/in/cli/ui/styles"19 "github.com/bnema/gordon/internal/adapters/in/cli/ui/styles"
20 "github.com/bnema/gordon/internal/domain"20 "github.com/bnema/gordon/internal/domain"
21+ "github.com/bnema/gordon/pkg/registrypush"
21 "github.com/bnema/gordon/pkg/validation"22 "github.com/bnema/gordon/pkg/validation"
22 )23 )
23 24
@@ -473,9 +474,8 @@ func buildAndPush(ctx context.Context, version, platform, dockerfile string, bui
473 }474 }
474 475
475 // Build and load into local daemon (NOT --push).476 // Build and load into local daemon (NOT --push).
476- // BuildKit's --push uses monolithic blob uploads that exceed477+ // The native registry push client handles chunked uploads to stay
477- // Cloudflare's 100MB per-request limit. Loading locally then478+ // within Cloudflare's 100MB per-request limit.
478- // using docker push gives us chunked uploads (~5MB per request).
479 fmt.Println("\nBuilding image...")479 fmt.Println("\nBuilding image...")
480 buildCmd := exec.CommandContext(ctx, "docker", buildImageArgs(ctx, version, platform, dockerfile, buildArgs, versionRef, latestRef)...) // #nosec G204480 buildCmd := exec.CommandContext(ctx, "docker", buildImageArgs(ctx, version, platform, dockerfile, buildArgs, versionRef, latestRef)...) // #nosec G204
481 buildCmd.Env = os.Environ() // VERSION is now passed as --build-arg VERSION=<value>481 buildCmd.Env = os.Environ() // VERSION is now passed as --build-arg VERSION=<value>
@@ -744,10 +744,10 @@ func dockerTag(ctx context.Context, src, dst string) error {
744 }744 }
745 745
746 func dockerPush(ctx context.Context, ref string) error {746 func dockerPush(ctx context.Context, ref string) error {
747- cmd := exec.CommandContext(ctx, "docker", "push", ref) //nolint:gosec // binary is constant; image ref validated by OCI ref parser747+ pusher := registrypush.New(
748- cmd.Stdout = os.Stdout748+ registrypush.WithProgress(os.Stderr),
749- cmd.Stderr = os.Stderr749+ )
750- return cmd.Run()750+ return pusher.Push(ctx, ref)
751 }751 }
752 752
753 func dockerImageExists(ctx context.Context, image string) bool {753 func dockerImageExists(ctx context.Context, image string) bool {

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 7

Tags 106

↑↓ moveenter openesc close