github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/build/teamcity-assert-clean.sh (about)

     1  #!/usr/bin/env bash
     2  
     3  set -euo pipefail
     4  
     5  source "$(dirname "${0}")/teamcity-support.sh"
     6  
     7  # The workspace is clean iff `git status --porcelain` produces no output. Any
     8  # output is either an error message or a listing of an untracked/dirty file.
     9  if [[ "$(git status --porcelain 2>&1)" != "" ]]; then
    10    git status >&2 || true
    11    git diff -a >&2 || true
    12    echo "Nuking build cruft. Please teach this build to clean up after itself." >&2
    13    run docker run --volume="$root:/nuke" --workdir="/nuke" golang:stretch /bin/bash -c "git clean -ffdx ; git submodule foreach --recursive git clean -xffd" >&2
    14    exit 1
    15  fi