You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
... the documentation does not mention anything about my problem
... there are no open or closed issues that are related to my problem
Description
When defining a variable with a default value coming from the environment, bake will always take the value from the environment variable even if another bake file defines an override. The only way for the override to be used is for the environment variable to be entirely absent (setting it to an empty value is not enough)
Expected behaviour
The override should take precedence over the default value
That looks like expected behavior with the correct order of precedence. Configuration passed in from env and flags overrides the config loaded from files. If you worry about collisions, you should define a more unique name, eg. BUILDX_MYAPP_IMAGE_NAME. If you don't want your arg to be set from environment then don't define "variable" block and only define the attribute in the hcl definition.
I see. I think I see where the confusion came from for me: reading the use environment variable as default documentation, I had understood that for an environment variable to be used, the bake variable default value had to be set to the name of an environment variable.
Doing more testing, I realised that I was wrong.
Setting the default value of a bake variable to an environment variable name doesn't seem to have much effect in itself.
What does, seem to be that the environment variable name has to match the bake variable name and the attribute is defined with a variable block:
Contributing guidelines
I've found a bug and checked that ...
Description
When defining a variable with a default value coming from the environment, bake will always take the value from the environment variable even if another bake file defines an override. The only way for the override to be used is for the environment variable to be entirely absent (setting it to an empty value is not enough)
Expected behaviour
The override should take precedence over the default value
Actual behaviour
the value from the environment variable is used
Buildx version
github.com/docker/buildx v0.14.0 171fcbe
Docker info
Builders list
Configuration
Build logs
No response
Additional info
No response
The text was updated successfully, but these errors were encountered: