forked from SerNet/verinice
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile.rcptt-client-test
117 lines (113 loc) · 7.34 KB
/
Jenkinsfile.rcptt-client-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
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.')
choice(name: 'OPERATING_SYSTEM', choices: ['Linux', 'macOS current', 'macOS predecessor', 'Windows 10', 'any'],
description: 'The operating that the tests should run on.')
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 expressions. Use *.test for all tests.')
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.')
}
stages {
stage('Run RCPTT tests') {
agent {
node {
label(['Linux' : 'linux-gui-tester',
'macOS current' : 'mac-current-gui-tester',
'macOS predecessor' : 'mac-predecessor-gui-tester',
'Windows 10' : 'windows-gui-tester',
'any' : 'gui-tester'][params.OPERATING_SYSTEM])
}
}
steps {
sh 'env'
buildDescription "branch: ${env.GIT_BRANCH} (${env.GIT_COMMIT[0..8]})<br>node: ${env.NODE_NAME}<br>tests: ${params.TEST_LIST}"
//remove old stuff
sh '''
rm -f *.zip
'''
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)
withAnt(installation: 'Ant 1.9.0') {
withEnv(["rcptt_runner_HOME=${tool name: 'rcptt_runner-nightly', type: 'com.cloudbees.jenkins.plugins.customtools.CustomTool'}"]) {
script {
def skipTags = ['skipExecution', 'serverOnlyTest']
if (!params.runPerformanceTests){
skipTags << 'performance'
}
if (!params.runReportingTests){
skipTags << 'report'
}
// work around https://issues.jenkins-ci.org/browse/JENKINS-63850
if (env.NODE_LABELS.split(' ').contains('linux-gui-tester')){
wrap([$class: 'Xvfb', additionalOptions: '', assignedLabels: '',
autoDisplayName: true, displayNameOffset: 0, installationName: 'default-Xvfb',
screen: '1200x960x24']) {
runRCPTT(rcptt_runner_HOME, "883${env.EXECUTOR_NUMBER}", params.TEST_LIST, params.SERVER_TIMEOUT, skipTags, params.TEST_OPTIONS, params.LANGUAGE)
}
} else {
runRCPTT(rcptt_runner_HOME, "883${env.EXECUTOR_NUMBER}", params.TEST_LIST, params.SERVER_TIMEOUT, skipTags, params.TEST_OPTIONS, params.LANGUAGE)
}
}
}
}
dir(tool(name: 'logparser', type: 'com.cloudbees.jenkins.plugins.customtools.CustomTool')){
sh "./logParser -i log4j -d ${WORKSPACE.replace('\\', '/')}/gui-test-runner/result/log -f verinice-client.* -o jenkins -n ${WORKSPACE.replace('\\', '/')}/gui-test-runner/result/log/clientlogparsed.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')])
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
}
}
}
}
}
def runRCPTT(runnerPath, veriniceServerPort, testList, veriniceTimeout, skipTags, testOptions, language){
sh """
ant -buildfile gui-test-runner/start-gui-test.xml test-verinice-client-test-custom \
-Drunner-path=${runnerPath.replace('\\', '/')} \
-Dverinice.server.port=${veriniceServerPort} \
-Dtest-list="${testList}" \
-Dverinice.timeout="${veriniceTimeout}" \
-Dskip-tags="${skipTags.join(';')}" \
-Dtest-options="${testOptions}" \
-Dverinice.lang=${language}"""
}