Skip to content

Commit

Permalink
Sync the OSX CI eagerly and add diagnostics.
Browse files Browse the repository at this point in the history
Move the OSX CI sync up-front to leverage parallelism
instead of waiting on the whole local build matrix to complete.

Also add diagnostics that record why the sync is skipped if
skipped in addition to making skipping & syncing decisions more
robust and explicit.

Testing Done:
CI away here already shows proper fork sync-skipping diagnostic: https://travis-ci.org/pantsbuild/pants/builds/35967008
This will have to land on pantsbuild/pants master to vet fully.

Bugs closed: 599

Reviewed at https://rbcommons.com/s/twitter/r/1064/
  • Loading branch information
jsirois committed Sep 22, 2014
1 parent fd1890e commit 179816b
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 11 deletions.
18 changes: 7 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ jdk:
install:
- pip install coveralls

script: |
uname -a
java -version
./build-support/bin/ci.sh -d
env:
global:
# Credentials for OSX syncing: GH_USER, GH_EMAIL, GH_TOKEN
Expand All @@ -25,12 +20,13 @@ env:
# See: http://docs.travis-ci.com/user/encryption-keys/
- secure: VvwbndU++a2/iNAjk9cd67ATiipDwqcKnxDR4/J2Ik3GH10wHEDUhJ1+MK4WLhedfaOakDOEmarZQS3GwtgvCHO3knpTJuJc8d/bCfZovYuSqdi//BEv4dS7hDt6tQeJfkbBjG0T4yNjPJ3W9R9KDWCy/vj2CUm90BGg2CmxUbg=

after_script: |
# Only sync pantsbuild/pants-for-travis-osx-ci on pushes to pantsbuild/pants master
if [[ TRAVIS_PULL_REQUEST == "false" && TRAVIS_BRANCH == "master" ]]
then
./build-support/bin/ci-sync.sh
fi
before_script: |
./build-support/bin/ci-sync.sh
script: |
uname -a
java -version
./build-support/bin/ci.sh -d
notifications:
email:
Expand Down
37 changes: 37 additions & 0 deletions build-support/bin/ci-sync.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,46 @@
#
# See .travis.osx.yml at the root of this repo for more information.

# Only sync pantsbuild/pants-for-travis-osx-ci on pushes to pantsbuild/pants master
# and only do this for 1 CI job in the build matrix.

# The secured GH_* env vars will only be set for the pantsbuild/pants repo and
# not for its forks, see:
# http://docs.travis-ci.com/user/pull-requests/#Security-Restrictions-when-testing-Pull-Requests
if [[ -z ${GH_TOKEN} ]]
then
echo "Not syncing OSX CI for fork of pantsbuild/pants."
exit 0
fi

# See this env var reference:
# http://docs.travis-ci.com/user/ci-environment/#Environment-variables
if [[ "${TRAVIS_BRANCH}" != "master" ]]
then
echo "Not syncing OSX CI for branch ${TRAVIS_BRANCH}."
exit 0
fi

# Iff there is an associated pull request, we'll have an env var like:
# TRAVIS_PULL_REQUEST=123
if (( ${TRAVIS_PULL_REQUEST:-0} > 0 ))
then
echo "Not syncing OSX CI for pull request ${TRAVIS_PULL_REQUEST}."
exit 0
fi

if [[ "${TRAVIS_BUILD_NUMBER}" != "${TRAVIS_JOB_NUMBER}" && \
"${TRAVIS_JOB_NUMBER/${TRAVIS_BUILD_NUMBER}./}" != "1" ]]
then
echo "Not syncing OSX CI for auxillary CI job ${TRAVIS_JOB_NUMBER}."
exit 0
fi

echo "Syncing OSX CI to $(git rev-parse HEAD) for CI build ${TRAVIS_BUILD_NUMBER}." && \
cp .travis.osx.yml .travis.yml && \
GIT_AUTHOR_NAME="${GH_USER}" GIT_AUTHOR_EMAIL=${GH_EMAIL} \
git commit -am "Prepare pants OSX mirror for CI." && \
git config credential.helper "store --file=.git/credentials" && \
echo "https://${GH_TOKEN}:@github.com" > .git/credentials && \
git push -f https://github.com/pantsbuild/pants-for-travis-osx-ci.git HEAD:master

0 comments on commit 179816b

Please sign in to comment.