-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[build] Add DOCKER_USER_ENV option #16904
base: master
Are you sure you want to change the base?
Conversation
/azp help |
Supported commands
See additional documentation. |
/azp run |
Commenter does not have sufficient privileges for PR 16904 in repo sonic-net/sonic-buildimage |
/azp run |
Commenter does not have sufficient privileges for PR 16904 in repo sonic-net/sonic-buildimage |
@@ -348,6 +348,11 @@ ifneq ($(SIGNING_CERT),) | |||
endif | |||
endif | |||
|
|||
# Allow user-defined environmental variables to be imported into the build containers | |||
ifneq ($(DOCKER_USER_ENV),) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about using SONIC_BUILDER_EXTRA_CMDLINE to add the additional options?
sonic-buildimage/Makefile.work
Line 304 in 7c3a063
$(SONIC_BUILDER_EXTRA_CMDLINE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it looks like SONIC_BUILDER_EXTRA_CMDLINE
works for our use case. You can close this PR if you don't think it adds further value
Why I did it
To enable users to pass environmental variables into the SONiC build containers, especially values that cannot be safely written to disk, like authentication tokens.
The
DOCKER_USER_ENV
parameter supports any format allowed by Docker's-e
flag. Values can be set explicitly or inherited from the host environment. For example, both of these are valid:Work item tracking
How I did it
The optional Makefile parameter,
DOCKER_USER_ENV
, accepts comma-separated values to be passed as-e
arguments to the$(DOCKER_RUN)
call. This is the environmental variable equivalent of theDOCKER_BUILDER_USER_MOUNT
parameter.How to verify it
Build the
sonic-slave-bash
pseudotarget and check the environmental variables set inside of the build container(s):Which release branch to backport (provide reason below if selected)
Tested branch (Please provide the tested image version)
Description for the changelog
Enable users to pass environmental variables into the SONiC build containers
Link to config_db schema for YANG module changes
n/A
A picture of a cute animal (not mandatory but encouraged)