albatros/hcl/nixcache/user.sh

22 lines
522 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}
2023-05-17 10:21:21 +00:00
git checkout ${NOMAD_META_COMMIT} -b ${NOMAD_META_BRANCH:-$NOMAD_META_TAG}
2023-03-24 13:35:43 +00:00
if [[ -s /var/run/secrets/albatros/secret.txt ]]; then
2023-05-17 10:21:21 +00:00
set +x
source /var/run/secrets/albatros/secret.txt
set -x
2023-03-24 13:35:43 +00:00
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