Here is the thing. I have some jenkins pipeline jobs in that deploy some java backend apps. The pipelines are run by scripts from SCM. This scripts are the ones that grab the development team code and: 1- checkout that code 2- compile and create WAR 3- copy war to web server.
Now developers want to implement a rollback and if a job is run, and a new deployment is done and faild, they want to go back to the last one that was working fine.
Is there a way to do this in jenkins and for example using Jfrog artifactory? we have artifactory configured and we can upload WARS (or other files) to that repo but is not being used. I don´t know how to implement this. I was thinking that using tags for different WAR files and if deployment failed, grabing from artifactory latest WAR that worked ok? Is this possible? how can this approach be done in jenkins using artifactory. I can implement a new step that after creating WAR, then it uploads that WAA to artifactory, but how I can then connect this with jenkins to use the WAR that I want? Any suggestion on how to do this? thank you!
I suggest you these approaches:
In this case, you just need parametrize your current pipeline to receive branch name or tag as parameter.
Workflow could be:
In this case, you need to adopt a software versioning strategy. Read this sources:
In the easiest mode, you just need to build an incremental release version of your wars. Spring versions works in a similar way :
https://mvnrepository.com/artifact/org.springframework/spring-core
For instance:
As a replacement for Artifactory, you can use Github releases or Gitlab packages and follow a scenario such as (assuming a versioning scheme like prod.build_number.short_commit_hash) :
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With