Skip to content

feat(boil): Support for per-image build arguments - #1603

Merged
Techassi merged 5 commits into
mainfrom
feat/boil-per-image-build-arguments
Aug 18, 2026
Merged

feat(boil): Support for per-image build arguments#1603
Techassi merged 5 commits into
mainfrom
feat/boil-per-image-build-arguments

Conversation

@Techassi

@Techassi Techassi commented Aug 18, 2026

Copy link
Copy Markdown
Member

I noticed in #1600 that we need to copy+paste many build arguments (with the same value) across versions of the same image in the boil-config files. In order to make this easier, it is now possible to specify a shared list of build arguments which apply to all versions of a single image.

# Set it here once instead of having to set it for every version individually below.
[build-arguments]
golang-version = "1.26.0"

# Version 1.12.3
[versions."1.12.3".local-images]
stackable-devel = "1.0.0"
vector = "0.55.0"

# Version 1.16.2
[versions."1.16.2".local-images]
stackable-devel = "1.0.0"
vector = "0.55.0"

The arguments can be overwritten on a per-version basis if needed.

@Techassi Techassi self-assigned this Aug 18, 2026
@dervoeti
dervoeti self-requested a review August 18, 2026 14:11

@dervoeti dervoeti left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This feature currently doesn't allow overwriting the value on a per version level.

We need this to be in this PR I'd say because currently overwriting makes the build fail:

head -n13 opa/boil-config.toml
[metadata.registries]
"oci.stackable.tech" = { namespace = "sdp" }

[build-arguments]
golang-version = "9.9.9"

# Version 1.12.3
[versions."1.12.3".local-images]
stackable-devel = "1.0.0"
vector = "0.55.0"

[versions."1.12.3".build-arguments]
golang-version = "1.26.0"
cargo boil build opa=1.12.3
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.11s
     Running `target/debug/boil build opa=1.12.3`
[+] Building 0.0s (1/1) FINISHED                                                                                                                                                     docker:default
 => [internal] load local bake definitions                                                                                                                                                     0.0s
 => => reading from stdin 4.64kB                                                                                                                                                               0.0s
-.json:1
--------------------
   1 | >>>
--------------------
ERROR: -.json:1,987-1003: Duplicate object attribute; An attribute named "GOLANG_VERSION" was already defined at -.json:1,961-977.
Error: failed to run build command

Which is probably even better than silently ignoring it, but I would still include that functionality in this PR already.

Cool feature though, makes the boil configs more readable 🙂

Comment thread rust/boil/src/core/bakefile.rs Outdated
This improves and simplifies the build argument internals by using
a BTreeMap instead of a BTreeSet. Keys and values are now properly
separated and thus a map can be used with all the obvious benefits.
These benefits include automatic de-duplication of keys allowing
overrides at different levels of hierarchy (eg. per-image shared
build arguments vs per-version ones). It additionally removes
wrapper code which was only needed to forward implementations of
the inner type through the newtype.
@Techassi

Techassi commented Aug 18, 2026

Copy link
Copy Markdown
Member Author

We need this to be in this PR I'd say because currently overwriting makes the build fail

Your wish has been granted in 1b0ce2d :)

Co-authored-by: Lukas Krug <lukas.voetmand@stackable.tech>
@Techassi
Techassi marked this pull request as ready for review August 18, 2026 14:43
@Techassi Techassi moved this to Development: Waiting for Review in Stackable Engineering Aug 18, 2026
@NickLarsenNZ
NickLarsenNZ requested a review from dervoeti August 18, 2026 14:50
dervoeti
dervoeti previously approved these changes Aug 18, 2026

@dervoeti dervoeti left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Change itself LGTM, two optional things:

  • Update README.md
  • The build arguments in the global config (src/config.rs) should probably get
    #[serde(default, deserialize_with = "docker::deserialize_args")] as well

@Techassi

Techassi commented Aug 18, 2026

Copy link
Copy Markdown
Member Author

Both very valid points. On it!

EDIT: Both addressed in a5ccbd2 and 6e856bc.

@Techassi
Techassi requested a review from dervoeti August 18, 2026 15:19
@Techassi Techassi moved this from Development: Waiting for Review to Development: In Review in Stackable Engineering Aug 18, 2026

@dervoeti dervoeti left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ship it

@Techassi
Techassi added this pull request to the merge queue Aug 18, 2026
@Techassi Techassi moved this from Development: In Review to Development: Done in Stackable Engineering Aug 18, 2026
Merged via the queue into main with commit 770e4a1 Aug 18, 2026
8 checks passed
@Techassi
Techassi deleted the feat/boil-per-image-build-arguments branch August 18, 2026 15:39
@lfrancke lfrancke moved this from Development: Done to Done in Stackable Engineering Aug 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

3 participants