Skip to content

fix: append '-base' to dev-mode image names to avoid overwriting cog build images#2802

Open
bfirsh wants to merge 2 commits intomainfrom
fix/base-image-name-suffix
Open

fix: append '-base' to dev-mode image names to avoid overwriting cog build images#2802
bfirsh wants to merge 2 commits intomainfrom
fix/base-image-name-suffix

Conversation

@bfirsh
Copy link
Copy Markdown
Contributor

@bfirsh bfirsh commented Mar 3, 2026

Summary

  • Dev-mode commands (cog serve, cog predict, cog run, cog train) now tag their ephemeral images with a -base suffix (e.g. cog-myproject-base) so they don't overwrite images built by cog build.
  • Renames the SkipLabels build option to BaseImageOnly, which better describes the intent of the flag.

Context

This was a regression introduced in 1525f7f (PR #2746) which removed the BuildBase() code path and BaseDockerImageName() helper as part of consolidating dev-mode builds to use Build(ExcludeSource=true). The -base suffix was originally introduced in 3b09bab (Jul 2021).

Changes

  • pkg/config/image_name.go — Restore BaseDockerImageName() which appends -base
  • pkg/model/options.go — Rename SkipLabelsBaseImageOnly; use BaseDockerImageName when BaseImageOnly is true
  • pkg/model/factory.go — Update call site for rename
  • pkg/image/build.go — Rename parameter skipLabelsbaseImageOnly
  • pkg/cli/serve.go — Update serveBuildOptions() for rename
  • pkg/config/image_name_test.go — Add tests for BaseDockerImageName
  • pkg/model/options_test.go — Add tests for dev-mode default image naming

…build images

Dev-mode commands (cog serve, predict, run, train) now tag their
ephemeral images with a '-base' suffix (e.g. 'cog-myproject-base')
so they don't overwrite images built by 'cog build'.

This was a regression introduced in 1525f7f (PR #2746) which removed
the BuildBase() code path and BaseDockerImageName() helper as part of
consolidating dev-mode builds to use Build(ExcludeSource=true).

Also renames the SkipLabels field to BaseImageOnly, which better
describes the intent of the flag.
@bfirsh bfirsh requested a review from a team as a code owner March 3, 2026 22:33
@michaeldwan michaeldwan added this to the 0.18.0 milestone Mar 5, 2026
Signed-off-by: Mark Phelps <209477+markphelps@users.noreply.github.com>
@ask-bonk
Copy link
Copy Markdown

ask-bonk bot commented Mar 31, 2026

I'm Bonk, and I've done a quick review of your PR.

This PR fixes a regression where dev-mode commands were overwriting images built by cog build by restoring the -base suffix and renaming SkipLabels to BaseImageOnly.

I found several issues that need to be addressed:

Critical: Lines 107, 299, and 303 in pkg/image/build.go still reference the old skipLabels variable name instead of the renamed baseImageOnly parameter. This will cause compilation errors.

Comments to update:

  • Line 81: Comment references skipLabels=true → should be baseImageOnly=true
  • Line 273: Comment references skipLabels → should be baseImageOnly
  • Lines 299-302: Comment references skipLabels → should be baseImageOnly

Please update all references from skipLabels to baseImageOnly to match the renamed parameter.

@ask-bonk
Copy link
Copy Markdown

ask-bonk bot commented Mar 31, 2026

Line-specific suggestions for pkg/image/build.go:

Line 81: Comment still uses skipLabels=true — should be baseImageOnly=true

Line 107: Code uses !skipLabels — will cause compilation error, should be !baseImageOnly

Line 273: Comment references skipLabels — should be baseImageOnly

Lines 299-303: Both comment and code use skipLabels — should be baseImageOnly throughout

@ask-bonk
Copy link
Copy Markdown

ask-bonk bot commented Mar 31, 2026

I've reviewed PR #2802 and identified several issues where the code and comments still reference the old skipLabels variable name instead of the renamed baseImageOnly parameter. I posted two comments on the PR:

  1. Line 107: Code uses !skipLabels — this will cause a compilation error
  2. Line 81: Comment references skipLabels=true — should be baseImageOnly=true
  3. Line 273: Comment references skipLabels — should be baseImageOnly
  4. Lines 299-303: Both comment and code use skipLabels — should all be baseImageOnly

The PR logic is sound, but these variable name references need to be updated for consistency and to avoid compilation failures.

github run

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.

3 participants