Using parameterized build and GIT parameter plugin we will build the job against specific GIT TAG which will be passed as parameter before executing the job, this will help to rollback to certain tag when required.
- Jenkins installed and configured
- Install GIT Parameter plugin
- Login to Jenkins instance and go to NEW ITEM option and create a new freestyle job give it a name something (RollbackDemo)
2. Under project configuration option provide all the required details under source code management tab enter the value as show below.
3. Next choose the option This project is parameterized click on add parameter and choose option
4. as GIT Parameter and parameter type as TAG.
5. enter the values as shown below create parameter with name GIT_TAG
6. Do the remaining configuration of the project and click on SAVE and Apply.
11. Once all the configuration settings are done properly and job is saved we should see option name build with parameter at the left of Jenkins pane.
12. Next click on the option Build with Parameters
Once we click on the build with parameters option it should open a window with a checkbox and the selectbox will be populated with tag details corresponding to the branch configured under Jenkins, the selectbox will retrieve all the tag details from GITHub and populate it.
Next choose the appropriate Tag against which you want to do the build once selected click on the build option it should fire the build against the tag chosen under first window.
Once build option is clicked it will fire the build against the tag provided under the GIThub.
Once the build is successful you see the changes done by team against this particular GIT parameter i.e. choosing the tag name from the populated list.
This way GIT parameter plugin can keep track of the TAGs of the branch so anytime we can choose the tag from selectlist and started the deployment.
Benefit of this method :-
• Rolling back the application the specific tag
• From checkins only we can choose the tag now no need to go anywhere else.
• Team will be having knowledge from which particular version this build got deployed.