albatros/hcl/nixcache/user.sh
2023-03-24 17:04:19 +01:00

19 lines
499 B
Bash

#!/usr/bin/env bash
set -euxo pipefail
# setup workspace
mkdir /workspace
cd /workspace
git init
git remote add origin ${NOMAD_META_REPO_URL}
git fetch origin ${NOMAD_META_COMMIT}
git checkout ${NOMAD_META_COMMIT} -b ${NOMAD_META_BRANCH}
if [[ -s /var/run/secrets/albatros/secret.txt ]]; then
export SECRET_PATH=/var/run/secrets/albatros/secret.txt
fi
# wait for nix daemon during 120 seconds
timeout -s 9 120 bash -c 'until nix store ping; do sleep 2; done'
# launch user's build
./.albatros