diff --git a/Jenkinsfile b/Jenkinsfile index 0c6b1422..19ef38d2 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -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." + } } } }