Skip to content

fix: skip adding labels to images for local-use commands (run/predict/serve/train)#2787

Merged
tempusfrangit merged 1 commit intomainfrom
fix/skip-labels-for-local-images
Feb 28, 2026
Merged

fix: skip adding labels to images for local-use commands (run/predict/serve/train)#2787
tempusfrangit merged 1 commit intomainfrom
fix/skip-labels-for-local-images

Conversation

@bfirsh
Copy link
Member

@bfirsh bfirsh commented Feb 28, 2026

Summary

  • Skip the expensive label-adding phase when building images for cog run, cog predict, cog serve, and cog train — these images are for local use only and don't need metadata labels
  • Adds SkipLabels option to BuildOptions that short-circuits before pip freeze, git info, base image layer inspection, and the extra Docker build step

Background

This was a regression introduced in 1525f7f (feat(coglet): IPC bridge enhancements) which replaced resolver.BuildBase() (no labels) with resolver.Build() (adds labels) for the serve/run/predict/train code paths. The original image.BuildBase() just built the Docker image and returned — no labels were added.

Changes

  • pkg/model/options.go — Add SkipLabels bool field to BuildOptions
  • pkg/cli/serve.go — Set SkipLabels: true in serveBuildOptions() (used by run/predict/serve/train)
  • pkg/image/build.go — Early return before label-adding when skipLabels is true
  • pkg/model/factory.go — Pass SkipLabels through to image.Build()

…/serve/train)

When running cog run, cog predict, cog serve, or cog train, the build
was unnecessarily adding Cog metadata labels to the image. This added
overhead (pip freeze, git info, base image layer inspection, extra
Docker build step) for images that are only used locally and never
distributed.

This was a regression introduced in 1525f7f which replaced
resolver.BuildBase() (no labels) with resolver.Build() (adds labels)
for the serve/run/predict/train code paths.

Adds a SkipLabels option to BuildOptions that short-circuits the
label-adding phase in image.Build() when set.
@bfirsh bfirsh requested a review from a team as a code owner February 28, 2026 00:30
@bfirsh bfirsh added this to the 0.17.0 Release milestone Feb 28, 2026
@tempusfrangit tempusfrangit merged commit 8b1c141 into main Feb 28, 2026
31 checks passed
@tempusfrangit tempusfrangit deleted the fix/skip-labels-for-local-images branch February 28, 2026 00:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants