mob next [ci-skip] [ci skip] [skip ci]
lastFile:inventories/default.nix
This commit is contained in:
+65
-1
@@ -59,7 +59,7 @@
|
|||||||
roles.default.settings.interfaces = [ "ygg" ];
|
roles.default.settings.interfaces = [ "ygg" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
auto-update = {
|
auto-pull-update = {
|
||||||
module = {
|
module = {
|
||||||
name = "dm-pull-deploy";
|
name = "dm-pull-deploy";
|
||||||
input = "clan-community";
|
input = "clan-community";
|
||||||
@@ -68,6 +68,70 @@
|
|||||||
gitUrl = "https://git.b4l.co.th/newedge/infra.git";
|
gitUrl = "https://git.b4l.co.th/newedge/infra.git";
|
||||||
branch = "main";
|
branch = "main";
|
||||||
};
|
};
|
||||||
|
roles.push.extraModules = [
|
||||||
|
(
|
||||||
|
{ pkgs, config, ... }:
|
||||||
|
{
|
||||||
|
|
||||||
|
environment.systemPackages = [
|
||||||
|
(pkgs.writeShellApplication {
|
||||||
|
name = "custom-dm-send-deploy";
|
||||||
|
runtimeInputs = [
|
||||||
|
config.services.data-mesher.package
|
||||||
|
pkgs.git
|
||||||
|
pkgs.nix
|
||||||
|
pkgs.jq
|
||||||
|
];
|
||||||
|
text =
|
||||||
|
let
|
||||||
|
settings.branch = "main";
|
||||||
|
settings.gitUrl = "https://git.b4l.co.th/newedge/infra.git";
|
||||||
|
in
|
||||||
|
''
|
||||||
|
if [ $# -gt 1 ]; then
|
||||||
|
echo "Usage: dm-send-deploy [<flake-ref>]"
|
||||||
|
echo "Without arguments, sends the latest commit on '${settings.branch}' from ${settings.gitUrl}"
|
||||||
|
echo "Example: dm-send-deploy git+https://example.com/repo.git?rev=abc123..."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
KEY="${config.clan.core.vars.generators.dm-pull-deploy-signing-key.files."signing.key".path}"
|
||||||
|
if [ ! -r "$KEY" ]; then
|
||||||
|
echo "Error: cannot read signing key at $KEY (are you root?)"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $# -eq 1 ]; then
|
||||||
|
FLAKE_REF="$1"
|
||||||
|
else
|
||||||
|
REV=$(git ls-remote "${settings.gitUrl}" "refs/heads/${settings.branch}" | cut -f1)
|
||||||
|
if [ -z "$REV" ]; then
|
||||||
|
echo "Error: could not determine latest commit on ${settings.branch} from ${settings.gitUrl}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
FLAKE_REF="git+${settings.gitUrl}?rev=$REV"
|
||||||
|
fi
|
||||||
|
|
||||||
|
TMPFILE=$(mktemp)
|
||||||
|
trap 'rm -f "$TMPFILE"' EXIT
|
||||||
|
|
||||||
|
printf '%s' "$FLAKE_REF" > "$TMPFILE"
|
||||||
|
|
||||||
|
NETWORK_ID="${config.clan.core.vars.generators.data-mesher-network.files."network.pub".path}"
|
||||||
|
|
||||||
|
data-mesher file update "$TMPFILE" \
|
||||||
|
--url http://localhost:7331 \
|
||||||
|
--network-id "$NETWORK_ID" \
|
||||||
|
--key "$KEY" \
|
||||||
|
--name "dm_pull_deploy/target"
|
||||||
|
|
||||||
|
echo "Deployment target pushed: $FLAKE_REF"
|
||||||
|
'';
|
||||||
|
})
|
||||||
|
];
|
||||||
|
}
|
||||||
|
)
|
||||||
|
];
|
||||||
roles.default.tags = [ "all" ];
|
roles.default.tags = [ "all" ];
|
||||||
roles.default.settings.action = "switch";
|
roles.default.settings.action = "switch";
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user