Code fixes

This commit is contained in:
Juan Ferrer 2020-01-31 13:47:11 +01:00
parent 3a1a37aa09
commit 86c268214a
2 changed files with 20 additions and 16 deletions

View File

@ -1,13 +1,15 @@
#!/usr/bin/env groovy #!/usr/bin/env groovy
def call() { def call() {
if (!env.GIT_COMMITTER_EMAIL) { script {
env.COMMITTER_EMAIL = sh( if (!env.GIT_COMMITTER_EMAIL) {
script: 'git --no-pager show -s --format="%ae"', env.COMMITTER_EMAIL = sh(
returnStdout: true script: 'git --no-pager show -s --format="%ae"',
).trim() returnStdout: true
} else { ).trim()
env.COMMITTER_EMAIL = env.GIT_COMMITTER_EMAIL; } else {
env.COMMITTER_EMAIL = env.GIT_COMMITTER_EMAIL;
}
} }
sh 'printenv' sh 'printenv'

View File

@ -1,14 +1,16 @@
#!/usr/bin/env groovy #!/usr/bin/env groovy
def call() { def call() {
if (!env.COMMITTER_EMAIL) return script {
try { if (!env.COMMITTER_EMAIL) return
mail( try {
to: env.COMMITTER_EMAIL, mail(
subject: "Pipeline: ${env.JOB_NAME} (${env.BUILD_NUMBER}): ${currentBuild.currentResult}", to: env.COMMITTER_EMAIL,
body: "Check status at ${env.BUILD_URL}" subject: "Pipeline: ${env.JOB_NAME} (${env.BUILD_NUMBER}): ${currentBuild.currentResult}",
) body: "Check status at ${env.BUILD_URL}"
} catch (e) { )
echo e.toString() } catch (e) {
echo e.toString()
}
} }
} }