From 576558adcf00dbf40ed599b9cb11b720bef47b78 Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Fri, 20 Sep 2024 23:14:07 +0200 Subject: Reworked ODS job to handle the necessary git-crypt unlock --- ods/ods.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 ods/ods.sh (limited to 'ods/ods.sh') diff --git a/ods/ods.sh b/ods/ods.sh new file mode 100644 index 0000000..a71e02e --- /dev/null +++ b/ods/ods.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash +set -euo pipefail + +WORKDIR="/tmp/${EVENTLINE_JOB_NAME}" + +cleanup() { + rm -rf "${WORKDIR}" +} + +trap cleanup EXIT + +cd "${WORKDIR}" +git-crypt unlock "${EVENTLINE_DIR}/identities/gpg/private_key" + +podman run --rm -ti -v "${WORKDIR}:/mnt" \ + --entrypoint "/bin/sh" \ + localhost/ods:latest \ + /bin/cp /usr/local/bin/ods /mnt/ + +SSHKEY="${EVENTLINE_DIR}/identities/ssh/private_key" +SSHOPTS="-i ${SSHKEY} -o StrictHostKeyChecking=accept-new" + +rsync -e "ssh ${SSHOPTS}" "${WORKDIR}/ods" root@ods.adyxax.org:/srv/ods/ +ssh root@ods.adyxax.org "systemctl restart ods" + +trap - EXIT -- cgit v1.2.3