CI: per-user digest file path (avoid /tmp collision between manual + runner)
This commit is contained in:
@@ -13,6 +13,8 @@ set -euo pipefail
|
|||||||
REGISTRY="${REGISTRY:-git.bztmon.com}"
|
REGISTRY="${REGISTRY:-git.bztmon.com}"
|
||||||
IMAGE="${IMAGE:-jwright/bztmon-site}"
|
IMAGE="${IMAGE:-jwright/bztmon-site}"
|
||||||
REF="${REGISTRY}/${IMAGE}"
|
REF="${REGISTRY}/${IMAGE}"
|
||||||
|
# Per-user digest file so manual (odysseus) and CI (gitea-runner) runs never collide in /tmp.
|
||||||
|
DIGEST_FILE="${DIGEST_FILE:-${TMPDIR:-/tmp}/bztmon-site-$(id -un).digest}"
|
||||||
|
|
||||||
cd "$(dirname "$0")/.."
|
cd "$(dirname "$0")/.."
|
||||||
|
|
||||||
@@ -33,9 +35,9 @@ retry buildah build --retry 3 --retry-delay 5s --layers -t "${REF}:${TAG}" -t "$
|
|||||||
|
|
||||||
if [[ "${1:-}" == "push" ]]; then
|
if [[ "${1:-}" == "push" ]]; then
|
||||||
echo ">> pushing ${REF}:${TAG}"
|
echo ">> pushing ${REF}:${TAG}"
|
||||||
retry buildah push --digestfile /tmp/bztmon-site.digest "${REF}:${TAG}"
|
retry buildah push --digestfile "${DIGEST_FILE}" "${REF}:${TAG}"
|
||||||
retry buildah push "${REF}:latest"
|
retry buildah push "${REF}:latest"
|
||||||
DIGEST="$(cat /tmp/bztmon-site.digest)"
|
DIGEST="$(cat "${DIGEST_FILE}")"
|
||||||
echo
|
echo
|
||||||
echo ">> pin this in home-ops kubernetes/apps/bztmon-site/bztmon-site.yaml:"
|
echo ">> pin this in home-ops kubernetes/apps/bztmon-site/bztmon-site.yaml:"
|
||||||
echo " image: ${REF}:${TAG}@${DIGEST}"
|
echo " image: ${REF}:${TAG}@${DIGEST}"
|
||||||
|
|||||||
@@ -21,7 +21,8 @@ MANIFEST="${MANIFEST:-kubernetes/apps/bztmon-site/bztmon-site.yaml}"
|
|||||||
GITEA_API="${GITEA_API:-https://gitea.bztmon.org/api/v1}"
|
GITEA_API="${GITEA_API:-https://gitea.bztmon.org/api/v1}"
|
||||||
|
|
||||||
TAG="$(git rev-parse --short HEAD)"
|
TAG="$(git rev-parse --short HEAD)"
|
||||||
DIGEST="$(cat /tmp/bztmon-site.digest)"
|
DIGEST_FILE="${DIGEST_FILE:-${TMPDIR:-/tmp}/bztmon-site-$(id -un).digest}"
|
||||||
|
DIGEST="$(cat "${DIGEST_FILE}")"
|
||||||
REF="${REGISTRY}/${IMAGE}:${TAG}@${DIGEST}"
|
REF="${REGISTRY}/${IMAGE}:${TAG}@${DIGEST}"
|
||||||
echo ">> new image ref: ${REF}"
|
echo ">> new image ref: ${REF}"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user