7

My newly created deployment team is struggling to find a way to revert a currently deployed build. They have integrated Jenkins with Git and Bitbucket

Is there any way possible to revert back the build and to see what were the files deployed in the current build?

Mukesh
  • 7,630
  • 21
  • 105
  • 159
  • 1
    "Revert currently deployed build"... Well how did you deploy a build? A plugin? A custom script? Manually? – Slav Jul 02 '15 at 15:39
  • @Slav , I am not sure now but they are using a plugin. Is this possible to revert from any of the three ways(Manually, custom script and plugin) you mentioned? – Mukesh Jul 02 '15 at 16:35
  • 3
    If you don't know how they do it now, there is no way we can provide an answer here on how to undo it. Everything is possible (with the plugin method being the biggest wildcard in this situation). It could be as simple as just re-deploying a previous build, or as complex as writing a "revert" script in whatever language you prefer. But without more details, don't expect an proper answer – Slav Jul 02 '15 at 17:03
  • _they_ should be ask questions here not you. – Jayan Jul 05 '15 at 15:50

3 Answers3

5

(can't comment yet, so I answer)

If I understand correctly, all you need is to build a previous version of your project, right ?

There is indeed (multiple) ways to do this. I don't know GIT, but guess it's not that different from SVN. With SVN, in the build configuration, you can add @xxx after the repository's URL to build a precise revision. For example, to get revision 42, http://mysvn.com/myproject/trunk would become http://mysvn.com/myproject/trunk@42

While this easy method was enough for me, if you frequently revert builds, adding a parameter to your build will be a better option. I don't remember the exact syntax and lack of time right now, but you should google it easily if you need it.

See this O'reilly book chapter for more informations : https://books.google.fr/books?id=4bjDCQAAQBAJ&pg=PA328&lpg=PA328&dq=jenkins+revert+to+previous+version&source=bl&ots=FQgnttOu_Q&sig=eC9ndNxmm4lhdu4RuRgLZMHpEMU&hl=fr&sa=X&ved=0CG0Q6AEwCWoVChMI2-bD3JDqxwIVAj8aCh25UAsQ#v=onepage&q=jenkins%20revert%20to%20previous%20version&f=false

Balmipour
  • 2,985
  • 1
  • 24
  • 28
  • See this thread for some more info, including syntax to use a parameter [http://stackoverflow.com/questions/2324204/how-to-build-a-specific-revision-of-svn-in-hudson-jenkins/31947448#31947448] – Balmipour Sep 10 '15 at 16:21
-1

If I understand your question correctly, all you'll need to do is check git history for the given project and it'll tell you what was changed. Also, Jenkins should have link on the left sidebar called changes. Click on that and it'll tell you exactly what was changed for the current build.

dimaj
  • 3
  • 2
  • 4
-1

All you can do is you should revert your git changes to previous commit and rebuild.