forked from pndaproject/platform-console-backend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
30 lines (22 loc) · 1.01 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"]]
emailext attachLog: true, body: "Build succeeded (see ${env.BUILD_URL})", subject: "[JENKINS] ${env.JOB_NAME} succeeded", to: "${env.EMAIL_RECIPIENTS}"
}
catch(error) {
emailext attachLog: true, body: "Build failed (see ${env.BUILD_URL})", subject: "[JENKINS] ${env.JOB_NAME} failed", to: "${env.EMAIL_RECIPIENTS}"
currentBuild.result = "FAILED"
throw error
}
}