-
Notifications
You must be signed in to change notification settings - Fork 62
/
Copy pathJenkinsfile.rcptt-server-performance-test
161 lines (151 loc) · 9.08 KB
/
Jenkinsfile.rcptt-server-performance-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
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
pipeline {
agent {
label 'linux-gui-performance-tester'
}
environment {
JAVA_HOME = '/usr/lib/jvm/java-11-openjdk-amd64/'
}
options {
buildDiscarder(logRotator(numToKeepStr: '30'))
disableConcurrentBuilds()
}
parameters {
gitParameter branch: '', branchFilter: '.*', defaultValue: 'develop' , quickFilterEnabled: true, selectedValue: 'NONE', sortMode: 'NONE', tagFilter: '*', type: 'PT_BRANCH_TAG',
description: 'The branch or that that the tests are taken from', name: 'BRANCH_OR_TAG'
string name: 'job_to_copy_from', defaultValue: 'verinice/develop',
description: '''The job that the AUT is copied from<br/>
Please note that slashes in the branch-name must be escaped as %2F, e.g. <code>verinice/feature%2Fvn-0000-make-everything-great</code>.'''
buildSelector name: 'build_to_copy_from',
description: 'The build number of the job that the AUT is copied from'
string(name: 'TEST_LIST', defaultValue: '*-performance.test',
description: 'Semicolon separated list of tests, or wildcard expressions. Use *.test for all tests.')
string(name: 'SERVER_TIMEOUT', defaultValue: '580',
description: 'The startup timeout of the verinice server.')
choice name: 'TOMCAT_VERSION', choices: ['7.0.94', '8.5.43', '6.0.53'],
description: 'The tomcat to deploy the jar to.'
string(name: 'POSTGRESQL_VERSION', defaultValue: '9.4',
description: 'The postgres database version to use.')
string(name: 'TEST_OPTIONS', defaultValue: 'testExecTimeout=45000;execTimeout=410000;reportingIncludeIgnoredWaitDetails=true;passedTestDetails=true;runtimeEnableActivityLogs=true;q7ImageCapture=true;jobHangTimeout=900000;contextRunnableTimeout=900000',
description: 'The options of the rcptt testing program.')
booleanParam(name: 'monitor_server', defaultValue: false,
description: 'Install Melody as server monitor.')
}
stages {
stage('Run RCPTT tests') {
steps {
sh 'env'
buildDescription "branch: ${env.GIT_BRANCH} (${env.GIT_COMMIT[0..8]})<br>tests: ${env.TEST_LIST}"
sh """
rm -f -r apache-tomcat-${params.TOMCAT_VERSION}
rm -f -r *.zip
echo "using tomcat : ${params.TOMCAT_VERSION}"
wget http://bob.int.sernet.de/tomcat-distributions/apache-tomcat-${params.TOMCAT_VERSION}.zip
unzip -q apache-tomcat-${params.TOMCAT_VERSION}.zip
rm -f -r war
"""
copyArtifacts filter: "**/verinice-*${VERINICE_CLIENT_SELECTOR_OS_COMPONENT}.zip",
fingerprintArtifacts: true, flatten: true,
projectName: params.job_to_copy_from,
selector: buildParameter(params.build_to_copy_from)
copyArtifacts filter: 'sernet.verinice.releng.server.product/target/*.war',
fingerprintArtifacts: true, flatten: true,
projectName: params.job_to_copy_from,
target: 'war',
selector: buildParameter(params.build_to_copy_from)
sh 'mv war/*.war veriniceserver.war'
script {
def portDatabase = "559${env.EXECUTOR_NUMBER}"
def portTomcat = "803${env.EXECUTOR_NUMBER}"
def portTomcatShutdown = "813${env.EXECUTOR_NUMBER}"
if (params.monitor_server){
env.MELODY_TOOL_PATH = 'gui-test-runner/etc/melody'
}
docker.image("postgres:${params.POSTGRESQL_VERSION}-alpine").withRun("--name postgresql-verinice-server-rcptt-test-executor-${env.BUILD_NUMBER} -e POSTGRES_USER=verinice -e POSTGRES_PASSWORD=verinice -e POSTGRES_DB=verinicedb -p ${portDatabase}:5432") { db ->
wrap([$class: 'Xvfb', additionalOptions: '', assignedLabels: '',
autoDisplayName: true, displayNameOffset: 0, installationName: 'default-Xvfb',
screen: '1200x960x24']) {
withAnt(installation: 'Ant 1.9.0') {
withEnv(["rcptt_runner_HOME=${tool name: 'rcptt_runner-nightly', type: 'com.cloudbees.jenkins.plugins.customtools.CustomTool'}"]) {
sh """
ant -buildfile gui-test-runner/start-gui-test.xml test-verinice-server-test-custom \
-Drunner-path=${rcptt_runner_HOME} \
-Dverinice.timeout=${params.SERVER_TIMEOUT} \
-Dtest-list="${params.TEST_LIST}" \
-Dskip-tags="skipExecution;serverOnlyTest" \
-Dtest-options="${params.TEST_OPTIONS}" \
-Dverinice.lang=de \
-Dserver-database-url=jdbc:postgresql://127.0.0.1:${portDatabase}/verinicedb \
-Dtomcat-dir=${WORKSPACE}/apache-tomcat-${params.TOMCAT_VERSION} \
-Dwar-file=veriniceserver.war \
-Dserver-port=${portTomcat} \
-Dserver-shutdown-port=${portTomcatShutdown}
"""
}
}
}
}
}
dir(tool(name: 'logparser', type: 'com.cloudbees.jenkins.plugins.customtools.CustomTool')){
sh "./logParser -i log4j -d $WORKSPACE/gui-test-runner/result/log -f verinice-client.* -o jenkins -n $WORKSPACE/gui-test-runner/result/log/clientlogparsed.txt"
}
dir(tool(name: 'logparser', type: 'com.cloudbees.jenkins.plugins.customtools.CustomTool')){
sh "./logParser -i log4j -d $WORKSPACE/gui-test-runner/result/log -f verinice-server.* -o jenkins -n $WORKSPACE/gui-test-runner/result/log/serverlogparsed.txt"
}
junit testDataPublishers: [[$class: 'StabilityTestDataPublisher']], testResults: 'gui-test-runner/result/results.junit.xml'
perfReport filterRegex: '', sourceDataFiles: 'gui-test-runner/result/results.junit.xml'
recordIssues(tools: [groovyScript(parserId: 'aut-eclipse-log', pattern: 'gui-test-runner/result/log/verinice-aut/.log*')])
recordIssues(tools: [groovyScript(id: 'verince-client-log', name: 'verince-client-log', parserId: 'verinice-log-parser', pattern: 'gui-test-runner/result/log/clientlogparsed.txt')])
recordIssues(tools: [groovyScript(id: 'verince-server-log', name: 'verince-server-log', parserId: 'verinice-log-parser', pattern: 'gui-test-runner/result/log/serverlogparsed.txt')])
publishHTML([allowMissing: false, alwaysLinkToLastBuild: false, keepAll: true, reportDir: 'gui-test-runner/result', reportFiles: 'results.html', reportName: 'Gui Test Report', reportTitles: "${job_to_copy_from}"])
}
}
stage('Plot data') {
steps {
script{
def fileName = 'gui-test-runner/result/metric.csv'
def records = readCSV file: fileName
def data = records[1]
def measurementLabels = data.collate(5).collect{it.first().trim()}.findAll{!it.empty}
measurementLabels.each { label->
callPlot fileName, label
}
}
}
}
}
post {
always {
archiveArtifacts allowEmptyArchive: true, artifacts: 'gui-test-runner/result/**/*.*', excludes: 'build/result/auth/**'
notifyBitbucket stashServerBaseUrl: 'https://git.verinice.org/bb',
credentialsId: 'bitbucket',
commitSha1: '',
considerUnstableAsSuccess: false,
disableInprogressNotification: false,
ignoreUnverifiedSSLPeer: false,
includeBuildNumberInKey: false,
prependParentProjectKey: false,
buildStatus: currentBuild.result,
buildName: currentBuild.fullDisplayName,
projectKey: ''
cleanWs patterns: [[pattern: '*.zip', type: 'INCLUDE']],
notFailBuild: true
}
}
}
def callPlot(String fileName, String plotName) {
echo "Creating plot ${plotName}"
def plotgroup = 'performance'
def g = plotName.split(':')
if (g.length > 1){
plotgroup = g[g.length-2]
}
plot csvFileName: 'plot-'+plotName+'.csv',
csvSeries: [[displayTableFlag: false,
exclusionValues: plotName+'-avg,'+plotName+'-min,'+plotName+'-max',
file: fileName,
inclusionFlag: 'INCLUDE_BY_STRING',
url: '']],
group: plotgroup,
style: 'line',
title: plotName
}