I tried to get the git commit message in jenkinsfile and prevent the build based on commit message.
env.GIT_COMMIT doesn't return the commit details in jenkinsfile.
How to get the git latest commit message and prevent the jenkins build if the commit message contains [ci skip] in it?
I had the same issue. I'm using pipelines. I solved this issue by implementing a shared library.
The code of the library is this:
Then, in my Jenkinsfile:
As you can see, the build is marked as
NOT_BUILT
. You can change it toABORTED
if you prefer, but it cannot be set toSUCCESS
because a build result can only get worse