Pin a release's image by digest, and refuse downgrades without --downgrade

After pulling a release, coreapps records its registry digest and runs
image:version@sha256:..., so a re-pushed tag can't change an installed
app; installing that release again with another digest is refused. An
older release than the installed one needs --downgrade (coreapps
install/plan, coreapp install), since it may not understand the newer
one's data.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-03 18:31:09 -07:00
co-authored by Claude Opus 5.5
parent dcc72fe5da
commit da36a669bf
7 changed files with 143 additions and 29 deletions
+14 -7
View File
@@ -24,9 +24,11 @@
# remove the test account from the Core
# coreapp remove uninstall it from the Core (asks first)
# coreapp list the apps on the Core installed this way
# coreapp install <https://host/owner/repo>[@tag]
# coreapp install [--downgrade] <https://host/owner/repo>[@tag]
# install a published app from its repository, as
# a Core's owner would (shows what it needs first)
# a Core's owner would (shows what it needs first;
# --downgrade: allow an older release than the
# installed one)
# coreapp update <name> update an app installed from a repository to its
# newest release
# coreapp login <host> give the Core a token for private apps from host
@@ -410,14 +412,16 @@ cmd_list() {
# --- install, update (published apps) -----------------------------------
cmd_install() {
local source="${1:-}" plan key value answer addon=""
local source plan key value answer addon="" downgrade=""
local -A info=()
if [[ "${1:-}" == --downgrade ]]; then downgrade=--downgrade; shift; fi
source="${1:-}"
[[ $# -eq 1 && "$source" == https://* ]] \
|| die "Usage: coreapp install <https://host/owner/repo>[@tag] (default: its newest release)"
|| die "Usage: coreapp install [--downgrade] <https://host/owner/repo>[@tag] (default: its newest release)"
init_core
sync_installer
echo "Reading $source..."
plan="$(core "$REMOTE_INSTALLER/coreapps plan $(printf '%q' "$source")")" || exit 1
plan="$(core "$REMOTE_INSTALLER/coreapps plan $downgrade $(printf '%q' "$source")")" || exit 1
while IFS='=' read -r key value; do info[$key]="$value"; done <<< "$plan"
echo
@@ -425,7 +429,10 @@ cmd_install() {
echo " From: ${info[source]} (${info[tag]}, commit ${info[commit]:0:12})"
echo " Image: ${info[image]}:${info[version]}"
echo " Needs: ${info[needs]:-nothing from the Core}"
if [[ "${info[state]}" == update ]]; then
if [[ -n "${info[downgrade_from]:-}" ]]; then
echo " Goes back from the installed ${info[downgrade_from]}, keeping its settings and data,"
echo " which the older version may not understand."
elif [[ "${info[state]}" == update ]]; then
echo " Updates the installed ${info[name]}, keeping its settings and data."
else
echo " Installs it at ${info[url]}"
@@ -438,7 +445,7 @@ cmd_install() {
fi
read -r -p "Install it? [y/N] " answer
[[ "$answer" =~ ^[Yy] ]] || die "Not installed."
core "$REMOTE_INSTALLER/coreapps install $addon $(printf '%q' "$source")"
core "$REMOTE_INSTALLER/coreapps install $addon $downgrade $(printf '%q' "$source")"
}
cmd_update() {