Build release images on Lithium by default
release.sh defaults to the buildx builder "lithium" and no longer creates a missing builder on the local machine. It checks the builder before anything is committed or pushed. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8abf0b4493
commit
96059d28eb
1 file changed
+10
-5
+10
-5
@@ -18,18 +18,19 @@
|
||||
# GITEA_REPO owner/repo (default zink/codecraft)
|
||||
# GITEA_TOKEN API token; if empty, the git credential helper is asked
|
||||
# PLATFORMS buildx platforms (default linux/amd64,linux/arm64)
|
||||
# BUILDER buildx builder name (default codecraft-multi, created if missing)
|
||||
# BUILDER buildx builder name (default lithium: images are built on Lithium)
|
||||
#
|
||||
# Requires: git, docker with buildx (logged in to the registry), curl, jq.
|
||||
# Building for a foreign architecture needs QEMU/binfmt:
|
||||
# docker run --privileged --rm tonistiigi/binfmt --install all
|
||||
# The builder is never created automatically (it would run on this machine). Set it up once:
|
||||
# docker buildx create --name lithium --driver docker-container \
|
||||
# --platform linux/amd64,linux/arm64 ssh://root@10.10.0.3
|
||||
set -euo pipefail
|
||||
|
||||
REGISTRY="${REGISTRY:-git.familie-zink.org/zink/codecraft}"
|
||||
GITEA_URL="${GITEA_URL:-https://git.familie-zink.org}"
|
||||
GITEA_REPO="${GITEA_REPO:-zink/codecraft}"
|
||||
PLATFORMS="${PLATFORMS:-linux/amd64,linux/arm64}"
|
||||
BUILDER="${BUILDER:-codecraft-multi}"
|
||||
BUILDER="${BUILDER:-lithium}"
|
||||
|
||||
tag="" dry=0 latest=1 image=1
|
||||
for arg in "$@"; do
|
||||
@@ -51,6 +52,11 @@ fail() { echo "error: $*" >&2; exit 1; }
|
||||
step "Checking the working tree"
|
||||
for cmd in git docker curl jq; do command -v "$cmd" >/dev/null || fail "$cmd is not installed"; done
|
||||
[[ -z "$(git status --porcelain --untracked-files=no)" ]] || fail "uncommitted changes – commit or stash them first"
|
||||
# Checked before anything is committed or pushed, so a missing builder leaves no tag without image.
|
||||
if (( image )); then
|
||||
docker buildx inspect --bootstrap "$BUILDER" >/dev/null 2>&1 \
|
||||
|| fail "buildx builder \"$BUILDER\" is missing or unreachable (setup: see --help)"
|
||||
fi
|
||||
run git fetch --tags --quiet origin
|
||||
|
||||
if [[ -z "$tag" ]]; then
|
||||
@@ -88,7 +94,6 @@ run git push origin "$branch" "$tag"
|
||||
|
||||
if (( image )); then
|
||||
step "Building and pushing $REGISTRY:$tag for $PLATFORMS"
|
||||
docker buildx inspect "$BUILDER" >/dev/null 2>&1 || run docker buildx create --name "$BUILDER" --driver docker-container >/dev/null
|
||||
tags=(-t "$REGISTRY:$tag")
|
||||
(( latest )) && tags+=(-t "$REGISTRY:latest")
|
||||
run docker buildx build --builder "$BUILDER" --platform "$PLATFORMS" \
|
||||
|
||||
Reference in new issue
Block a user