Although the above implementation of the automatic deployment of the project, but sometimes when the deployment fails, we need to roll back to the specified version of the build, in order to more flexible project build deployment. We can choose "parameterized build process" to pass different parameters to choose whether to make a new build or rollback
If you are implementing rollback, be sure to archive the completed files after the build to facilitate later rollback.
-
If you are implementing rollback, be sure to archive the completed files after the build, making it easier to roll back later
Post-Build Archive
-
Use the parameterized build process so that the following footsteps can perform different actions depending on the variable. Add the "Choice" parameter to configure different options, let's choose to publish or rollback, add a "String Parameter" parameter to pass the version number to be rolled back.
Parameters and build process
-
Build a script that chooses "Execute Shell", customizing the build itself according to the variables, at this point, if the build process that installs Maven is released for a new build, if it is rolled back, know the history of the built file, copy it to the current build results directory.
Build Scripts
-
Click Build, choose Publish or rollback according to different parameters, and roll back the historical version number
Build Page
How to use Jenkins for automatic project construction or project rollback under Ubuntu system