github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/build/teamcity-verify-archive.sh (about) 1 #!/usr/bin/env bash 2 3 set -euo pipefail 4 5 source "$(dirname "${0}")/teamcity-support.sh" 6 7 tc_start_block "Check build tag" 8 # Regression test for #14284, where builds were erroneously marked as dirty when 9 # build/variables.mk was out of date due to a race condition in Git. 10 run touch -m -t 197001010000 build/variables.mk 11 run build/builder.sh make .buildinfo/tag 12 if grep -F --quiet -- dirty .buildinfo/tag; then 13 echo "error: build tag recorded as dirty: $(<.buildinfo/tag)" >&2 14 exit 1 15 fi 16 tc_end_block "Check build tag" 17 18 tc_start_block "Build archive" 19 # Buffer noisy output and only print it on failure. 20 run build/builder.sh make archive -Otarget ARCHIVE=build/cockroach.src.tgz &> artifacts/build-archive.log || (cat artifacts/build-archive.log && false) 21 rm artifacts/build-archive.log 22 tc_end_block "Build archive" 23 24 tc_start_block "Test archive" 25 # We use test the source archive in a minimal image; the builder image bundles 26 # too much developer configuration to simulate a build on a fresh user machine. 27 # 28 # NB: This docker container runs as root. Be sure to mount any bind volumes as 29 # read-only to avoid creating root-owned directories and files on the host 30 # machine. 31 run docker run \ 32 --rm \ 33 --volume="$(cd "$(dirname "$0")" && pwd):/work:ro" \ 34 --workdir="/work" \ 35 golang:1.13-buster ./verify-archive.sh 36 tc_end_block "Test archive" 37 38 tc_start_block "Clean up" 39 # Clean up the archive we produced. 40 run build/builder.sh rm build/cockroach.src.tgz 41 tc_end_block "Clean up"