better test + migration

This commit is contained in:
ari committed 2026-09-17 16:26:15 -04:00
1 parent 27b713affa
commit ab8260a5d0
8 files changed
+202 -34

No files matched your search

+16 -6
View File
@@ -55,7 +55,19 @@ def "main migrate" [
# leftovers from a prior rootless-container deployment) without that
# aborting an otherwise-successful migration - tar still warns about it,
# it just doesn't fail the whole pipeline over it.
^tar --ignore-failed-read -C $source -cf - . | run-argv ($ssh_base ++ [$"mkdir -p '($dest)' && tar -C '($dest)' -xf -"])
#
# --exclude='./.local/bin': launcher scripts in .local/bin are
# environment-specific (Docker wrappers, old arch builds, etc.) and must
# never be carried into the guest. hermes-install.service installs the
# correct native binary there on first boot; an overwritten launcher from
# the source would shadow it and fail with "docker not found on PATH".
#
# --exclude='./.hermes-installed': this sentinel tells hermes-install to
# skip the native install. Migrating it from the source would prevent the
# guest from ever installing hermes if the source's .local/bin/hermes is
# also excluded (above). Let the install service run and place a fresh
# binary instead.
^tar --ignore-failed-read --exclude='./.local/bin' --exclude='./.hermes-installed' -C $source -cf - . | run-argv ($ssh_base ++ [$"mkdir -p '($dest)' && tar -C '($dest)' -xf -"])
step 3 "rewriting stale hostnames in the guest"
let last_idx = ($rewrite_from | length) - 1
@@ -168,12 +180,10 @@ def "main migrate connections" [
gssh "true"
step 2 $"streaming connection files ($source) -> guest:($guest_dest)"
# Build an include list for tar: individual files + full dir trees.
let file_args = $existing_files | each {|f| ["--include" $f] } | flatten
let dir_args = $existing_dirs | each {|d| ["--include" $"($d)/**"] } | flatten
let tar_args = $file_args | append $dir_args | append ["--no-recursion" "-cf" "-" "."]
# Pass files and dirs as positional tar arguments — no --include needed.
let tar_targets = $existing_files | append $existing_dirs
(
^tar --ignore-failed-read -C $source ...$tar_args
^tar --ignore-failed-read -C $source -cf - ...$tar_targets
| run-argv ($ssh_base ++ [$"mkdir -p '($guest_dest)' && tar -C '($guest_dest)' -xf -"])
)