-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support extra build command args (#677)
Support extra build command args with new --extra-build-cli-args option.
- Loading branch information
Showing
8 changed files
with
107 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
.. _secret_passing: | ||
|
||
Passing Secrets | ||
=============== | ||
|
||
When creating an Execution Environment, it may be useful to use `build secrets <https://docs.docker.com/build/building/secrets/>`_. | ||
This can be done with a combination of the use of :ref:`additional_build_steps` within the EE definition file, and the | ||
:ref:`extra-build-cli-args` CLI option. | ||
|
||
Use the :ref:`extra-build-cli-args` CLI option to pass a build CLI argument that defines the secret: | ||
|
||
.. code:: | ||
ansible-builder build --extra-build-cli-args="--secret id=mytoken,src=my_secret_file.txt" | ||
Then, use a custom ``RUN`` command within your EE definition file that references this secret: | ||
|
||
.. code:: yaml | ||
--- | ||
version: 3 | ||
images: | ||
base_image: | ||
name: quay.io/centos/centos:stream9 | ||
additional_build_steps: | ||
prepend_base: | ||
- RUN --mount=type=secret,id=mytoken TOKEN=$(cat /run/secrets/mytoken) some_command | ||
options: | ||
skip_ansible_check: true |
This file contains 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
This file contains 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
This file contains 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
17 changes: 17 additions & 0 deletions
17
test/data/v3/extra_build_cli_args/execution-environment.yml
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
version: 3 | ||
|
||
additional_build_steps: | ||
prepend_base: | ||
- RUN --mount=type=secret,id=mytoken cat /run/secrets/mytoken | ||
|
||
images: | ||
base_image: | ||
name: quay.io/centos/centos:stream9 | ||
|
||
dependencies: | ||
python_interpreter: | ||
python_path: '/usr/libexec/platform-python' | ||
|
||
options: | ||
package_manager_path: '/bin/true' | ||
skip_ansible_check: true |
This file contains 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
This file contains 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