From d818e930b28f77487a77104601775ea5e3c58790 Mon Sep 17 00:00:00 2001 From: Rafael Guterres Jeffman Date: Fri, 19 Jul 2024 23:28:24 -0300 Subject: [PATCH] fixup! rjeffman: this is a fixup for infra/images/build.sh --- infra/image/build.sh | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/infra/image/build.sh b/infra/image/build.sh index 9964026d1..09d70c948 100755 --- a/infra/image/build.sh +++ b/infra/image/build.sh @@ -34,7 +34,8 @@ EOF name="ansible-test" hostname="ipaserver.test.local" -cpus="2" +# Number of cpus is not available in usptream CI (Ubuntu 22.04). +# cpus="2" memory="4g" REBUILD="Y" INSTALL="Y" @@ -72,9 +73,15 @@ container_state="$(podman ps -q --all --format "{{.State}}" --filter "name=${nam if [ "${REBUILD}" == "Y" ] || [ -z "${container_state}" ] then - log info "= Cleanup possible existing ${DISTRO} =" - podman image rm "${DISTRO}" --force - echo + # in older (as in Ubuntu 22.04) podman versions, + # 'podman image rm --force' fails if the image + # does not exist. + if podman image exist "${DISTRO}" + then + log info "= Cleanup possible existing ${DISTRO} =" + podman image rm "${DISTRO}" --force + echo + fi log info "= Building ${DISTRO} =" podman build -t "${DISTRO}" -f "${BASEDIR}/dockerfile/${DISTRO}" \ @@ -84,7 +91,7 @@ then log info "= Creating ${name} =" podman create --privileged --name "${name}" --hostname "${hostname}" \ --network bridge:interface_name=eth0 --systemd true \ - --cpus "${cpus}" --memory "${memory}" --memory-swap -1 --no-hosts \ + --memory "${memory}" --memory-swap -1 --no-hosts \ --replace "${DISTRO}" echo fi