We are working to add cloudbees folder support to the python-jenkins 
package (https://python-jenkins.readthedocs.org/en/latest/)  that will 
allow you to automate management (create/update/move/etc..) of folders.   
The change is under review right now 
(https://review.openstack.org/#/c/180185/) and is very close to being 
approved.  Hopefully it will get in sometime next week.  python-jenkins is 
open sourced, so use as you wish, would just love more contributions to 
make it better :)



On Thursday, August 20, 2015 at 12:12:40 PM UTC-7, Daniel Serodio wrote:
>
> We use this Groovy script to move jobs to folders, maybe you can use it as 
> a starting point for your needs:
>
> ###############################
> def FOLDER_NAME = 'Destination folder'
> def JOB_REGEX = 'Regex to match your jobs'
>
> import jenkins.*
> import jenkins.model.*
> import hudson.*
> import hudson.model.*
>
> jenkins = Jenkins.instance
>
> def folder = jenkins.getItemByFullName(FOLDER_NAME)
> if (folder == null) {
>   println "ERROR: Folder '$FOLDER_NAME' not found"
>   return
> }
>
> jenkins.items.grep { it.name =~ "${JOB_REGEX}" }.each { job ->
>   println "Moving '$job.name' to '$folder.name'"
>   Items.move(job, folder)
> }
> ###############################
>
> Regards,
> Daniel Serodio
>
>
> On Saturday, August 15, 2015 at 3:19:24 AM UTC-3, Stephen Connolly wrote:
>>
>> What I said:
>>
>> 1. You can use a groovy script right now. Will do exactly what you need. 
>> Some research required.
>>
>> 2. Oh look some synchronicity, I happen to have just been working on some 
>> stuff that would do this for a bigger set of problems... Sadly the stuff I 
>> was working on is for our paid product
>>
>> 3. The OSS should have a CLI command too... I think it does, but if I am 
>> wrong, adding a CLI command for the OSS plugin is something on our backlog, 
>> so we will get to it.
>>
>> I mentioned #2 not as a plug but more as a "oh, if you did happen to also 
>> be one of our customers"... Apologies if it read differently.
>>
>> -Stephen
>>
>> On Saturday, August 15, 2015, Vanetta Floyd <vanett...@gmail.com> wrote:
>>
>>> Thanks...not interested in commercials for that product.  I'm interested 
>>> in what the open source community has to say.  
>>>
>>> Will all people asking questions going forward be spammed with plugs for 
>>> that product?
>>> On Aug 14, 2015 10:48 AM, "VFloyd" <vanettafl...@gmail.com> wrote:
>>>
>>>> Any ideas on how to move more than one job at a time into a folder?
>>>>
>>>>
>>>>
>>>> On Thursday, August 6, 2015 at 1:45:47 PM UTC-7, Daniel Laird wrote:
>>>>>
>>>>> All,
>>>>>
>>>>> I amusing the cloudbees plugin that creates folders.
>>>>> I am now trying to move some jobs that are currently in a 'view' into 
>>>>> a folder.
>>>>> I can easily query and list all the jobs in a view in groovy but I am 
>>>>> struggling to move the job into a folder.
>>>>> I have tried various methods - if anyone has some example of doing 
>>>>> this it would be greatly appreciated.
>>>>>
>>>>> Dan
>>>>>
>>>> -- 
>>>> You received this message because you are subscribed to a topic in the 
>>>> Google Groups "Jenkins Users" group.
>>>> To unsubscribe from this topic, visit 
>>>> https://groups.google.com/d/topic/jenkinsci-users/doYddgacqTQ/unsubscribe
>>>> .
>>>> To unsubscribe from this group and all its topics, send an email to 
>>>> jenkinsci-users+unsubscr...@googlegroups.com.
>>>> To view this discussion on the web visit 
>>>> https://groups.google.com/d/msgid/jenkinsci-users/e4cd1d42-0fba-4faf-a023-caab8b466a52%40googlegroups.com
>>>>  
>>>> <https://groups.google.com/d/msgid/jenkinsci-users/e4cd1d42-0fba-4faf-a023-caab8b466a52%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Jenkins Users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to jenkinsci-users+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/jenkinsci-users/CAL40ccPVuPWnNeaRostT0uggh6PaOmwE3KUzTPN2mbdqvtX%2BvQ%40mail.gmail.com
>>>  
>>> <https://groups.google.com/d/msgid/jenkinsci-users/CAL40ccPVuPWnNeaRostT0uggh6PaOmwE3KUzTPN2mbdqvtX%2BvQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>> -- 
>> Sent from my phone
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/d6e69465-dbe7-4ec5-ad85-bdae3e2f28b3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to