Nicolas S.Xu
Nicolas S.Xu

Reputation: 14554

Using Jenkins and Jenkins Github Plugin, how to prevent pushing to a branch if the unit test fails

My objective is to prevent pushing to a branch if unit test fails using Jenkins and its Github Plugin.

I saw it works in TeamCity in my previous company, and I believe it is common practice.

However, from this tutorial, the code will always be pushed to github branch even if the unit test fails, because the webhook is triggered after the git push.

How do I configure Jenkins to achieve my objective? If it is possible using Jenkins and Githb Plugin.

Upvotes: 0

Views: 129

Answers (1)

user4433284
user4433284

Reputation:

jenkins won't do that for you, github might, or failing that you need a pre-commit hook.

https://git-scm.com/book/gr/v2/Customizing-Git-Git-Hooks

Upvotes: 1

Related Questions