From 89af3db111a317abeb1b4c409840aa8f7660dcbf Mon Sep 17 00:00:00 2001 From: Hank Donnay Date: Thu, 22 Aug 2024 12:59:36 -0500 Subject: [PATCH] contrib/openshfit: only start buildkitd container if needed Signed-off-by: Hank Donnay --- contrib/openshift/build_and_deploy.sh | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/contrib/openshift/build_and_deploy.sh b/contrib/openshift/build_and_deploy.sh index 813a44f145..5db2eca1dd 100755 --- a/contrib/openshift/build_and_deploy.sh +++ b/contrib/openshift/build_and_deploy.sh @@ -74,7 +74,6 @@ if ! command -v buildctl >/dev/null 2>&1; then buildctl --version fi -echo Starting buildkitd container: cleanup() { todo=( ${login_done:+${REGISTRY_AUTH_FILE}} ) if [[ -f "${cidfile}" ]]; then @@ -92,15 +91,18 @@ trap 'cleanup' EXIT if [[ -n "${QUAY_USER-}" && -n "${QUAY_TOKEN-}" ]]; then registry_login fi -[[ -x o ]] && skopeo list-tags "docker://${BUILDKIT_IMAGE%:*}" -${CONTAINER_ENGINE} run \ - --cidfile "${cidfile}" \ - --detach \ - --privileged \ - --rm \ - "${BUILDKIT_IMAGE}" -BUILDKIT_HOST="$(basename "${CONTAINER_ENGINE}")-container://$(cat "$cidfile")" -export BUILDKIT_HOST +if [[ ! -v BUILDKIT_HOST ]]; then + echo Starting buildkitd container: + [[ -x o ]] && skopeo list-tags "docker://${BUILDKIT_IMAGE%:*}" + ${CONTAINER_ENGINE} run \ + --cidfile "${cidfile}" \ + --detach \ + --privileged \ + --rm \ + "${BUILDKIT_IMAGE}" + BUILDKIT_HOST="$(basename "${CONTAINER_ENGINE}")-container://$(cat "$cidfile")" + export BUILDKIT_HOST +fi echo Exporting source: make dist