#!/bin/sh # script/cibuild: run the CI build. The Dockerfile runs script/check, but # that only proves anything because CHECK_EPOCH is a fresh nonce on every # invocation: without it Docker serves the check layer from cache and the # build exits 0 without running the suite. set -eu ROOT="$(cd "$(dirname "$0")/.." && pwd -P)" main() { cd "$ROOT" # Both assignments on their own line: a failing command substitution # inside an argument does not trip `set -e`, so the inline form # degrades silently to an empty constant. `$$` because busybox `date` # drops %N without erroring. VERSION is computed here because # .dockerignore excludes .git, so `git describe` in a build stage # yields an empty version without failing; the guard below is the # single place the fallback is applied. epoch="$(date +%s%N)$$" version="$(git describe --tags --always --dirty 2>/dev/null || true)" [ -n "$version" ] || version="unknown" docker build \ --build-arg CHECK_EPOCH="$epoch" \ --build-arg VERSION="$version" \ . } main "$@"