Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Enforcing one build for one commit in Jenkins/Hudson

Tags:

jenkins

hudson

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:

  • Build is triggered.
  • While build takes place (it can take up to several minutes) two separate commits to the SCM are made by two developers.
  • One new build is triggered. It receives changes from both of the commits, made during previous build.

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?

like image 829
Oleg Avatar asked Jul 11 '11 21:07

Oleg


People also ask

How do I Build on specific commit in Git on Jenkins?

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.

How do you trigger Jenkins Build on commit?

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!


1 Answers

Not yet, there's a Feature Request covering this kind of build, but it's still open: Issue 673

like image 177
Daniel Avatar answered Sep 17 '22 19:09

Daniel