-
Notifications
You must be signed in to change notification settings - Fork 169
Files
/
Copy pathVersionSelectorScript.groovy
137 lines (118 loc) · 6.6 KB
1
2
3
// https://wiki.jenkins.io/display/JENKINS/matrix+groovy+execution+strategy+plugin
// https://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html
4
// Helper closures to make our buildExclusions DSL terse and readable
5
6
def lt = { v -> { nodeVersion -> nodeVersion < v } }
def gte = { v -> { nodeVersion -> nodeVersion >= v } }
7
def gteLt = { vGte, vLt -> { nodeVersion -> gte(vGte)(nodeVersion) && lt(vLt)(nodeVersion) } }
8
9
10
def ltGte = { vLt, vGte -> { nodeVersion -> lt(vLt)(nodeVersion) || gte(vGte)(nodeVersion) } }
def allVer = { nodeVersion -> true }
def noVer = { nodeVersion -> false }
11
def releaseType = { buildType -> buildType == 'release' }
12
def testType = { buildType -> buildType == 'test' }
13
def anyType = { buildType -> true }
14
15
def buildExclusions = [
16
17
18
19
20
21
22
// Given a machine label, build type (release or !release) and a Node.js
// major version number, determine which ones to _exclude_ from a build
// -------------------------------------------------------
// Machine Label, Build Type, Node Version
// Linux -------------------------------------------------
23
[ /debian11/, anyType, gte(23) ],
24
[ /alpine-last-latest/, anyType, gte(22) ], // Alpine 3.18. Bug in GCC 12.2.
25
[ /rhel7/, anyType, gte(18) ],
26
27
[ /^ubuntu1604-32/, anyType, gte(18) ], // 32-bit linux for <10 only
[ /^ubuntu1604-64/, anyType, gte(18) ],
28
29
// ARM --------------------------------------------------
30
[ /^ubuntu1804-arm64/, anyType, gte(20) ], // 20.x: gcc8 builds stop
31
32
33
[ /^cross-compiler-ubuntu1604-armv[67]-gcc-4.9/, anyType, gte(18) ],
[ /^cross-compiler-ubuntu1604-armv[67]-gcc-6/, anyType, gte(18) ],
[ /^cross-compiler-ubuntu1804-armv7-gcc-6/, anyType, gte(18) ],
34
35
36
[ /^cross-compiler-ubuntu1804-armv7-gcc-8/, anyType, gte(18) ],
[ /^cross-compiler-rhel8-armv7-gcc-8-glibc-2.28/, anyType, gte(20) ],
[ /^cross-compiler-rhel8-armv7-gcc-10-glibc-2.28/, anyType, lt(20) ],
37
38
[ /^cross-compiler-rhel8-armv7-gcc-10-glibc-2.28/, anyType, gte(23) ],
[ /^cross-compiler-rhel9-armv7-gcc-12-glibc-2.28/, anyType, lt(23) ],
39
40
// Windows -----------------------------------------------
41
// https://github.com/nodejs/build/blob/main/doc/windows-visualstudio-supported-versions.md
42
// Release Builders - should only match one VS version per Node.js version
43
44
[ /vs2015/, releaseType, gte(18) ],
[ /vs2017/, releaseType, gte(18) ],
45
[ /vs2019-arm64/, releaseType, lt(20) ],
46
[ /vs2019/, releaseType, gte(21) ],
47
[ /vs2022-x86/, releaseType, gte(23) ],
48
[ /vs2022/, releaseType, lt(21) ],
49
50
[ /vs2022(?!_clang)(-\w+)?$/, releaseType, gte(24) ],
[ /vs2022_clang/, releaseType, lt(24) ],
51
// VS versions supported to compile Node.js - also matches labels used by test runners
52
53
[ /vs2015(-\w+)?$/, testType, gte(18) ],
[ /vs2017(-\w+)?$/, testType, gte(18) ],
54
[ /vs2019(-\w+)?$/, testType, gte(21) ],
55
56
[ /vs2022(-\w+)?$/, testType, lt(21) ],
[ /vs2022-x86$/, testType, gte(23) ], // x86 was dropped on Windows in v23
57
[ /vs2022(?!_clang)(-\w+)?$/, testType, gte(24) ], // MSVC was dropped on Windows in v24
58
[ /vs2022_clang(-\w+)?$/, testType, lt(24) ], // ClangCL support was added in v23
59
[ /COMPILED_BY-\w+-arm64$/, testType, lt(20) ], // run tests on arm64 for >=19
60
// VS versions supported to build add-ons
61
[ /vs2015-COMPILED_BY/, testType, gte(20) ],
62
[ /vs2017-COMPILED_BY/, testType, gte(22) ],
63
64
// SmartOS -----------------------------------------------
65
[ /^smartos18/, anyType, gte(18) ],
66
67
68
// FreeBSD -----------------------------------------------
[ /^freebsd12/, anyType, gte(22) ],
69
[ /^freebsd13/, anyType, gte(22) ], // https://github.com/nodejs/node/issues/54576
70
71
// Shared libs docker containers -------------------------
72
[ /sharedlibs_debug_x64/, anyType, gte(18) ],
73
74
[ /sharedlibs_openssl110/, anyType, gte(18) ],
[ /sharedlibs_openssl102/, anyType, gte(18) ],
75
[ /sharedlibs_openssl35/, anyType, lt(24) ], // Temporary until test fixes are backported
76
[ /sharedlibs_fips20/, anyType, gte(18) ],
77
78
// OSX ---------------------------------------------------
79
[ /osx1015/, anyType, gte(21) ],
80
81
// Source / headers / docs -------------------------------
82
[ /^rhel8-release-sources$/, releaseType, lt(18) ],
83
84
// -------------------------------------------------------
85
86
87
88
89
90
91
92
93
94
95
96
]
def canBuild = { nodeVersion, builderLabel, buildType ->
buildExclusions.findResult(true) { // this works like an array.contains(), returns true (default) or false
def match = it[0]
def type = it[1]
def version = it[2]
if (version(nodeVersion) && type(buildType) && builderLabel =~ match)
return false
return null
}
97
98
99
100
101
}
// setup for execution of the above rules
int nodeMajorVersion = -1