-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathslack-notification.groovy
executable file
·41 lines (36 loc) · 1.27 KB
/
slack-notification.groovy
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
#!groovy
node(agent_label) {
stage('Preparation') {
git (branch: 'master',
credentialsId: 'github_key',
url: '[email protected]:DennyZhang/fake.git')
if (run_deployment_before_test == "true") {
build job:'DeploySandboxEnv',
parameters:[string(name:'initialize_system', value:initialize_system),
string(name:'whether_populatefakedata', value:whether_populatefakedata),
string(name:'whether_populaterealdata', value:whether_populaterealdata)]
}
}
def tc_list = testsuites.tokenize(',')
tc_list.each {
try {
stage("${it}") {
println "============ Test ${it}"
sh "mvn com.smartbear.soapui:soapui-maven-plugin:5.1.2:test -Dmdm.test.suite=\"${it}\""
}
} catch (e) {
result = "FAIL"
}
}
stage('CollectResult') {
if (result == "FAIL") {
buildStatus = result
def subject = "${buildStatus}: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]'"
def summary = "${subject} (${env.BUILD_URL})"
color = 'RED'
colorCode = '#FF0000'
slackSend (color: colorCode, message: summary)
error("Job has failed")
}
}
}