diff --git a/roles/build-diskimage/README.rst b/roles/build-diskimage/README.rst index f05016426..7d292b365 100644 --- a/roles/build-diskimage/README.rst +++ b/roles/build-diskimage/README.rst @@ -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" diff --git a/roles/build-diskimage/defaults/main.yaml b/roles/build-diskimage/defaults/main.yaml index d72daf9ce..635ff1870 100644 --- a/roles/build-diskimage/defaults/main.yaml +++ b/roles/build-diskimage/defaults/main.yaml @@ -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: {} diff --git a/roles/build-diskimage/tasks/main.yaml b/roles/build-diskimage/tasks/main.yaml index 6a0973941..5e4781255 100644 --- a/roles/build-diskimage/tasks/main.yaml +++ b/roles/build-diskimage/tasks/main.yaml @@ -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 }}" diff --git a/test-playbooks/diskimage-builder/build-diskimage.yaml b/test-playbooks/diskimage-builder/build-diskimage.yaml index f8d6f07bd..cf0471f34 100644 --- a/test-playbooks/diskimage-builder/build-diskimage.yaml +++ b/test-playbooks/diskimage-builder/build-diskimage.yaml @@ -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