From 5845e5b52270916833a8c440965290c8f06c5a8d Mon Sep 17 00:00:00 2001 From: Timothy Le Bon Date: Wed, 11 Dec 2024 19:00:31 +0100 Subject: [PATCH] chore: fixing undefined commitmesssage --- Jenkinsfile | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 3ef83257a61..a01b4e691c3 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -111,6 +111,7 @@ pipeline { steps { script { def commit_hash = sh(script: 'git rev-parse HEAD', returnStdout: true).trim() + String commitMsg = sh(returnStdout: true, script: 'git log -1 --pretty=%B').trim() try { // Wait until deployment has finished (20 retries * 30 seconds == 10 minutes) timeout(time: 10, unit: 'MINUTES') { @@ -132,10 +133,16 @@ pipeline { } } catch (e) { def reason = sh returnStdout: true, script: 'cat deployment.log || echo ""' - wireSend secret: env.WIRE_BOT_SECRET, message: "❌ **Deployment failed on** ${webappApplicationPath}\n${commit_msg}\n**Reason:** ${e}\n${reason}" + String errorMessage = """❌ **Deployment failed on** ${webappApplicationPath} + ${commitMsg} + **Reason:** ${e} + ${reason}""" + wireSend secret: env.WIRE_BOT_SECRET, message: errorMessage } } - wireSend secret: env.WIRE_BOT_SECRET, message: "✅ **Deployment successful on** ${webappApplicationPath}\n${commit_msg}" + def successMessage = """✅ **Deployment successful on** ${webappApplicationPath} + ${commitMsg}""" + wireSend secret: env.WIRE_BOT_SECRET, message: successMessage } }