Test deployment to vapor with dynamic commit message from git

This commit is contained in:
Dillon Ngo
2023-11-23 13:44:49 +08:00
parent 820d5e022f
commit 0e700299d7
Vendored
+11 -2
View File
@@ -29,9 +29,18 @@ pipeline {
stage('get_commit_msg') {
steps {
// script {
// commit = sh(returnStdout: true, script: 'git log -1 --oneline').trim()
// env.GIT_COMMIT_MSG = commit
// }
script {
commit = sh(returnStdout: true, script: 'git log -1 --oneline').trim()
env.GIT_COMMIT_MSG = commit
def gitExecutable = sh(returnStdout: true, script: 'which git').trim()
if (gitExecutable) {
commit = sh(returnStdout: true, script: "${gitExecutable} log -1 --oneline").trim()
env.GIT_COMMIT_MSG = commit
} else {
echo "Git not found in PATH. Please make sure Git is installed and in the system PATH."
}
}
}
}