albatros/hcl/nixcache/user.sh

22 lines
522 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:-$NOMAD_META_TAG}
if [[ -s /var/run/secrets/albatros/secret.txt ]]; then
set +x
source /var/run/secrets/albatros/secret.txt
set -x
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