-
Notifications
You must be signed in to change notification settings - Fork 62
/
Copy pathJenkinsfile.server-rcptt-test
145 lines (135 loc) · 8.99 KB
/
Jenkinsfile.server-rcptt-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
pipeline {
agent none
options {
buildDiscarder(logRotator(numToKeepStr: '100'))
throttleJobProperty categories: ['rcptt-jenkins'], limitOneJobWithMatchingParams: false, maxConcurrentPerNode: 3, maxConcurrentTotal: 3, paramsToUseForLimit: '', throttleEnabled: true, throttleOption: 'category'
}
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'
choice(name: 'LANGUAGE', choices: ['de', 'en'],
description: 'The language the application will use. The tests need to support this also.')
booleanParam defaultValue: false, description: 'Run performance tests', name: 'runPerformanceTests'
booleanParam defaultValue: false, description: 'Run reporting tests', name: 'runReportingTests'
string(name: 'TEST_LIST', defaultValue: '*.test',
description: 'Semicolon separated list of tests, or wildcard expression. Use *.test for all tests.')
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: 'SERVER_TIMEOUT', defaultValue: '360',
description: 'The startup timeout of the verinice server.')
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: true,
description: 'Install Melody as server monitor.')
}
stages {
stage('Run RCPTT tests') {
agent {
node {
label 'linux-gui-tester'
}
}
tools {
jdk 'Java11'
}
steps {
sh 'env'
buildDescription "branch: ${env.GIT_BRANCH} (${env.GIT_COMMIT[0..8]})<br>node: ${env.NODE_NAME}<br>tests: ${params.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 = "549${env.EXECUTOR_NUMBER}"
def portTomcat = "829${env.EXECUTOR_NUMBER}"
def portTomcatShutdown = "819${env.EXECUTOR_NUMBER}"
def skipTags = ['skipExecution', 'clientOnlyTest']
if (!params.runPerformanceTests){
skipTags << 'performance'
}
if (!params.runReportingTests){
skipTags << 'report'
}
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="${skipTags.join(';')}" \
-Dtest-options="${params.TEST_OPTIONS}" \
-Dverinice.lang=${params.LANGUAGE} \
-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}"])
}
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
}
}
}
}
}