-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathJenkinsfile
40 lines (40 loc) · 982 Bytes
/
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
def sendSlack_notification(failed_stage)
{
def name=powershell(returnStdout: true, script: "git log -1 --pretty=format:'%an'")
def url= env.BUILD_URL.replace("localhost","10.37.0.121")
slackSend (color: "danger", channel: '#ci', message: "Build failed on stage ${failed_stage}: author: ${name} repository: ${env.GIT_URL} commit: ${env.GIT_COMMIT} see error at: ${url}console")
}
pipeline{
agent any
triggers {
pollSCM('0 23 * * *')
}
stages{
stage('build'){
steps
{
script{
try{
powershell "xmake -y"
}catch(e){
sendSlack_notification(env.STAGE_NAME)
throw e
}
}
}
}
stage('test'){
steps
{
script{
try{
powershell "xmake run"
}catch(e){
sendSlack_notification(env.STAGE_NAME)
throw e
}
}
}
}
}
}