-
Notifications
You must be signed in to change notification settings - Fork 34
/
Jenkinsfile
30 lines (23 loc) · 1.09 KB
/
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
node {
try {
stage 'Build'
deleteDir()
checkout scm
def workspace = pwd()
def version = env.BRANCH_NAME
if(env.BRANCH_NAME=="master") {
version = sh(returnStdout: true, script: 'git describe --abbrev=0 --tags').trim()
checkout([$class: 'GitSCM', branches: [[name: "tags/${version}"]], extensions: [[$class: 'CleanCheckout']]])
}
sh("./build.sh ${version}")
stage 'Deploy'
build job: 'deploy', parameters: [[$class: 'StringParameterValue', name: 'artifacts_path', value: "${workspace}/pnda-build"]]
stage 'Notifier'
build job: 'notifier', parameters: [[$class: 'StringParameterValue', name: 'message', value: "${env.JOB_NAME} succeeded: see [Jenkins job ${env.BUILD_ID}](${env.BUILD_URL})"]]
}
catch(error) {
build job: 'notifier', parameters: [[$class: 'StringParameterValue', name: 'message', value: "${env.JOB_NAME} failed: see [Jenkins job ${env.BUILD_ID}](${env.BUILD_URL})"]]
currentBuild.result = "FAILED"
throw error
}
}