forked from jenkinsci/pipeline-graph-view-plugin
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmedium-pipeline.jenkinsfile
More file actions
86 lines (80 loc) · 2.81 KB
/
medium-pipeline.jenkinsfile
File metadata and controls
86 lines (80 loc) · 2.81 KB
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
// A medium-sized pipeline exercising sequential stages, flat parallel, nested
// parallel, and wide branch counts. Useful when you want to see the Pipeline
// Overview render a non-trivial graph without waiting on a stress test.
//
// Shape: ~70 user-visible stages, a few hundred FlowNodes. Runs in a minute or
// two. Tune the sleep values and branch counts for bigger or smaller graphs.
def runStage(String name, int sleepSeconds) {
stage(name) {
echo "enter: ${name}"
sleep sleepSeconds
writeFile file: "out/${name.replaceAll('[^A-Za-z0-9]', '_')}.txt", text: name
echo "exit: ${name}"
}
}
node {
runStage('Checkout', 2)
runStage('Install dependencies', 3)
runStage('Lint', 2)
runStage('Format check', 2)
runStage('Static analysis', 2)
stage('Build matrix') {
def matrix = [:]
['linux', 'macos', 'windows', 'freebsd', 'illumos', 'aix'].each { os ->
matrix["Build ${os}"] = {
runStage("${os}: fetch", 1)
runStage("${os}: compile", 3)
runStage("${os}: unit tests", 2)
runStage("${os}: package", 1)
}
}
parallel matrix
}
stage('Integration') {
parallel(
'api': {
parallel(
'api: smoke': { runStage('api smoke', 2) },
'api: contract': { runStage('api contract', 3) },
'api: regression': { runStage('api regression', 4) },
)
},
'browser': {
parallel(
'browser: chrome': { runStage('chrome', 3) },
'browser: firefox': { runStage('firefox', 3) },
'browser: safari': { runStage('safari', 3) },
'browser: edge': { runStage('edge', 3) },
)
},
'perf': {
runStage('perf: baseline', 2)
runStage('perf: load', 4)
runStage('perf: stress', 5)
},
'security': {
runStage('dep audit', 2)
runStage('sast', 3)
runStage('dast', 4)
},
)
}
stage('Publish artifacts') {
def publishers = [:]
// C-style loop: (1..8).each would push an IntRange through a parallel
// closure, which is not CPS-serialisable and fails at checkpoint.
for (int i = 1; i <= 8; i++) {
def idx = i
publishers["Publish region ${idx}"] = {
runStage("upload region ${idx}", 1)
runStage("verify region ${idx}", 1)
}
}
parallel publishers
}
runStage('Release notes', 1)
runStage('Changelog', 2)
runStage('Tag', 2)
runStage('Announce', 1)
runStage('Cleanup', 1)
}