Reputation: 355
Is there any way in jenkins where as soon as we detect the failed build, job revert back the perforce code to the last successful build changelist and fire a build again.
Flow - 1. so as soon as we have failed build - Notifcation will be sent out to dev team with possible checkins which causing the build failure
Revert back the recent code to the last working code and submit it
Initiate a build.
Upvotes: 0
Views: 525
Reputation: 131
It is possible, but I don't see any reasons or use case to do it as it is not a correct workflow and can be confusing. But if you decided to do it, the next steps are required: Example how to do it using Perforce source control. Steps inside job settings:
Upvotes: 1
Reputation: 3859
If your using an artifact repository like Nexus or Artifactory to manage your project artifacts then you could always redeploy the previous working version of your application when a failure is detected.
Your not cancelling any checked in code that potentially broke the build but you are preserving your test environment. You can configure Jenkins to notify the user who checked in the latest erroneous change set and they can work on resolving the issue.
Jenkins also provides a rich API which allows you to delete a job, start a job, get information about previously run jobs. You could leverage some of these services along with your artifact repo to achieve the experience you described.
Upvotes: 1
Reputation: 5064
Jenkins is not a production server. It runs tasks and do not have options that I know for that purpose.
What is your source code ? webapps ? others ? What steps are you performing ? Are you performing some automatic tests ?
My assumption is that you got some tests that may invalidate the build.
These tests should be runned : * on a mock server to prevent deploying on your server * or somewhere else
Like that, if build failed, nothing is deployed.
If build success, you can deploy your project normally.
If this not reply to your answer, please provide requested information to undestrand a bit more your job process.
Upvotes: 1