Skip to content

Commit

Permalink
use temp directory for docker config (#251)
Browse files Browse the repository at this point in the history
  • Loading branch information
petracihalova authored Dec 17, 2024
1 parent 72b7103 commit 8ed694c
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion build_deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,19 @@ if [[ -z "$RH_REGISTRY_USER" || -z "$RH_REGISTRY_TOKEN" ]]; then
exit 1
fi

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 tmp job 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" login -u="$RH_REGISTRY_USER" -p="$RH_REGISTRY_TOKEN" registry.redhat.io
Expand Down

0 comments on commit 8ed694c

Please sign in to comment.