Skip to content

Commit 94b5141

Browse files
Valentin Hoyetbgoglin
authored andcommitted
ci.inria.fr: check for available nodes
Only run on connected slaves, instead of waiting for hours. Signed-off-by: Valentin Hoyet <[email protected]>
1 parent c8800bf commit 94b5141

File tree

2 files changed

+44
-1
lines changed

2 files changed

+44
-1
lines changed

contrib/ci.inria.fr/Jenkinsfile-basic

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,33 @@
1111
// In "Additional Behaviours", enable "Checkout to specific local branch"
1212
// and leave "Branch name" empty.
1313
// Not needed for multi-branch pipelines which already BRANCH_NAME in the environment.
14+
import hudson.model.*
1415

1516
def gitBranch = ""
1617
def tarballgz
1718
def tarballbz2
1819
def statusHasChanged = false
1920

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+
2041
pipeline {
2142
agent none
2243

@@ -54,11 +75,11 @@ pipeline {
5475
node -> node.getLabelString().contains(labelToSelect) ? node.name : null
5576
}
5677
listOfNodeNames.removeAll(Collections.singleton(null))
78+
listOfNodeNames = filterAvailableNode(listOfNodeNames)
5779
}
5880
if (env.NO_MSVC != 'true') {
5981
listOfNodeNames.push('VisualStudio')
6082
}
61-
6283
def p = listOfNodeNames.collectEntries {
6384
[ (it): {
6485
if (it != 'VisualStudio') {

contrib/ci.inria.fr/Jenkinsfile-extended

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,34 @@
1313
// In "Additional Behaviours", enable "Checkout to specific local branch"
1414
// and leave "Branch name" empty.
1515
// Not needed for multi-branch pipelines which already BRANCH_NAME in the environment.
16+
import hudson.model.*
1617

1718
def gitRepoURL = ""
1819
def gitBranch = ""
1920
def tarballgz
2021
def tarballbz2
2122
def statusHasChanged = false
2223

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+
2344
pipeline {
2445
agent none
2546

@@ -67,6 +88,7 @@ pipeline {
6788
node -> node.getLabelString().contains(labelToSelect) ? node.name : null
6889
}
6990
listOfNodeNames.removeAll(Collections.singleton(null))
91+
listOfNodeNames = filterAvailableNode(listOfNodeNames)
7092
}
7193
if (env.NO_MINGW != 'true') {
7294
listOfNodeNames.push('MinGW')

0 commit comments

Comments
 (0)