Skip to content

Commit d87f168

Browse files
authored
Merge pull request #2 from pndaproject/PNDA-1979
Provide emails on Jenkins build state
2 parents 9b01226 + 78101e8 commit d87f168

File tree

1 file changed

+25
-18
lines changed

1 file changed

+25
-18
lines changed

Jenkinsfile

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,31 @@
11
node {
2+
try {
3+
stage 'Build'
4+
def workspace = pwd()
25

3-
stage 'Build'
4-
def workspace = pwd()
6+
sh '''
7+
echo $PWD
8+
echo $BRANCH_NAME
9+
cd $PWD@script/api;mvn versions:set -DnewVersion=$BRANCH_NAME
10+
mvn clean package
11+
'''
512

6-
sh '''
7-
echo $PWD
8-
echo $BRANCH_NAME
9-
cd $PWD@script/api;mvn versions:set -DnewVersion=$BRANCH_NAME
10-
mvn clean package
11-
'''
13+
stage 'Test'
14+
sh '''
15+
cd $PWD@script/api/src/main/resources/;
16+
pylint_wrapper.py 10
17+
nosetests test_*.py
18+
'''
1219

13-
stage 'Test'
14-
sh '''
15-
cd $PWD@script/api/src/main/resources/;
16-
pylint_wrapper.py 10
17-
nosetests test_*.py
18-
'''
20+
stage 'Deploy'
21+
build job: 'deploy-component', parameters: [[$class: 'StringParameterValue', name: 'branch', value: env.BRANCH_NAME],[$class: 'StringParameterValue', name: 'component', value: "deployment-manager"],[$class: 'StringParameterValue', name: 'release_path', value: "platform/releases"],[$class: 'StringParameterValue', name: 'release', value: "${workspace}@script/api/target/deployment-manager-${env.BRANCH_NAME}.tar.gz"]]
1922

20-
stage 'Deploy'
21-
build job: 'deploy-component', parameters: [[$class: 'StringParameterValue', name: 'branch', value: env.BRANCH_NAME],[$class: 'StringParameterValue', name: 'component', value: "deployment-manager"],[$class: 'StringParameterValue', name: 'release_path', value: "platform/releases"],[$class: 'StringParameterValue', name: 'release', value: "${workspace}@script/api/target/deployment-manager-${env.BRANCH_NAME}.tar.gz"]]
23+
emailext attachLog: true, body: "Build succeeded (see ${env.BUILD_URL})", subject: "[JENKINS] ${env.JOB_NAME} succeeded", to: "${env.EMAIL_RECIPIENTS}"
2224

23-
24-
}
25+
}
26+
catch(error) {
27+
emailext attachLog: true, body: "Build failed (see ${env.BUILD_URL})", subject: "[JENKINS] ${env.JOB_NAME} failed", to: "${env.EMAIL_RECIPIENTS}"
28+
currentBuild.result = "FAILED"
29+
throw error
30+
}
31+
}

0 commit comments

Comments
 (0)