8000 bake: allow override of list variables via environment by rrjjvv · Pull Request #3161 · docker/buildx · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

bake: allow override of list variables via environment #3161

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

rrjjvv
Copy link
Contributor
@rrjjvv rrjjvv commented Apr 29, 2025

Roughly speaking, if a bake variable is a list with uniform type, it can be overridden via environment variable. The environment variable must be a CSV string whose fields can be coerced to that of the list.

Resolves #3160

I decided to proactively create a PR (despite my original comments in the issue) since I thought it unlikely to be outright rejected (given it was marked as a TODO), and any feedback or requested changes might be easier and/or more productive alongside an actual proposed implementation with test cases.

The diff looks artificially large due to extracting the conversion logic into its own function. There's no obvious reason the primitives in a list should be processed differently than a primitive on its own, so I thought it'd be preferred to do the refactor rather than copy/pasting that logic into the new tuple/list branches. The actual functionality for the three primitives remains unchanged.

While not the longest in the file, my new test method is among the longest. I thought it more important to match the style of existing tests, using comments where I'd typically use a subtest. And speaking of tests, there was one integration test that did not pass for me on a pristine checkout. After my change, all existing test continue to pass except for that same one that failed prior to my change. It's definitely unrelated to my change and has the feel of something that a core maintainer might not see due to having a unique setup (or maybe using different procedures to build). Specifically,

require.True(t, semver.IsValid(version), "Second field was not valid semver: %+v", version)

If this isn't actually expected/anticipated, I'd be happy to dig and/or provide any other details you need.

Roughly speaking, if a bake variable is a list with uniform type, it can
 be overridden via environment variable.  The environment variable must
 be a CSV string whose fields can be coerced to that of the list.

Signed-off-by: Roberto Villarreal <rrjjvv@yahoo.com>
@rrjjvv
Copy link
Contributor Author
rrjjvv commented May 7, 2025

Closing in favor of #3167

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bake: allow override of list variables via environment
4 participants
0