-
Notifications
You must be signed in to change notification settings - Fork 166
/
VersionSelectorScript.groovy
61 lines (48 loc) · 1.65 KB
/
VersionSelectorScript.groovy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
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
}