Skip to content

Commit

Permalink
contrib/openshfit: only start buildkitd container if needed
Browse files Browse the repository at this point in the history
Signed-off-by: Hank Donnay <hdonnay@redhat.com>
  • Loading branch information
hdonnay committed Aug 22, 2024
1 parent ab6e9e0 commit 89af3db
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions contrib/openshift/build_and_deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 89af3db

Please sign in to comment.