diff --git a/scripts/travis_install.sh b/scripts/travis_install.sh index c73a08a61..50c815cf9 100755 --- a/scripts/travis_install.sh +++ b/scripts/travis_install.sh @@ -2,6 +2,10 @@ set -e -x +# The default build branch for all repositories. This defaults to +# TRAVIS_BRANCH unless set in the Travis build environment. +WTSI_NPG_BUILD_BRANCH=${WTSI_NPG_BUILD_BRANCH:=$TRAVIS_BRANCH} + sudo apt-get install -qq odbc-postgresql sudo apt-get install libgd2-xpm-dev # For npg_tracking sudo apt-get install liblzma-dev # For npg_qc @@ -65,11 +69,13 @@ cpanm --quiet --notest Module::Build # WTSI NPG Perl repo dependencies repos="" for repo in perl-dnap-utilities perl-irods-wrap ml_warehouse npg_ml_warehouse npg_tracking npg_seq_common npg_qc; do - cd /tmp - git clone --branch master --depth 1 ${WTSI_NPG_GITHUB_URL}/${repo}.git ${repo}.git #always clone master when using depth 1 to get current tag - cd /tmp/${repo}.git - git pull origin ${TRAVIS_BRANCH} || echo 'so, staying on master branch....' #shift off master to appropriate branch (if possible) - repos=$repos" /tmp/${repo}.git" + cd /tmp + # Always clone master when using depth 1 to get current tag + git clone --branch master --depth 1 ${WTSI_NPG_GITHUB_URL}/${repo}.git ${repo}.git + cd /tmp/${repo}.git + # Shift off master to appropriate branch (if possible) + git ls-remote --heads --exit-code origin ${WTSI_NPG_BUILD_BRANCH} && git pull origin ${WTSI_NPG_BUILD_BRANCH} && echo "Switched to branch ${WTSI_NPG_BUILD_BRANCH}" + repos=$repos" /tmp/${repo}.git" done # Install CPAN dependencies. The src libs are on PERL5LIB because of