We use Jenkins for doing incremental builds of our project on each commit to the SCM. We would like to get separate builds for every single commit. However, the naive approach (setup SCM and use post-commit hooks to trigger a build) exhibits problem in the following scenario:
This "race condition" complicates finding which one of the commits has broken the build/introduced warnings.
The currently employed solution is checking for changes in one job ("scheduler job") and triggering another job to do the actual checkout and build.
Are there any proper solutions to this problem?
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.
Trigger a Jenkins build automatically on commit Steps to create a DevOps automation rule for Jenkins: Create a new Automation for Jira rule and choose the Genius Commit created trigger from the DevOps category! Choose the command "Build (@build)" from the list of commands! Select the Send web request automation action!
Not yet, there's a Feature Request covering this kind of build, but it's still open: Issue 673
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