Skip to content

cli/command/image: move build-context detection to build - #6189

Merged
thaJeztah merged 1 commit into
docker:masterfrom
thaJeztah:cleanup_build_context
Jul 16, 2025
Merged

cli/command/image: move build-context detection to build#6189
thaJeztah merged 1 commit into
docker:masterfrom
thaJeztah:cleanup_build_context

Conversation

@thaJeztah

Copy link
Copy Markdown
Member

Besides the docker CLI, compose also uses this for the classic builder, so we need a place to put this; it's likely out of scope for the client itself, so we may as well put it here for now.

Removes direct imports of github.com/docker/docker/builder in the image package, to be moved later.

- Human readable description for the release notes

Go SDK: cli/command/image/build: add a `DetectContextType` utility to detect the type of build-context.

- A picture of a cute animal (not mandatory but encouraged)

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 21.73913% with 36 lines in your changes missing coverage. Please review.

Files with missing linesPatch %Lines
cli/command/image/build.go32.25%18 Missing and 3 partials ⚠️
cli/command/image/build/context_detect.go0.00%15 Missing ⚠️

📢 Thoughts on this report? Let us know!

@thaJeztah
thaJeztahforce-pushed the cleanup_build_context branch 2 times, most recently from 818a642 to 246be82CompareJuly 16, 2025 13:30
@thaJeztah
thaJeztah marked this pull request as ready for review July 16, 2025 13:31
@thaJeztahthaJeztah added this to the 29.0.0 milestone Jul 16, 2025

@vvolandvvoland left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

type ContextType string

const (
ContextTypeStdIn ContextType = "stdin" // ContextTypeStdIn indicates that the build-context is a TAR archive passed through STDIN.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: IMO StdIn looks weird and isn't consistent with the general naming (like os.Stdin).

Suggested change
ContextTypeStdInContextType="stdin"// ContextTypeStdIn indicates that the build-context is a TAR archive passed through STDIN.
ContextTypeStdinContextType="stdin"// ContextTypeStdin indicates that the build-context is a TAR archive passed through STDIN.

(just an opinion though)

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, yeah, can change; I always read its as standard-in / standard-out, standard-err, not as a single word, but Golang uses os.Stdin, so it makes sense to follow that.

Let me update.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done! Will merge when CI finishes.

Removes direct imports of github.com/docker/docker/builder in
the image package, to be moved later.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@thaJeztah
thaJeztahforce-pushed the cleanup_build_context branch from 246be82 to 260f1dbCompareJuly 16, 2025 13:50
@thaJeztah
thaJeztah merged commit b5a9392 into docker:masterJul 16, 2025
87 checks passed
@thaJeztah
thaJeztah deleted the cleanup_build_context branch July 16, 2025 13:58
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/builder/classic-builderarea/builderarea/go-sdkChanges affecting the Go SDKkind/refactorPR's that refactor, or clean-up codestatus/2-code-review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@thaJeztah@codecov-commenter@vvoland