From ee92553c222608b9b933cfabeebdca506a0863fb Mon Sep 17 00:00:00 2001 From: Mario Varas Date: Sun, 4 Aug 2024 17:16:35 +0200 Subject: [PATCH] [ISV-5091] Add extra parameters variable to podman build command Signed-off-by: Mario Varas --- .../build_app_registry/defaults/main.yml | 2 ++ .../roles/build_app_registry/tasks/main.yml | 23 ++++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/upstream/roles/build_app_registry/defaults/main.yml b/upstream/roles/build_app_registry/defaults/main.yml index c3e5d726a..654aef6f7 100644 --- a/upstream/roles/build_app_registry/defaults/main.yml +++ b/upstream/roles/build_app_registry/defaults/main.yml @@ -3,6 +3,7 @@ testing_bin_path: "{{ work_dir }}/bin" opm_bin_path: "{{ testing_bin_path }}/opm" bundle_export_dir_app_registry: "{{ work_dir }}/app_registry/upstream-community-operators" container_tool: "docker" +container_tool_extra_params: "" opm_container_tool: "docker" opm_container_tool_index: "docker" container_push_extra: "" @@ -12,3 +13,4 @@ app_registry_build_dir: "{{ catalog_repo_dir }}" app_registry_build_file: "upstream.Dockerfile" default_retries: 5 default_delay: 10 +optimize_build_storage: false diff --git a/upstream/roles/build_app_registry/tasks/main.yml b/upstream/roles/build_app_registry/tasks/main.yml index 1dfd697c0..53858afec 100644 --- a/upstream/roles/build_app_registry/tasks/main.yml +++ b/upstream/roles/build_app_registry/tasks/main.yml @@ -58,8 +58,29 @@ - name: "Building and pushing app registry" block: + - name: "Setting up optimized container tool storage configuration" + shell: | + sudo mkdir -p /mnt/storage /mnt/rundir /mnt/tmp + sudo chown "$(id -u):$(id -g)" /mnt/storage /mnt/rundir + sudo chmod 1777 /mnt/tmp + sudo chmod 1777 /mnt/rundir + sudo chmod 1777 /mnt/storage + export TMPDIR=/mnt/tmp + export STORAGE_DRIVER=overlay + cat <<__EOF__ >/usr/share/containers/storage.conf + [storage] + graphroot = "/mnt/storage" + driver = "overlay" + runroot = "/mnt/rundir" + __EOF__ + cat <<__EOF__ | sudo tee /etc/containers/containers.conf + [engine] + env = ["TMPDIR=/mnt/tmp"] + __EOF__ + when: optimize_build_storage|bool == true + - name: "Build app registry image '{{ app_registry_image }}' using '{{ app_registry_build_file }}'" - shell: "{{ container_tool }} build --no-cache -t {{ app_registry_image }} -f {{ app_registry_build_dir }}/{{ app_registry_build_file }} {{ bundle_export_dir_app_registry | dirname }}" + shell: "{{ container_tool }} build {{ container_tool_extra_params }} --no-cache -t {{ app_registry_image }} -f {{ app_registry_build_dir }}/{{ app_registry_build_file }} {{ bundle_export_dir_app_registry | dirname }}" - name: "Push app registry image '{{ app_registry_image }}'" shell: "{{ container_tool }} push {{ container_push_extra }} {{ app_registry_image }}"