Building EEs with environment variables
Ansible Builder version 3 schema provides the option to specify environment variables that can be used in the build process. See version 3 schema for more details.
In the example below, we will take a look at specifying ENV variables.
---
version: 3
images:
base_image:
name: quay.io/centos/centos:stream9
dependencies:
python_interpreter:
package_system: python39
python_path: /usr/bin/python3.9
ansible_core:
package_pip: ansible-core==2.14.0
ansible_runner:
package_pip: ansible-runner==2.3.2
additional_build_steps:
prepend_base:
- ENV FOO=bar
- RUN echo $FOO > /tmp/file1.txt
In this example, we are specifying an environment variable that may be required for the build process.
In order to achieve this functionality we are using the ENV variable
definition in the prepend_base
step of the additional_build_steps section.
We can use the same environment variable in the later stage of the build process.
See also
- Execution Environment Definition version 3.
The detailed documentation about EE definition version 3