scripts/deploy: add --build flag
useful as e.g. deploy --pre --build, to only *build* all variants/hosts, but don't actually copy
This commit is contained in:
@@ -8,6 +8,7 @@ usage() {
|
|||||||
echo ""
|
echo ""
|
||||||
echo "usage: deploy [options] [host] [host2 ...]"
|
echo "usage: deploy [options] [host] [host2 ...]"
|
||||||
echo "options:"
|
echo "options:"
|
||||||
|
echo "- --build: only build; don't copy or deploy"
|
||||||
echo "- --copy: only build + copy files, nothing more"
|
echo "- --copy: only build + copy files, nothing more"
|
||||||
echo "- --switch (default)"
|
echo "- --switch (default)"
|
||||||
echo "- --test: switch to the new configuration, but do not make it bootable"
|
echo "- --test: switch to the new configuration, but do not make it bootable"
|
||||||
@@ -68,7 +69,7 @@ parseArgs() {
|
|||||||
local arg=$1
|
local arg=$1
|
||||||
shift
|
shift
|
||||||
case "$arg" in
|
case "$arg" in
|
||||||
(--copy|--switch|--test)
|
(--build|--copy|--switch|--test)
|
||||||
action=${arg/--/}
|
action=${arg/--/}
|
||||||
;;
|
;;
|
||||||
(--deriv)
|
(--deriv)
|
||||||
@@ -221,6 +222,8 @@ deployOneHost() {
|
|||||||
|
|
||||||
local netHost=$(resolveHost "$host")
|
local netHost=$(resolveHost "$host")
|
||||||
|
|
||||||
|
case "$action" in
|
||||||
|
(copy|switch|test)
|
||||||
if [ -n "$host" ] && [ "$host" != "$SELF" ]; then
|
if [ -n "$host" ] && [ "$host" != "$SELF" ]; then
|
||||||
if [ -e /run/secrets/nix_signing_key ]; then
|
if [ -e /run/secrets/nix_signing_key ]; then
|
||||||
info "signing store paths ..."
|
info "signing store paths ..."
|
||||||
@@ -233,8 +236,11 @@ deployOneHost() {
|
|||||||
# we already have all paths here, and the remote substitution is slow to check and SERIOUSLY flaky on moby in particular.
|
# we already have all paths here, and the remote substitution is slow to check and SERIOUSLY flaky on moby in particular.
|
||||||
ECHO_CMD=1 destructive timeout "$timeout" nix copy -vv --option builders-use-substitutes false --to "ssh-ng://$netHost" "$myStorePath" || return 1
|
ECHO_CMD=1 destructive timeout "$timeout" nix copy -vv --option builders-use-substitutes false --to "ssh-ng://$netHost" "$myStorePath" || return 1
|
||||||
fi
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
if [ -n "$action" ] && [ "$action" != "copy" ]; then
|
case "$action" in
|
||||||
|
(switch|test)
|
||||||
info "activating profile... "
|
info "activating profile... "
|
||||||
destructive runOnTarget "$netHost" sudo nix-env -p /nix/var/nix/profiles/system --set "$myStorePath" || return 1
|
destructive runOnTarget "$netHost" sudo nix-env -p /nix/var/nix/profiles/system --set "$myStorePath" || return 1
|
||||||
destructive runOnTarget "$netHost" sudo "$myStorePath/bin/switch-to-configuration" "$action"
|
destructive runOnTarget "$netHost" sudo "$myStorePath/bin/switch-to-configuration" "$action"
|
||||||
@@ -244,7 +250,8 @@ deployOneHost() {
|
|||||||
destructive runOnTarget "$netHost" sane-reboot "$host" || return 1
|
destructive runOnTarget "$netHost" sane-reboot "$host" || return 1
|
||||||
fi
|
fi
|
||||||
return $rc
|
return $rc
|
||||||
fi
|
;;
|
||||||
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
failedDeploys=()
|
failedDeploys=()
|
||||||
|
Reference in New Issue
Block a user