Deploy improvements
This commit is contained in:
parent
b788b251b7
commit
4c9ecc61db
|
@ -1,5 +1,7 @@
|
|||
#!/usr/bin/env groovy
|
||||
|
||||
def buildError = null;
|
||||
|
||||
try {
|
||||
switch (env.BRANCH_NAME) {
|
||||
case 'master':
|
||||
|
@ -16,11 +18,11 @@ try {
|
|||
node {
|
||||
stage ('Checkout') {
|
||||
checkout scm
|
||||
env.GIT_COMMIT_EMAIL = sh (
|
||||
env.GIT_COMMITTER_EMAIL = sh (
|
||||
script: "git --no-pager show -s --format='%ae'",
|
||||
returnStdout: true
|
||||
).trim()
|
||||
echo "Commiter: ${env.GIT_COMMIT_EMAIL}"
|
||||
echo "Commiter: ${env.GIT_COMMITTER_EMAIL}"
|
||||
}
|
||||
stage ('Build') {
|
||||
nodejs('node-lts') {
|
||||
|
@ -60,9 +62,23 @@ try {
|
|||
body: "Check status at ${env.BUILD_URL}"
|
||||
)
|
||||
} catch(e) {
|
||||
buildError = e;
|
||||
}
|
||||
|
||||
if (env.GIT_COMMIT_EMAIL) {
|
||||
def status
|
||||
def body = "<p>Check status at ${env.BUILD_URL}</p>";
|
||||
|
||||
if (buildError) {
|
||||
status = 'Failed'
|
||||
body += buildError.getMessage()
|
||||
} else {
|
||||
status = 'Success';
|
||||
}
|
||||
|
||||
mail(
|
||||
to: env.GIT_COMMIT_EMAIL,
|
||||
subject: "Pipeline failed: ${env.JOB_NAME} (${env.BUILD_NUMBER})",
|
||||
body: "Check status at ${env.BUILD_URL}"
|
||||
subject: "Pipeline: ${status}: ${env.JOB_NAME} (${env.BUILD_NUMBER})",
|
||||
body: body
|
||||
)
|
||||
}
|
Loading…
Reference in New Issue