We have project which have more than 500 unit test and run for hours through Jenkins CI pipeline. In case there is failure of single UNIT test we need to kick off the build job again. I want to run the Unit Test job in Jenkins before merging the changes to master branch as staged so that build will not break in master and thoroughly tested within feature branch itself.

Note - I have read about the Pre-receive hook which can be implmented in Master branch but i am not able to figure out Gated check-in process and where the changes and existing code of master branch will run.

  • 2
    What is stopping you from running a trial merge in a throw away branch based on master, running the tests, and proceeding with the merge into master if they are successful? Maybe this is not the part you are blocked with.
    – joshp
    Dec 27, 2019 at 2:08
  • Throw away branch will be available for Jenkins to build the project and run the test cases ? How it will stage for Jenkins
    – Isthatyou
    Dec 27, 2019 at 2:34
  • It depends how you configure Jenkins. I run builds on throw away branches a lot. On such Jenkins "projects" I specifically do not care about build and changes history and just delete it. Then on real for the record branches I keep all the history up to a point. Maybe your question is for StackOverflow how to run a build on jenkins for any arbitrary branch.
    – joshp
    Dec 27, 2019 at 3:10
  • I got the answer to do the merges in throw away branch and use to run the unit test cases. But not clear with the Build job for Jenkins. Are you suggesting to create the automated Jenkin builds for every throw away branches whenever we are doing the pull request ?
    – Isthatyou
    Dec 27, 2019 at 3:23
  • Will you able to provide the reference of hook or script you are using to create the throw away branch and running the Jenkins build out of that ?
    – Isthatyou
    Dec 27, 2019 at 3:26


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy