-
Notifications
You must be signed in to change notification settings - Fork 166
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added VersionSelectorScript.groovy to select builders for Node version
- Loading branch information
Showing
1 changed file
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
def canBuild(nodeMajorVersion, builderLabel) { | ||
|
||
// Linux | ||
if (builderLabel.indexOf('centos5') == 0 && nodeMajorVersion >= 8) | ||
return false | ||
if (builderLabel.indexOf('centos6') == 0 && nodeMajorVersion < 8) | ||
return false | ||
|
||
// Windows | ||
if (builderLabel.indexOf('vs2013-') == 0 && nodeMajorVersion >= 6) | ||
return false | ||
if (builderLabel.indexOf('vs2015-') == 0 && (nodeMajorVersion < 6 || nodeMajorVersion >= 10)) | ||
return false | ||
if (builderLabel.indexOf('vs2017-') == 0 && nodeMajorVersion < 10) | ||
return false | ||
|
||
// SmartOS | ||
if (builderLabel.indexOf('smartos13') == 0) // Node.js 0.x | ||
return false | ||
if (builderLabel.indexOf('smartos14') == 0 && nodeMajorVersion >= 8) | ||
return false | ||
if (builderLabel.indexOf('smartos15') == 0 && nodeMajorVersion < 8) | ||
return false | ||
|
||
|
||
// PPC BE | ||
if (builderLabel.indexOf('ppcbe-ubuntu') == 0 && nodeMajorVersion >= 8) | ||
return false | ||
|
||
// s390x | ||
if (builderLabel.indexOf('s390x') > -1 && nodeMajorVersion < 6) | ||
return false | ||
|
||
// AIX61 | ||
if (builderLabel.indexOf('aix61') > -1 && nodeMajorVersion < 6) | ||
return false | ||
|
||
return true | ||
} | ||
|
||
// setup for execution of the above rules | ||
|
||
int nodeMajorVersion = -1 | ||
if (parameters['NODEJS_MAJOR_VERSION']) | ||
nodeMajorVersion = parameters['NODEJS_MAJOR_VERSION'].toString().toInteger() | ||
println 'Node.js major version: ' + nodeMajorVersion | ||
println 'Node.js version: ' + parameters['NODEJS_VERSION'] | ||
|
||
result['nodes'] = [] | ||
|
||
combinations.each{ | ||
def builderLabel = it.nodes | ||
if (nodeMajorVersion >= 4) { | ||
if (!canBuild(nodeMajorVersion, builderLabel)) { | ||
println 'Skipping ' + builderLabel + ' for Node.js ' + nodeMajorVersion | ||
return | ||
} | ||
} | ||
result['nodes'] << it | ||
} | ||
|