language: java
jdk:
  - oraclejdk8

cache:
  directories:
  - $HOME/.gradle

before_install:
  - export BRANCH=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then echo $TRAVIS_BRANCH; else echo $TRAVIS_PULL_REQUEST_BRANCH; fi)
  - export ES_VERSION=$(if [[ $BRANCH == es-* ]]; then echo $BRANCH; else echo curl https://api.github.com/repos/elastic/elasticsearch/tags | jq '.[0].name'; fi)
  - echo "TRAVIS_BRANCH=$TRAVIS_BRANCH, PR=$PR, BRANCH=$BRANCH, TAG=$TRAVIS_TAG"
  - echo "ES_VERSION=$ES_VERSION"
  - wget https://raw.githubusercontent.com/elastic/elasticsearch/${BRANCH/es-/v}/buildSrc/version.properties -O gradle.properties

script:
  - ./gradlew clean check

language: java
jdk:
  - oraclejdk8

cache:
  directories:
  - $HOME/.gradle

before_install:
  - export BRANCH=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then echo $TRAVIS_BRANCH; else echo $TRAVIS_PULL_REQUEST_BRANCH; fi)
  - export ES_VERSION=$(if [[ ${BRANCH} == es-* ]] ; then echo ${BRANCH}; else echo $(curl https://api.github.com/repos/elastic/elasticsearch/tags | jq -r '.[0].name'); fi)
  - echo "TRAVIS_BRANCH=$TRAVIS_BRANCH, PR=$PR, BRANCH=$BRANCH, TAG=$TRAVIS_TAG"
  - echo "ES_VERSION=$ES_VERSION"
  - wget https://raw.githubusercontent.com/elastic/elasticsearch/${BRANCH/es-/v}/buildSrc/version.properties -O gradle.properties

script:
  - ./gradlew clean check

Fix how we retrieve latest ES version
Fix how we retrieve latest ES version
