github.com/pachyderm/pachyderm@v1.13.4/etc/testing/travis_test_check_and_pull.sh (about)

     1  #!/bin/bash
     2  
     3  set -ex
     4  
     5  # See travis_build_check_and_stash.sh for context.
     6  #
     7  # This script takes the docker image which that script pushed, and unpacks the
     8  # git source tree from it, as it is more reliably going to be the correct
     9  # source tree for this build than what Travis and GitHub give us (in the PR
    10  # build case, at least).
    11  
    12  if [ "${TRAVIS_PULL_REQUEST}" == "false" ]; then
    13      # These shenannigans not needed for release and branch builds, hopefully.
    14      exit 0
    15  fi
    16  
    17  if [[ ! "$TRAVIS_SECURE_ENV_VARS" == "true" ]]; then
    18      echo "Not trying to fetch pachyderm.tar as we are running for an external"
    19      echo "contributor"
    20  else
    21      cd /home/travis/gopath/src/github.com/pachyderm/
    22      mv pachyderm pachyderm.old
    23  
    24      docker login -u pachydermbuildbot -p "${DOCKER_PWD}"
    25      docker run -v "$(pwd)":/unpack pachyderm/ci_code_bundle:"${TRAVIS_BUILD_NUMBER}" \
    26          tar xf /pachyderm.tar -C /unpack/
    27  
    28      ls -alh pachyderm
    29      sudo chown -R "${USER}:${USER}" pachyderm
    30      cd pachyderm
    31  fi
    32  
    33  # Check that the state we got matches the commit we're supposed to be testing.
    34  parents=$(git rev-list --parents -n 1 HEAD)
    35  if [[ ! "$parents" == *"$TRAVIS_PULL_REQUEST_SHA"* ]]; then
    36      set +x
    37      echo "===================================================================================="
    38      echo "GitHub didn't give us the commit we're meant to be testing ($TRAVIS_PULL_REQUEST_SHA)"
    39      echo "as one of the parents of the HEAD merge preview commit ($parents). Giving up!"
    40      echo "===================================================================================="
    41      set -x
    42      exit 1
    43  fi