deployerbot: fixes
This commit is contained in:
parent
c1957a6896
commit
86bc0dfc1f
@ -3,22 +3,7 @@
|
|||||||
lib,
|
lib,
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}: let
|
}: {
|
||||||
mkOptional = {
|
|
||||||
derivationTarget,
|
|
||||||
pingTarget,
|
|
||||||
}: ''
|
|
||||||
if ${pkgs.inetutils}/bin/ping -c 1 ${pingTarget}; then
|
|
||||||
${pkgs.deploy-rs.deploy-rs}/bin/deploy \
|
|
||||||
--ssh-opts="-i ''${CREDENTIALS_DIRECTORY}/ssh-key" \
|
|
||||||
--ssh-user=deployerbot-follower \
|
|
||||||
--confirm-timeout 60 \
|
|
||||||
--skip-checks \
|
|
||||||
--targets ${derivationTarget} -- \
|
|
||||||
--accept-flake-config || EXITCODE=1
|
|
||||||
fi
|
|
||||||
'';
|
|
||||||
in {
|
|
||||||
options.mj.services.deployerbot.main = with lib.types; {
|
options.mj.services.deployerbot.main = with lib.types; {
|
||||||
enable = lib.mkEnableOption "Enable system updater orchestrator";
|
enable = lib.mkEnableOption "Enable system updater orchestrator";
|
||||||
deployDerivations = lib.mkOption {type = listOf str;};
|
deployDerivations = lib.mkOption {type = listOf str;};
|
||||||
@ -88,7 +73,6 @@ in {
|
|||||||
nix flake update --accept-flake-config --commit-lock-file
|
nix flake update --accept-flake-config --commit-lock-file
|
||||||
# TODO --all-systems
|
# TODO --all-systems
|
||||||
nix flake check --accept-flake-config
|
nix flake check --accept-flake-config
|
||||||
git push origin main
|
|
||||||
|
|
||||||
EXITCODE=0
|
EXITCODE=0
|
||||||
${pkgs.deploy-rs.deploy-rs}/bin/deploy \
|
${pkgs.deploy-rs.deploy-rs}/bin/deploy \
|
||||||
@ -99,8 +83,26 @@ in {
|
|||||||
--targets ${deployDerivationsStr} -- \
|
--targets ${deployDerivationsStr} -- \
|
||||||
--accept-flake-config || EXITCODE=1
|
--accept-flake-config || EXITCODE=1
|
||||||
|
|
||||||
|
if [[ $EXITCODE != 0 ]]; then
|
||||||
|
git push origin main
|
||||||
|
fi
|
||||||
|
|
||||||
# Optional deployments
|
# Optional deployments
|
||||||
${lib.concatLines (map mkOptional cfg.deployIfPresent)}
|
${lib.concatLines (map ({
|
||||||
|
derivationTarget,
|
||||||
|
pingTarget,
|
||||||
|
}: ''
|
||||||
|
if ${pkgs.inetutils}/bin/ping -c 1 ${pingTarget}; then
|
||||||
|
${pkgs.deploy-rs.deploy-rs}/bin/deploy \
|
||||||
|
--ssh-opts="-i ''${CREDENTIALS_DIRECTORY}/ssh-key" \
|
||||||
|
--ssh-user=deployerbot-follower \
|
||||||
|
--confirm-timeout 60 \
|
||||||
|
--skip-checks \
|
||||||
|
--targets ${derivationTarget} -- \
|
||||||
|
--accept-flake-config || EXITCODE=1
|
||||||
|
fi
|
||||||
|
'')
|
||||||
|
cfg.deployIfPresent)}
|
||||||
|
|
||||||
exit $EXITCODE
|
exit $EXITCODE
|
||||||
'';
|
'';
|
||||||
|
Loading…
Reference in New Issue
Block a user