0

I'd like to shelve old builds in all of my jobs for example

build numbers 1-10  

I'm wondering if there is way to do that from the jenkins UI using a single command.

Alex Brodov
  • 3,365
  • 18
  • 43
  • 66

1 Answers1

1

First of all in order to make changes to a bulk of jobs of I would use something called configuration slicer.

you can get to that from here: https://wiki.jenkins-ci.org/display/JENKINS/Configuration+Slicing+Plugin

Also you want to delete your build? or archive them?! in case of deleting I would use the Log rotation eaither by date or number of builds. In the configure section of the job click on Discard old build and you will see the options.

and finally you can always use Artifact deployer and somether examples from that plug in.

Link Here: https://wiki.jenkins-ci.org/display/JENKINS/ArtifactDeployer+Plugin

Link on how to use the CLI in Jenkins : https://wiki.jenkins-ci.org/display/JENKINS/Jenkins+CLI

EDIT 1

In regards to the comments below where you are asking about "Shelving Jobs" .

I think the phrase you are looking for here is "archive" and not shelving - that is a very Visual Studio/TFS concept - so I am not personally aware of any anything that does SHELVING per say.

In terms of Groovy script I believe that you are now asking a different question and so this should be raised specifically as different question - but as far as groovy script go you can use the following link as an intro :

http://groovy.codehaus.org/

AltF4_
  • 2,312
  • 5
  • 36
  • 56
  • I want to archive them, I found some command : `java -jar jenkins-cli.jar -s http://tlv-tools-jenkins:8080/ delete-builds JOB RANGE` But i don't where can i run it, i heared that there is an option to run this command directly from the UI. – Alex Brodov Sep 18 '14 at 15:45
  • You can certainly do this from command line on your box or whatever node Jenkins is using . Go to manage Jenkins pagae and then click on CLI for more info on this. Dont forget you need to have .jar file from where ever you are running the command - also dont forget authentication if your Jenkins has password – AltF4_ Sep 18 '14 at 15:56
  • So i have Jenkins CLI but this is only a kind of documentetion, there is no place where i can run the commands, by the way where should i put the jenkins-cli.jar file in my machine (It's installed on linux) – Alex Brodov Sep 18 '14 at 16:00
  • So any idea how to do that? – Alex Brodov Sep 18 '14 at 19:32
  • Read this page : https://wiki.jenkins-ci.org/display/JENKINS/Jenkins+CLI - i will edit my answer with this link as well – AltF4_ Sep 19 '14 at 08:13
  • So I've already read the content of this link, but i didn't really understand where should i install the jar file, and where should i write the command.. – Alex Brodov Sep 19 '14 at 08:25
  • OK - so you need to copy a jar file into a folder in the "C:\theJarFile" when you want to run the command you need to CD to that location "where the .jar file is" and write out the command or give the path to that file - there is no installation as far as I know – AltF4_ Sep 19 '14 at 08:28
  • The thing is that Jenkins installed on Centos and not on Windows, is it going to change something? And another thing i heared that there is a way to run commands like this from the Jenkins UI , the only command that i found is delete but i need some command that will shelve the jobs into a tar file – Alex Brodov Sep 19 '14 at 08:31
  • Let's that i want to shelve all the old jobs that were accesses a year ago using a groovy script how can i do that – Alex Brodov Sep 21 '14 at 09:18