I'm having some issues with Jenkins and its Git plugin.
Currently, a Gitlab server is triggering the builds but I want to configure the job so that it doesn't build when a specific message is included in the commit.
I've tried using the ci-skip plugin (https://github.com/banyan/jenkins-ci-skip-plugin) but instead of not starting the job, the plugin allows it to start but then aborts it.
It does the job but I'm having aborted builds in Jenkins history and I'm trying to avoid that.
Anyone managed to do that?
Committing in Git without a message So if you don't have anything to commit, you will be told that there is nothing to commit without the text editor being opened. So if your text editor opens up after the command, there is definitely something to commit.
Pass the commit sha1 to a predefined parameter and in Build-Execute shell run git checkout <commit> before the build process starts. Some extra work is needed to make sure the check-out goes well. Check the box This project is parameterized and then you can add predefined parameters.
use the "Set the build result" step to set the status to "Aborted", this will finish the Jenkins build and will hide the build from the Jenkins dashboard.
Jenkins git plugin itself already provides these kinds of advanced usage.
Job config page -->Source Code Management-->Git-->Add -->Polling ignores commits with certain messages
Job config page -->Source Code Management-->Git-->Add -->Polling ignores commits from certain users
Don't forget to click the help at the end of each of them to learn the correct way of usage.
If you have not yet found a solution:
Configure your job to poll SCM but do not enter a timeplan for that (ignoring the warning that your job would never run.
Configure the scm section to ignore commits, users, etc.
Use a trigger for your jobs as follows: http://yourserver/git/notifyCommit?url=<URL of the Git repository>[&branches=branch1[,branch2]*][&sha1=<commit ID>]
as seen on Git Plugin page
Whenever the URL is called, jenkins will scan for jobs that are using this repository. Then it checks for any specific settings (e. g. ignoring commits by certain users or with some commit messages) and either run the build or not. Of course the build will always somehow start to poll scm and check for commits, but if it is cancelled due to unimportant commits you will not see an aborted build in your history.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With