diff --git a/build_deploy.sh b/build_deploy.sh index f10cf3b828..1cc11cce96 100755 --- a/build_deploy.sh +++ b/build_deploy.sh @@ -19,24 +19,18 @@ if [[ -z "$RH_REGISTRY_USER" || -z "$RH_REGISTRY_TOKEN" ]]; then exit 1 fi -# on RHEL8 or anything else, use podman -# AUTH_CONF_DIR="$(pwd)/.podman" -# mkdir -p $AUTH_CONF_DIR -# export REGISTRY_AUTH_FILE="$AUTH_CONF_DIR/auth.json" -# podman login -u="$QUAY_USER" -p="$QUAY_TOKEN" quay.io -# podman login -u="$RH_REGISTRY_USER" -p="$RH_REGISTRY_TOKEN" registry.redhat.io -# podman build -t "${IMAGE}:${IMAGE_TAG}" . -# podman push "${IMAGE}:${IMAGE_TAG}" -# # Backward compatibility with CI/QA -# podman tag "${IMAGE}:${IMAGE_TAG}" "${IMAGE}:latest" -# podman push "${IMAGE}:latest" -# podman tag "${IMAGE}:${IMAGE_TAG}" "${IMAGE}:qa" -# podman push "${IMAGE}:qa" -# podman tag "${IMAGE}:${IMAGE_TAG}" "${IMAGE}:clowder" -# podman push "${IMAGE}:clowder" - -# on RHEL7, use docker -DOCKER_CONF="$PWD/.docker" +# Create tmp dir to store data in during job run (do NOT store in $WORKSPACE) +export TMP_JOB_DIR=$(mktemp -d -p "$HOME" -t "jenkins-${JOB_NAME}-${BUILD_NUMBER}-XXXXXX") +echo "job tmp dir location: $TMP_JOB_DIR" + +function job_cleanup() { + echo "cleaning up job tmp dir: $TMP_JOB_DIR" + rm -fr $TMP_JOB_DIR +} + +trap job_cleanup EXIT ERR SIGINT SIGTERM + +DOCKER_CONF="$TMP_JOB_DIR/.docker" mkdir -p "$DOCKER_CONF" docker --config="$DOCKER_CONF" login -u="$QUAY_USER" -p="$QUAY_TOKEN" quay.io docker --config="$DOCKER_CONF" build --build-arg GIT_COMMIT="$GIT_COMMIT" -t "${IMAGE}:${IMAGE_TAG}" .