albatros/hcl/nixcache/user.sh

20 lines
499 B
Bash
Raw Normal View History

2023-03-24 13:35:43 +00:00
#!/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