depot/hack/deploy.sh

22 lines
633 B
Bash
Executable file

#!/usr/bin/env bash
# SPDX-FileCopyrightText: 2020 Luke Granger-Brown <depot@lukegb.com>
#
# SPDX-License-Identifier: Apache-2.0
set -euo pipefail
./hack/populate_secrets.sh
ssh_cmd="ssh -o StrictHostKeyChecking=accept-new"
if [ ! -z ${2+x} ]; then ssh_cmd="$ssh_cmd $2"; fi
system="$(nix run nixpkgs.jq -c jq -r ".[\"${1}\"]" systems.json)"
echo System is $system
echo Syncing repo content to machine "$1"
rsync -e "$ssh_cmd" -avz --exclude='.hg/store/data/' --exclude='.hg/store/dh/' --exclude='.hg/cache/' --exclude='.hg/wcache/' ./ "deployer@$1:depot/"
echo Triggering rebuild
$ssh_cmd -t "deployer@$1" rebuilder ./depot