aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2019-05-26 19:41:18 -0300
committerEuAndreh <eu@euandre.org>2019-05-26 19:44:05 -0300
commitcc2869d771f3c49acbb76cac9d75f2369667e298 (patch)
treee05c3b70f70a8e9027d46f4aaf73ef4165322c8c
parentUnlock with git-crypt in setup phase (diff)
downloadserver-cc2869d771f3c49acbb76cac9d75f2369667e298.tar.gz
server-cc2869d771f3c49acbb76cac9d75f2369667e298.tar.xz
Prepare builds.sr.ht CI environment before running build tasks
Make content of .envrc available to subsequent build jobs.
-rw-r--r--.build.yml7
-rwxr-xr-xci-setup.sh16
-rwxr-xr-xdeploy.sh3
-rw-r--r--provision.sh5
-rw-r--r--ssh.conf3
5 files changed, 21 insertions, 13 deletions
diff --git a/.build.yml b/.build.yml
index e3106ec..28c79e4 100644
--- a/.build.yml
+++ b/.build.yml
@@ -12,11 +12,8 @@ secrets:
- d587955c-03fb-42ba-9e01-68ca8ed89f99
- 7084b7c7-12be-4509-8927-81ba6eeb1fc0
tasks:
- - git-crypt-unlock: |
- cd vps/
- git crypt unlock
- cd ../vps-state/
- git crypt unlock
+ - setup: |
+ ./vps/ci-setup.sh
- tests: |
cd vps/
nix-build -A test
diff --git a/ci-setup.sh b/ci-setup.sh
new file mode 100755
index 0000000..b6af3c7
--- /dev/null
+++ b/ci-setup.sh
@@ -0,0 +1,16 @@
+#!/usr/bin/env bash
+set -Eeuo pipefail
+cd "${BASH_SOURCE%/*}/"
+
+echo "Unlocking git-crypt repos..."
+git crypt unlock
+# Assumes vps-state was already cloned
+pushd ../vps-state/
+git crypt unlock
+popd
+echo "Done."
+
+cat .envrc >> ~/.buildenv
+
+source .envrc
+envsubst < ./ssh.conf >> ~/.ssh/config
diff --git a/deploy.sh b/deploy.sh
index 3381116..036fd6e 100755
--- a/deploy.sh
+++ b/deploy.sh
@@ -2,9 +2,6 @@
set -Eeuo pipefail
cd "${BASH_SOURCE%/*}/"
-# shellcheck disable=SC2139
-alias ssh="ssh -i secrets/id_rsa root@$TLD"
-
apt_wait() {
local i=0
tput sc
diff --git a/provision.sh b/provision.sh
index 79358af..6ea8f4e 100644
--- a/provision.sh
+++ b/provision.sh
@@ -2,11 +2,6 @@
set -Eeuo pipefail
cd "${BASH_SOURCE%/*}/"
-# shellcheck disable=SC2139
-alias ssh="ssh -i secrets/id_rsa root@$TLD"
-
-source .envrc
-
echo "Shutting down running containers..."
ssh "cd /home/vps/ && docker-compose down"
echo "Done."
diff --git a/ssh.conf b/ssh.conf
new file mode 100644
index 0000000..763925d
--- /dev/null
+++ b/ssh.conf
@@ -0,0 +1,3 @@
+Host $TLD
+ User root
+ IdentityFile $PWD/secrets/id_rsa