File tree Expand file tree Collapse file tree 2 files changed +44
-1
lines changed Expand file tree Collapse file tree 2 files changed +44
-1
lines changed Original file line number Diff line number Diff line change 11
11
// In "Additional Behaviours", enable "Checkout to specific local branch"
12
12
// and leave "Branch name" empty.
13
13
// Not needed for multi-branch pipelines which already BRANCH_NAME in the environment.
14
+ import hudson.model.*
14
15
15
16
def gitBranch = " "
16
17
def tarballgz
17
18
def tarballbz2
18
19
def statusHasChanged = false
19
20
21
+ def filterAvailableNode (nodeList ) {
22
+ def nodeToDelete = []
23
+ nodeList. each { node ->
24
+ echo " Searching for $node " ;
25
+ if (node != null ) {
26
+ computer = Jenkins . instance. getNode(node). toComputer();
27
+ if (computer. isOffline()) {
28
+ echo " Error: $node is offline." ;
29
+ nodeToDelete. add(node);
30
+ }
31
+ }
32
+ else {
33
+ echo " Error: $node not found!" ;
34
+ nodeToDelete. add(node);
35
+ }
36
+ }
37
+
38
+ return nodeList. findAll { ! nodeToDelete. contains(it) }
39
+ }
40
+
20
41
pipeline {
21
42
agent none
22
43
@@ -54,11 +75,11 @@ pipeline {
54
75
node -> node. getLabelString(). contains(labelToSelect) ? node. name : null
55
76
}
56
77
listOfNodeNames. removeAll(Collections . singleton(null ))
78
+ listOfNodeNames = filterAvailableNode(listOfNodeNames)
57
79
}
58
80
if (env. NO_MSVC != ' true' ) {
59
81
listOfNodeNames. push(' VisualStudio' )
60
82
}
61
-
62
83
def p = listOfNodeNames. collectEntries {
63
84
[ (it): {
64
85
if (it != ' VisualStudio' ) {
Original file line number Diff line number Diff line change 13
13
// In "Additional Behaviours", enable "Checkout to specific local branch"
14
14
// and leave "Branch name" empty.
15
15
// Not needed for multi-branch pipelines which already BRANCH_NAME in the environment.
16
+ import hudson.model.*
16
17
17
18
def gitRepoURL = " "
18
19
def gitBranch = " "
19
20
def tarballgz
20
21
def tarballbz2
21
22
def statusHasChanged = false
22
23
24
+ def filterAvailableNode (nodeList ) {
25
+ def nodeToDelete = []
26
+ nodeList. each { node ->
27
+ echo " Searching for $node " ;
28
+ if (node != null ) {
29
+ computer = Jenkins . instance. getNode(node). toComputer();
30
+ if (computer. isOffline()) {
31
+ echo " Error: $node is offline." ;
32
+ nodeToDelete. add(node);
33
+ }
34
+ }
35
+ else {
36
+ echo " Error: $node not found!" ;
37
+ nodeToDelete. add(node);
38
+ }
39
+ }
40
+
41
+ return nodeList. findAll { ! nodeToDelete. contains(it) }
42
+ }
43
+
23
44
pipeline {
24
45
agent none
25
46
@@ -67,6 +88,7 @@ pipeline {
67
88
node -> node. getLabelString(). contains(labelToSelect) ? node. name : null
68
89
}
69
90
listOfNodeNames. removeAll(Collections . singleton(null ))
91
+ listOfNodeNames = filterAvailableNode(listOfNodeNames)
70
92
}
71
93
if (env. NO_MINGW != ' true' ) {
72
94
listOfNodeNames. push(' MinGW' )
You can’t perform that action at this time.
0 commit comments