pkg build: add env var support for mirror, org, builder image and config#4205
Merged
justincormack merged 1 commit intolinuxkit:masterfrom Mar 12, 2026
Merged
Conversation
Introduce environment variables for key CI/CD flags so that self-hosted
runners (e.g. GitHub Actions) can configure registry mirrors and push
targets without modifying calling Makefiles:
- LINUXKIT_MIRROR - equivalent to --mirror (space/comma-separated);
CLI flags take precedence (last SetProxy wins)
- LINUXKIT_PKG_ORG - equivalent to --org for all pkg subcommands
- LINUXKIT_BUILDER_IMAGE - equivalent to --builder-image
- LINUXKIT_BUILDER_CONFIG - equivalent to --builder-config
All env var constants are consolidated in pkg_build.go alongside the
existing LINUXKIT_CACHE, LINUXKIT_BUILDER_NAME, LINUXKIT_BUILDERS.
Priority for all: CLI flag > env var > built-in default
Adds a new Environment Variables section to docs/packages.md with a
reference table covering all LINUXKIT_* vars and a note explaining the
two-layer mirror configuration required in CI (linuxkit pulls vs
buildkit Dockerfile pulls).
Signed-off-by: Roman Shaposhnik <[email protected]>
Signed-off-by: Mikhail Malyshev <[email protected]>
2a95152 to
666bbfd
Compare
7 tasks
justincormack
approved these changes
Mar 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds environment variable equivalents for four flags that are commonly needed when running linuxkit on CI/CD self-hosted runners with private registry mirrors, so callers (e.g.
makein downstream projects) don't need to be modified to pass these flags explicitly.LINUXKIT_MIRROR--mirrorLINUXKIT_PKG_ORG--orgpkgsubcommandsLINUXKIT_BUILDER_IMAGE--builder-imagepkg buildLINUXKIT_BUILDER_CONFIG--builder-configpkg buildPriority: CLI flag > env var > built-in default (consistent with existing
LINUXKIT_CACHE,LINUXKIT_BUILDER_NAME,LINUXKIT_BUILDERS).LINUXKIT_MIRRORaccepts the same format as--mirror([registry=]url), as a space- or comma-separated list. Env var entries are prepended to CLI-provided entries so that the finalSetProxycall for a given registry key comes from the CLI flag, giving it precedence.LINUXKIT_BUILDER_IMAGEandLINUXKIT_BUILDER_CONFIGuse the existingflagOverEnvVarOverDefaultStringhelper (same pattern asLINUXKIT_BUILDER_NAME).Test plan
go build ./...passesgo test -mod=vendor ./...passes (all existing tests green)LINUXKIT_MIRROR=docker.io=http://mymirrorand verify linuxkit routes pulls through the mirrorLINUXKIT_PKG_ORG=myorgand verifylinuxkit pkg show-tagreflects the org overrideLINUXKIT_BUILDER_IMAGEand verify the builder container uses the specified image🤖 Generated with Claude Code