From 4680930487f163b6556a5c26dfaad351d2a10a0a Mon Sep 17 00:00:00 2001 From: Spencer Alger Date: Wed, 5 Feb 2014 09:06:52 -0700 Subject: [PATCH] only generate the necessary branch in CI environments --- scripts/ci.sh | 2 +- scripts/generate/index.js | 17 +++++++++++------ scripts/jenkins.sh | 8 ++++---- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/scripts/ci.sh b/scripts/ci.sh index 23745320a..ec57b7d03 100755 --- a/scripts/ci.sh +++ b/scripts/ci.sh @@ -43,7 +43,7 @@ fi if [[ "$NODE_INTEGRATION" != "0" ]]; then group "generating tests" - call node scripts/generate --no-api + call node scripts/generate --no-api --branch $TESTING_BRANCH group "running integration tests" if [[ -n "$JENKINS" ]]; then diff --git a/scripts/generate/index.js b/scripts/generate/index.js index e58fa3896..a717740f8 100644 --- a/scripts/generate/index.js +++ b/scripts/generate/index.js @@ -19,6 +19,10 @@ var argv = require('optimist') update: { default: true, boolean: true + }, + branch: { + default: null, + string: true } }); @@ -29,12 +33,6 @@ var utils = require(fromRoot('grunt/utils')); var esUrl = 'https://github.com/elasticsearch/elasticsearch.git'; var branches; -if (process.env.ES_GIT_BRANCH) { - branches = [process.env.ES_GIT_BRANCH.split('/').slice(1).join('/')]; -} else { - branches = utils.branches; -} - if (process.env.npm_config_argv) { // when called by NPM argv = argv.parse(JSON.parse(process.env.npm_config_argv).original); @@ -43,6 +41,13 @@ if (process.env.npm_config_argv) { argv = argv.argv; } +if (argv.branch) { + branches = [argv.branch]; +} else { + branches = utils.branches; +} + + function isDirectory(dir) { var stat; try { stat = fs.statSync(dir); } catch (e) {} diff --git a/scripts/jenkins.sh b/scripts/jenkins.sh index 2d0eeb535..0824e4484 100755 --- a/scripts/jenkins.sh +++ b/scripts/jenkins.sh @@ -17,11 +17,11 @@ re_10='^1\.0\..*$'; if [[ "$ES_V" =~ $re_nightly ]]; then export ES_BRANCH=${BASH_REMATCH[1]} elif [[ "$ES_V" =~ $re_090 ]]; then - ES_BRANCH='0.90' - ES_RELEASE=$ES_V + export ES_BRANCH='0.90' + export ES_RELEASE=$ES_V elif [[ "$ES_V" =~ $re_10 ]]; then - ES_BRANCH='1.0' - ES_RELEASE=$ES_V + export ES_BRANCH='1.0' + export ES_RELEASE=$ES_V else echo "unable to parse ES_V $ES_V" exit 1