简体   繁体   中英

Reset the commit in stash if Jenkins build fail

I am using the Stash add-on 'Stash Webhook to Jenkins' to trigger a Jenkins build when a developer pushes his code to a feature branch.

I want to reset to the previous commit if the Jenkins build fails. Only if the build succeeds the push should take place. Is there any add-on available for this or any other way?

You can use Build Other Projects under Post-build Actions section .

Basically you can setup two more Jenkins jobs. One will reset the previous commit. And the other will do the push. Then in the build job, you can trigger reset commit if build fails and trigger other one if success.

And there is a Parameterized Trigger Plugin if you need to configure more aspects of the triggering logic.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM