Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to conditionally run maven-release:rollback in jenkins?

I am using jenkins/hudson to make maven releases, and sometimes when the builds fails, I have no other way that manual to rollback and then start the jenkins build again. I was wondering if there is any good and configurable way of running mvn release:rollback in the end of the build dependent the result of mvn release:prepare? I mean, if the release process fails, I want to run maven release:rollback, otherwise not.

Thanks your time.

like image 855
Gogi Avatar asked Jul 10 '12 16:07

Gogi


People also ask

How do I rollback a release in Maven?

To rollback a release, the following requirement must be met: You haven't run release:clean on the project. This means that the backup files and the release descriptor from the previous release command still exist.

How does Jenkins release Maven?

Few examples of different project types are Freestyle, Maven, Multi-configuration, Pipeline etc. Select the "Maven Project" amongst those options, configure your project based on your requirement. And then you'll be able to see the perform maven release option to the extreme right of your jenkins dashboard.

How do I release a build in Jenkins?

On the job configuration page, enable the release build configuration under the Build Wrapper heading and add your required release version template string, release parameters, pre and post build steps that you need to complete a release.

What does Mvn Release perform do?

release:perform will fork a new Maven instance to build the checked-out project. This new Maven instance will use the same system configuration and Maven profiles used by the one running the release:perform goal.


1 Answers

You can configure your Jenkins job to do a fresh checkout of the source code every time the job is started. So if your release fails before the creation of the release tag, you can fix the problems and just start the release again.

like image 167
Stefan Ferstl Avatar answered Oct 22 '22 09:10

Stefan Ferstl