Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bin/runpool
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export RUNPOOL_INVOKED
# The released version, and the only place it is written. The Homebrew formula
# builds from a git tag, so a tag without a matching bump here ships a binary
# that misreports itself.
RUNPOOL_VERSION="0.12.1"
RUNPOOL_VERSION="0.12.2"

# shellcheck source=lib/common.sh
. "${RUNPOOL_ROOT}/lib/common.sh"
Expand Down
6 changes: 6 additions & 0 deletions lib/lifecycle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,12 @@ _rp_reregister_locked() {
rm -f "${runner_dir}/.runner" "${runner_dir}/.credentials" \
"${runner_dir}/.credentials_rsaparams" "${runner_dir}/.runner_migrated" \
"${runner_dir}/.service"
# reregister is the repair command, and a runner whose directory has been
# moved has absolute bin and externals links pointing where it used to be.
# config.sh cannot start against those, so repairing them is part of
# repairing the install rather than a separate errand. Relative links are
# already correct, so this is a no-op on a healthy runner.
_rp_rewrite_runner_links "${runner_dir}" || return 1
_rp_log "${name} runner-${i}: re-registering as '${runner_name}'"
( cd "${runner_dir}" && ./config.sh --unattended --replace \
--url "https://github.com/${POOL_TARGET}" --token "${token}" \
Expand Down
22 changes: 22 additions & 0 deletions tests/pool-rename.sh
Original file line number Diff line number Diff line change
Expand Up @@ -273,4 +273,26 @@ ok
ok
rm -rf "${RUNPOOL_STATE_DIR}/resize.bravo.lock"

# ---------------------------------------------------------------------------
# reregister repairs a moved install
# ---------------------------------------------------------------------------
# The documented recovery from a rename that failed part way, so it has to
# cope with the dangling links that failure leaves behind.
build_pool alpha 1
mv "${RUNPOOL_BASE}/runners/alpha" "${RUNPOOL_BASE}/runners/moved"
sed -i '' "s|runners/alpha|runners/moved|" "${RUNPOOL_BASE}/pools/alpha.conf"
(
# shellcheck source=/dev/null
. "${repo_dir}/lib/common.sh" 2>/dev/null || true
# shellcheck source=/dev/null
. "${repo_dir}/lib/lifecycle.sh"
_rp_down() { return 0; }
_rp_busy_in() { echo 0; }
_rp_reregister alpha
) >"${scratch_dir}/out" 2>&1 || fail "reregister did not repair a moved install: $(cat "${scratch_dir}/out")"
case "$(readlink "${RUNPOOL_BASE}/runners/moved/runner-1/bin")" in
/*) fail "reregister left an absolute bin link" ;;
*) ok ;;
esac

echo "ok: ${pass} case(s)"