Merge "Add build_diskimage_environment role variable"

This commit is contained in:
Zuul 2024-08-27 16:57:44 +00:00 committed by Gerrit Code Review
commit f28d8f70d4
4 changed files with 16 additions and 2 deletions

View File

@ -1,7 +1,12 @@
Role for building images using diskimage-builder.
Diskimage-builder and diskimage elements can be configured by passing
corresponding settings as environment variables to this role.
corresponding settings as environment variables to this role, or using
the ``build_diskimage_environment`` variable.
By default the `build-disk-image` command does not print its output to stdout,
but only to a log file in the configured log directory. To additionally log to
stdout, set `DIB_QUIET: 0` in `build_diskimage_environment`.
Example:
@ -37,6 +42,13 @@ Example:
List of elements that should be used when creating the disk image.
.. zuul:rolevar:: build_diskimage_environment
:type: dict
Environment variables for the diskimage builder command may be
supplied using this variable (or by directly using the Ansible
``environment`` argument).
.. zuul:rolevar:: build_diskimage_image_root
:default: "{{ ansible_user_dir }}/dib-images"

View File

@ -11,3 +11,4 @@ build_diskimage_image_root: "{{ ansible_user_dir }}/dib-images"
build_diskimage_logs_dir: "{{ ansible_user_dir }}/zuul-output/logs"
build_diskimage_retry_limit: 0
build_diskimage_retry_delay: 120
build_diskimage_environment: {}

View File

@ -12,6 +12,7 @@
{{ build_diskimage_elements | mandatory | join(' ') }}
args:
chdir: "{{ build_diskimage_image_root }}"
environment: "{{ build_diskimage_environment }}"
register: build_diskimage_result
until: build_diskimage_result is not failed
retries: "{{ build_diskimage_retry_limit }}"

View File

@ -5,7 +5,7 @@
build_diskimage_image_name: foo-ubuntu-image
build_diskimage_formats: ["qcow2"]
build_diskimage_elements: ["vm", "ubuntu"]
environment:
build_diskimage_environment:
DIB_RELEASE: "noble"
tasks:
- name: Gather image file info