-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathjenkinsfile-test
51 lines (38 loc) · 1.22 KB
/
jenkinsfile-test
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
import jenkins.instance.clouds.*
//this jenkinsfile runs all the available docker templates to ensure the template config is correct and that the containers can launch
def parallelStages = [:]
def allAgents= []
def listTemplates() {
def cloud
def labels
def agents= []
cloud = Jenkins.instance.clouds.get(0)
labels=cloud.getLabels()
labels.each { t ->
agents.add(t.toString())
}
return agents
}
allAgents=listTemplates()
//allAgents=['download'] - useful for testing just one
pipeline {
agent any
stages {
stage("Fire up container") {
steps {
script {
allAgents.each { p ->
parallelStages[p] = {
node(p) {
stage(p) {
sh("echo 'Container template - $p' ; python --version || python3 --version; java -version ")
}
}
}
}
parallel parallelStages
}
}
}
}
}