ES_BRANCH can also be a tag, so changed to ES_REF
This commit is contained in:
@ -16,8 +16,16 @@ var defaultOpts = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
function setBranchConfig(branch, target) {
|
/**
|
||||||
switch (branch) {
|
* set config vars based on the ref.
|
||||||
|
*
|
||||||
|
* @param {string} ref - either a tag or branch name
|
||||||
|
* @param {[type]} target - the grunt target to configure
|
||||||
|
*/
|
||||||
|
function setConfig(ref, target) {
|
||||||
|
var minorV = String(ref).replace(/^v/, '').replace(/(\d+\.\d+)\..+/, '$1');
|
||||||
|
|
||||||
|
switch (minorV) {
|
||||||
case '0.90':
|
case '0.90':
|
||||||
case '1.0':
|
case '1.0':
|
||||||
case '1.1':
|
case '1.1':
|
||||||
@ -56,14 +64,14 @@ utils.branches.forEach(function (branch) {
|
|||||||
branch: branch
|
branch: branch
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
setBranchConfig(branch, exports[branch]);
|
setConfig(branch, exports[branch]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// ci target, based on env variables
|
// ci target, based on env variables
|
||||||
(function () {
|
(function () {
|
||||||
var release = process.env.ES_RELEASE;
|
var release = process.env.ES_RELEASE;
|
||||||
var branch = process.env.ES_BRANCH;
|
var ref = process.env.ES_REF;
|
||||||
var port = process.env.ES_PORT;
|
var port = process.env.ES_PORT;
|
||||||
|
|
||||||
var options = {
|
var options = {
|
||||||
@ -75,13 +83,14 @@ utils.branches.forEach(function (branch) {
|
|||||||
if (release) {
|
if (release) {
|
||||||
options.version = release;
|
options.version = release;
|
||||||
}
|
}
|
||||||
else if (branch) {
|
else if (ref) {
|
||||||
options.branch = branch;
|
// assume it is a ref to a branch
|
||||||
|
options.branch = ref;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.ci_env = { options: options };
|
exports.ci_env = { options: options };
|
||||||
setBranchConfig(branch, exports.ci_env);
|
setConfig(ref, exports.ci_env);
|
||||||
}());
|
}());
|
||||||
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* ENV VARS:
|
* ENV VARS:
|
||||||
* RUN - a list of task names to run, specifying this turns of all other tasks
|
* RUN - a list of task names to run, specifying this turns of all other tasks
|
||||||
* ES_BRANCH - the ES branch we should use to generate the tests and download es
|
* ES_REF - the ES branch/tag we should use to generate the tests and download es
|
||||||
* ES_RELEASE - a specific ES release to download in use for testing
|
* ES_RELEASE - a specific ES release to download in use for testing
|
||||||
* ES_PORT - the port number we should run elasticsearch on
|
* ES_PORT - the port number we should run elasticsearch on
|
||||||
* ES_V - a version identifier used by jenkins. don't use this
|
* ES_V - a version identifier used by jenkins. don't use this
|
||||||
@ -45,7 +45,7 @@ task('NODE_UNIT', true, function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
task('NODE_INTEGRATION', true, function () {
|
task('NODE_INTEGRATION', true, function () {
|
||||||
var branch = ENV.ES_BRANCH;
|
var branch = ENV.ES_REF;
|
||||||
|
|
||||||
return node('scripts/generate', '--no-api', '--branch', branch)
|
return node('scripts/generate', '--no-api', '--branch', branch)
|
||||||
.then(function () {
|
.then(function () {
|
||||||
@ -134,8 +134,8 @@ execTask('SETUP', function () {
|
|||||||
if (ENV.ES_RELEASE)
|
if (ENV.ES_RELEASE)
|
||||||
return ['v' + ENV.ES_RELEASE, ENV.ES_RELEASE];
|
return ['v' + ENV.ES_RELEASE, ENV.ES_RELEASE];
|
||||||
|
|
||||||
if (ENV.ES_BRANCH)
|
if (ENV.ES_REF)
|
||||||
return [ENV.ES_BRANCH, null];
|
return [ENV.ES_REF, null];
|
||||||
}
|
}
|
||||||
|
|
||||||
var match;
|
var match;
|
||||||
@ -149,12 +149,12 @@ execTask('SETUP', function () {
|
|||||||
})
|
})
|
||||||
.then(function readOtherConf(ver) {
|
.then(function readOtherConf(ver) {
|
||||||
if (!ver)
|
if (!ver)
|
||||||
throw new Error('Unable to run the ci script without at least an ES_BRANCH or ES_RELEASE environment var.');
|
throw new Error('Unable to run the ci script without at least an ES_REF or ES_RELEASE environment var.');
|
||||||
|
|
||||||
log('ES_PORT:', ENV.ES_PORT = parseInt(ENV.ES_PORT || 9400, 10));
|
log('ES_PORT:', ENV.ES_PORT = parseInt(ENV.ES_PORT || 9400, 10));
|
||||||
|
|
||||||
if (ver[0]) log('ES_BRANCH:', ENV.ES_BRANCH = ver[0]);
|
if (ver[0]) log('ES_REF:', ENV.ES_REF = ver[0]);
|
||||||
else delete ENV.ES_BRANCH;
|
else delete ENV.ES_REF;
|
||||||
|
|
||||||
if (ver[1]) log('ES_RELEASE:', ENV.ES_RELEASE = ver[1]);
|
if (ver[1]) log('ES_RELEASE:', ENV.ES_RELEASE = ver[1]);
|
||||||
else delete ENV.ES_RELEASE;
|
else delete ENV.ES_RELEASE;
|
||||||
|
|||||||
Reference in New Issue
Block a user