release.sh: correct the build prerequisites (builds are remote, not docker-local)
I had it wrong: `cloudron builder build` uploads the build context and the registry app's BuildKit builds it — the caller needs no docker, only a registry login. The guard now checks for that login and prints both bootstrap routes (narrow app password scoped to the registry app, or the CLI device flow) instead of blaming a missing docker binary.
This commit is contained in:
1 parent
2357d5d55a
commit
b657030d24
2 files changed
+26
-5
No files matched your search
@@ -119,10 +119,12 @@ cloudron --server my.inference.coop --token "$CLOUDRON_TOKEN" update \
|
|||||||
|
|
||||||
`./release.sh release` runs this same sequence with both traps handled — it
|
`./release.sh release` runs this same sequence with both traps handled — it
|
||||||
refuses to build from a dirty tree, always passes `--no-cache`, writes the tag
|
refuses to build from a dirty tree, always passes `--no-cache`, writes the tag
|
||||||
into the manifest before deploying, then runs the verification block. `build`
|
into the manifest before deploying, then runs the verification block. Builds are
|
||||||
needs docker, so it runs on whoever's machine has it (deliberately not the agent
|
remote (the registry's BuildKit does the work), so the only requirement is a
|
||||||
VM); `verify`, `volume` and `pin`/`deploy` need only `CLOUDRON_TOKEN`.
|
registry login on the host running the command; `verify`, `volume` and
|
||||||
`./release.sh verify` is safe to run any time.
|
`pin`/`deploy` need only `CLOUDRON_TOKEN`. `./release.sh verify` is safe to run
|
||||||
|
any time. If `build` reports no registry login, it prints both ways to bootstrap
|
||||||
|
one (a narrow app password scoped to the registry app, or the CLI device flow).
|
||||||
|
|
||||||
Rollback: repoint `CloudronManifest.json.dockerImage` to the previous tag
|
Rollback: repoint `CloudronManifest.json.dockerImage` to the previous tag
|
||||||
(every build is tagged `20261019-<git-sha>`; the base image
|
(every build is tagged `20261019-<git-sha>`; the base image
|
||||||
|
|||||||
+20
-1
@@ -39,9 +39,28 @@ cr() { cloudron --server "$SERVER" --token "$CLOUDRON_TOKEN" "$@"; }
|
|||||||
manifest_tag() { python3 -c "import json;print(json.load(open('$MANIFEST'))['dockerImage'].rsplit(':',1)[-1])"; }
|
manifest_tag() { python3 -c "import json;print(json.load(open('$MANIFEST'))['dockerImage'].rsplit(':',1)[-1])"; }
|
||||||
|
|
||||||
cmd_build() {
|
cmd_build() {
|
||||||
command -v docker >/dev/null || die "no docker on this host — builds run where docker + the registry login live, not on the agent VM"
|
# Builds are REMOTE: the CLI uploads the build context and the registry's
|
||||||
|
# BuildKit does the work (no docker on the caller). What is required is a
|
||||||
|
# registry login for this user on this host — see the check below.
|
||||||
local tag="${TAG:-$(date -u +%Y%m%d)-$(git rev-parse --short HEAD)}"
|
local tag="${TAG:-$(date -u +%Y%m%d)-$(git rev-parse --short HEAD)}"
|
||||||
[ -z "$(git status --porcelain)" ] || die "working tree is dirty — commit first, the tag carries the git sha"
|
[ -z "$(git status --porcelain)" ] || die "working tree is dirty — commit first, the tag carries the git sha"
|
||||||
|
if ! cloudron builder info >/dev/null 2>&1; then
|
||||||
|
die "no registry build config on this host (this is the only blocker to ./release.sh build)"
|
||||||
|
fi
|
||||||
|
if grep -qi "not logged in" <<<"$(cloudron builder info 2>&1 || true)"; then
|
||||||
|
cat >&2 <<'MSG'
|
||||||
|
release.sh: this host has no registry login, so it cannot start a remote build.
|
||||||
|
Bootstrap it one of two ways:
|
||||||
|
a) narrow: in the Cloudron dashboard, mint an app password for registry-bot
|
||||||
|
scoped to the registry app (c257ba3c-6737-4375-ad51-ea19586bf3f0), put it on
|
||||||
|
this host, then write into ~/.cloudron.json:
|
||||||
|
{"builder": {"kind":"registry","type":"remote","url":"https://registry.inference.coop",
|
||||||
|
"username":"registry-bot","token":"<app password>"}}
|
||||||
|
b) broad: `cloudron login my.inference.coop` (device flow — a human with
|
||||||
|
dashboard access confirms a code), then `cloudron builder login`.
|
||||||
|
MSG
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
printf 'building %s:%s (base %s)\n' "$REGISTRY_REPO" "$tag" "$BASE_IMAGE"
|
printf 'building %s:%s (base %s)\n' "$REGISTRY_REPO" "$tag" "$BASE_IMAGE"
|
||||||
cloudron builder build --no-cache --repository "$REGISTRY_REPO" --tag "$tag" || die "build failed"
|
cloudron builder build --no-cache --repository "$REGISTRY_REPO" --tag "$tag" || die "build failed"
|
||||||
printf '\nbuilt tag: %s\nnext: ./release.sh pin %s\n' "$tag" "$tag"
|
printf '\nbuilt tag: %s\nnext: ./release.sh pin %s\n' "$tag" "$tag"
|
||||||
|
|||||||
Reference in new issue
Block a user