-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
89 lines (82 loc) · 2.92 KB
/
Jenkinsfile
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
87
88
89
def podLabel = UUID.randomUUID().toString()
def jmeterVersion = 5.3
def artifactsDirectory = 'artifacts'
String bztRepo = "agrisin/bzt"
String bztVersion = 'latest'
properties([
buildDiscarder(logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '5', numToKeepStr: '5')),
parameters([
choice(choices: ['search', 'home'], description: '', name: 'scenario'),
choice(choices: ['10', '100', '1000'], description: '', name: 'iterations')
])
])
podTemplate(
label: podLabel,
containers: [
containerTemplate(
name: 'bzt',
image: "$bztRepo:$bztVersion",
alwaysPullImage: true,
ttyEnabled: true,
command: 'cat',
workingDir: '/home/jenkins/agent'
)
]
)
{
node(podLabel) {
try
{
stage('checkout') {
checkout scm
}
container('bzt') {
stage('run tests') {
sh "bzt execute.yml \
-o modules.jmeter.version=${jmeterVersion} \
-o settings.artifacts-dir=${artifactsDirectory} \
-o execution.0.scenario=${params.scenario} \
-o execution.0.write-xml-jtl=full \
-o execution.0.iterations=${params.iterations} "
}
}
container('bzt') {
stage('publish performance trends') {
perfReport(compareBuildPrevious: true,
modeOfThreshold: true,
relativeUnstableThresholdPositive: -1,
sourceDataFiles: 'stats.xml')
}
}
container('bzt') {
stage('jmeter report') {
sh "/root/.bzt/jmeter-taurus/${jmeterVersion}/bin/jmeter -g ${artifactsDirectory}/trace.jtl -o report"
sh "tar czf report.tar.gz report/"
sh "tar czf artifacts.tar.gz ${artifactsDirectory}/"
}
}
}
catch (any)
{
currentBuild.result = 'FAILURE'
throw any
}
finally
{
if (currentBuild.result == null)
{
currentBuild.result = 'SUCCESS'
}
archiveArtifacts 'artifacts.tar.gz'
archiveArtifacts 'report.tar.gz'
publishHTML(target: [
allowMissing : false,
alwaysLinkToLastBuild: true,
keepAll : true,
reportDir : 'report',
reportFiles : 'index.html',
reportName : "Performance Report"
])
}
}
}