Moving a job to a Folder

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
19 messages Options
Reply | Threaded
Open this post in threaded view
|

Moving a job to a Folder

Daniel Laird-2
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 the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/370a67a2-4a75-48e9-afc3-57f9958655ab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Moving a job to a Folder

Gergely Brautigam
Hi Dan.

It's simple. On the Job, on the Left side, you see this option =>

 Move

Click on that, and select the directory in which you would like to move the job. This will also update references to the job, and copy the whole workspace and configuration history, so nothing will get lost.

Gergely.

On Thursday, 6 August 2015 22:45:47 UTC+2, 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 the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/4fd23027-c569-4274-bfa4-1588d18f4990%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Moving a job to a Folder

VFloyd
In reply to this post by Daniel Laird-2
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 the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/e4cd1d42-0fba-4faf-a023-caab8b466a52%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Moving a job to a Folder

stephenconnolly
You could use a groovy script. Other than that you are SOoL

For CloudBees Jenkins Platform I have just implemented move/copy functionality for use within/between masters, and that functionality comes with Jenkins CLI support so you could use shell scripting with that *if you are a CloudBees customer*. (Still going through QA and documentation before we can release it though... Should be out next week with any luck)

I believe we have a Jenkins CLI command already in the folders plugin... If we don't then that's something that's in our OSS backlog (ie I cannot remember if we did it already or not!)

On Friday, August 14, 2015, VFloyd <[hidden email]> 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 the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:_e(%7B%7D,&#39;cvml&#39;,&#39;jenkinsci-users%2Bunsubscribe@googlegroups.com&#39;);" target="_blank">jenkinsci-users+unsubscribe@....
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/e4cd1d42-0fba-4faf-a023-caab8b466a52%40googlegroups.com.
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CA%2BnPnMwBeqFvZAspj%2BcFRekgQvKrbSg4JZm9Fn9wX_63ei2Ndw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Moving a job to a Folder

VFloyd
In reply to this post by VFloyd

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" <[hidden email]> 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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/e4cd1d42-0fba-4faf-a023-caab8b466a52%40googlegroups.com.
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAL40ccPVuPWnNeaRostT0uggh6PaOmwE3KUzTPN2mbdqvtX%2BvQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Moving a job to a Folder

stephenconnolly
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 <[hidden email]> 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" <<a href="javascript:_e(%7B%7D,&#39;cvml&#39;,&#39;vanettafloyd@gmail.com&#39;);" target="_blank">vanettafloyd@...> 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 <a href="javascript:_e(%7B%7D,&#39;cvml&#39;,&#39;jenkinsci-users%2Bunsubscribe@googlegroups.com&#39;);" target="_blank">jenkinsci-users+unsubscribe@....
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/e4cd1d42-0fba-4faf-a023-caab8b466a52%40googlegroups.com.
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 <a href="javascript:_e(%7B%7D,&#39;cvml&#39;,&#39;jenkinsci-users%2Bunsubscribe@googlegroups.com&#39;);" target="_blank">jenkinsci-users+unsubscribe@....
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAL40ccPVuPWnNeaRostT0uggh6PaOmwE3KUzTPN2mbdqvtX%2BvQ%40mail.gmail.com.
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CA%2BnPnMwrOMCJ%3DQM%2BE1La_kOstB9bG%2BSdX3Cjbikv8_wNKO5YTw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Moving a job to a Folder

VFloyd
In reply to this post by stephenconnolly

Please accept my apologies for misunderstanding the answer you provided, as well as the purpose of this board.

On Aug 14, 2015 3:00 PM, "Stephen Connolly" <[hidden email]> wrote:
You could use a groovy script. Other than that you are SOoL

For CloudBees Jenkins Platform I have just implemented move/copy functionality for use within/between masters, and that functionality comes with Jenkins CLI support so you could use shell scripting with that *if you are a CloudBees customer*. (Still going through QA and documentation before we can release it though... Should be out next week with any luck)

I believe we have a Jenkins CLI command already in the folders plugin... If we don't then that's something that's in our OSS backlog (ie I cannot remember if we did it already or not!)

On Friday, August 14, 2015, VFloyd <[hidden email]> 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 the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/e4cd1d42-0fba-4faf-a023-caab8b466a52%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Sent from my phone

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CA%2BnPnMwBeqFvZAspj%2BcFRekgQvKrbSg4JZm9Fn9wX_63ei2Ndw%40mail.gmail.com.
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAL40ccPMzS4FkoAr28Jt54j1pTCDGDMykJ4nUiTiK-6zfZxR3w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Moving a job to a Folder

stephenconnolly


On Saturday, August 15, 2015, Vanetta Floyd <[hidden email]> wrote:

Please accept my apologies for misunderstanding the answer you provided,


No worries, it may have been less than entirely clear due to being composed on a phone
 

 as well as the purpose of this board.


To be clear, this mailing list is not here to advertise CloudBees products... We have a marketing department who are paid to advertise our products.

My intent in mentioning was to point out that I am currently intimately aware of the move functionality available in Jenkins OSS having just completed a new feature integrating with it (but sadly that feature is not one I can share with OSS)... Though we do have stories to push what we can push back to OSS
 
On Aug 14, 2015 3:00 PM, "Stephen Connolly" <<a href="javascript:_e(%7B%7D,&#39;cvml&#39;,&#39;stephen.alan.connolly@gmail.com&#39;);" target="_blank">stephen.alan.connolly@...> wrote:
You could use a groovy script. Other than that you are SOoL

For CloudBees Jenkins Platform I have just implemented move/copy functionality for use within/between masters, and that functionality comes with Jenkins CLI support so you could use shell scripting with that *if you are a CloudBees customer*. (Still going through QA and documentation before we can release it though... Should be out next week with any luck)

I believe we have a Jenkins CLI command already in the folders plugin... If we don't then that's something that's in our OSS backlog (ie I cannot remember if we did it already or not!)

On Friday, August 14, 2015, VFloyd <<a href="javascript:_e(%7B%7D,&#39;cvml&#39;,&#39;vanettafloyd@gmail.com&#39;);" target="_blank">vanettafloyd@...> 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 the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/e4cd1d42-0fba-4faf-a023-caab8b466a52%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Sent from my phone

--
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 <a href="javascript:_e(%7B%7D,&#39;cvml&#39;,&#39;jenkinsci-users%2Bunsubscribe@googlegroups.com&#39;);" target="_blank">jenkinsci-users+unsubscribe@....
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CA%2BnPnMwBeqFvZAspj%2BcFRekgQvKrbSg4JZm9Fn9wX_63ei2Ndw%40mail.gmail.com.
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 <a href="javascript:_e(%7B%7D,&#39;cvml&#39;,&#39;jenkinsci-users%2Bunsubscribe@googlegroups.com&#39;);" target="_blank">jenkinsci-users+unsubscribe@....
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAL40ccPMzS4FkoAr28Jt54j1pTCDGDMykJ4nUiTiK-6zfZxR3w%40mail.gmail.com.
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CA%2BnPnMwUk6XFe3UfQsHBEvJdMdqVsB0GLYgUifU86umMmXMYSA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Moving a job to a Folder

Daniel Serodio
In reply to this post by stephenconnolly
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 <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="0Eq-hLGWAQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">vanett...@...> 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" <[hidden email]> 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 <a href="https://groups.google.com/d/topic/jenkinsci-users/doYddgacqTQ/unsubscribe" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/topic/jenkinsci-users/doYddgacqTQ/unsubscribe&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/topic/jenkinsci-users/doYddgacqTQ/unsubscribe&#39;;return true;">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+unsubscribe@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/jenkinsci-users/e4cd1d42-0fba-4faf-a023-caab8b466a52%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-users/e4cd1d42-0fba-4faf-a023-caab8b466a52%40googlegroups.com?utm_medium\75email\46utm_source\75footer&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-users/e4cd1d42-0fba-4faf-a023-caab8b466a52%40googlegroups.com?utm_medium\75email\46utm_source\75footer&#39;;return true;">https://groups.google.com/d/msgid/jenkinsci-users/e4cd1d42-0fba-4faf-a023-caab8b466a52%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">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+unsubscribe@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/jenkinsci-users/CAL40ccPVuPWnNeaRostT0uggh6PaOmwE3KUzTPN2mbdqvtX%2BvQ%40mail.gmail.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-users/CAL40ccPVuPWnNeaRostT0uggh6PaOmwE3KUzTPN2mbdqvtX%2BvQ%40mail.gmail.com?utm_medium\75email\46utm_source\75footer&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-users/CAL40ccPVuPWnNeaRostT0uggh6PaOmwE3KUzTPN2mbdqvtX%2BvQ%40mail.gmail.com?utm_medium\75email\46utm_source\75footer&#39;;return true;">https://groups.google.com/d/msgid/jenkinsci-users/CAL40ccPVuPWnNeaRostT0uggh6PaOmwE3KUzTPN2mbdqvtX%2BvQ%40mail.gmail.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/e87f399b-ae21-4939-9d93-f18a52e57f15%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Moving a job to a Folder

Khai Do-2
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 { <a href="http://it.name" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\75http%3A%2F%2Fit.name\46sa\75D\46sntz\0751\46usg\75AFQjCNFzPnolFcOKHC2izDRzc7N56F6Jnw&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\75http%3A%2F%2Fit.name\46sa\75D\46sntz\0751\46usg\75AFQjCNFzPnolFcOKHC2izDRzc7N56F6Jnw&#39;;return true;">it.name =~ "${JOB_REGEX}" }.each { job ->
  println "Moving '$<a href="http://job.name" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\75http%3A%2F%2Fjob.name\46sa\75D\46sntz\0751\46usg\75AFQjCNFpBhY_z17vm0MinSshvhGG4EX8zw&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\75http%3A%2F%2Fjob.name\46sa\75D\46sntz\0751\46usg\75AFQjCNFpBhY_z17vm0MinSshvhGG4EX8zw&#39;;return true;">job.name' to '$<a href="http://folder.name" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\75http%3A%2F%2Ffolder.name\46sa\75D\46sntz\0751\46usg\75AFQjCNFH1D4TLgARX8nxi17Smf-wFk7gDA&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\75http%3A%2F%2Ffolder.name\46sa\75D\46sntz\0751\46usg\75AFQjCNFH1D4TLgARX8nxi17Smf-wFk7gDA&#39;;return true;">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 <[hidden email]> 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" <[hidden email]> 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 <a href="https://groups.google.com/d/topic/jenkinsci-users/doYddgacqTQ/unsubscribe" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/topic/jenkinsci-users/doYddgacqTQ/unsubscribe&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/topic/jenkinsci-users/doYddgacqTQ/unsubscribe&#39;;return true;">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+unsubscribe@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/jenkinsci-users/e4cd1d42-0fba-4faf-a023-caab8b466a52%40googlegroups.com?utm_medium=email&amp;utm_source=footer" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-users/e4cd1d42-0fba-4faf-a023-caab8b466a52%40googlegroups.com?utm_medium\75email\46utm_source\75footer&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-users/e4cd1d42-0fba-4faf-a023-caab8b466a52%40googlegroups.com?utm_medium\75email\46utm_source\75footer&#39;;return true;">https://groups.google.com/d/msgid/jenkinsci-users/e4cd1d42-0fba-4faf-a023-caab8b466a52%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">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+unsubscribe@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/jenkinsci-users/CAL40ccPVuPWnNeaRostT0uggh6PaOmwE3KUzTPN2mbdqvtX%2BvQ%40mail.gmail.com?utm_medium=email&amp;utm_source=footer" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-users/CAL40ccPVuPWnNeaRostT0uggh6PaOmwE3KUzTPN2mbdqvtX%2BvQ%40mail.gmail.com?utm_medium\75email\46utm_source\75footer&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-users/CAL40ccPVuPWnNeaRostT0uggh6PaOmwE3KUzTPN2mbdqvtX%2BvQ%40mail.gmail.com?utm_medium\75email\46utm_source\75footer&#39;;return true;">https://groups.google.com/d/msgid/jenkinsci-users/CAL40ccPVuPWnNeaRostT0uggh6PaOmwE3KUzTPN2mbdqvtX%2BvQ%40mail.gmail.com.
For more options, visit <a href="https://groups.google.com/d/optout" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">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 [hidden email].
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 | Threaded
Open this post in threaded view
|

Re: Moving a job to a Folder

raja saggam
In reply to this post by Daniel Serodio
Hi Daniel,

could you please let me know exactly how to create a jenkins folder job using groovy script.

Regards,
Naresh.

On Friday, August 21, 2015 at 12:42:40 AM UTC+5:30, 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 { <a href="http://it.name" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fit.name\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFzPnolFcOKHC2izDRzc7N56F6Jnw&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fit.name\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFzPnolFcOKHC2izDRzc7N56F6Jnw&#39;;return true;">it.name =~ "${JOB_REGEX}" }.each { job ->
  println "Moving '$<a href="http://job.name" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fjob.name\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFpBhY_z17vm0MinSshvhGG4EX8zw&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fjob.name\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFpBhY_z17vm0MinSshvhGG4EX8zw&#39;;return true;">job.name' to '$<a href="http://folder.name" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Ffolder.name\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFH1D4TLgARX8nxi17Smf-wFk7gDA&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Ffolder.name\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFH1D4TLgARX8nxi17Smf-wFk7gDA&#39;;return true;">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 <[hidden email]> 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" <[hidden email]> 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 <a href="https://groups.google.com/d/topic/jenkinsci-users/doYddgacqTQ/unsubscribe" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/topic/jenkinsci-users/doYddgacqTQ/unsubscribe&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/topic/jenkinsci-users/doYddgacqTQ/unsubscribe&#39;;return true;">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+unsubscribe@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/jenkinsci-users/e4cd1d42-0fba-4faf-a023-caab8b466a52%40googlegroups.com?utm_medium=email&amp;utm_source=footer" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-users/e4cd1d42-0fba-4faf-a023-caab8b466a52%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-users/e4cd1d42-0fba-4faf-a023-caab8b466a52%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/jenkinsci-users/e4cd1d42-0fba-4faf-a023-caab8b466a52%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">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+unsubscribe@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/jenkinsci-users/CAL40ccPVuPWnNeaRostT0uggh6PaOmwE3KUzTPN2mbdqvtX%2BvQ%40mail.gmail.com?utm_medium=email&amp;utm_source=footer" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-users/CAL40ccPVuPWnNeaRostT0uggh6PaOmwE3KUzTPN2mbdqvtX%2BvQ%40mail.gmail.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-users/CAL40ccPVuPWnNeaRostT0uggh6PaOmwE3KUzTPN2mbdqvtX%2BvQ%40mail.gmail.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/jenkinsci-users/CAL40ccPVuPWnNeaRostT0uggh6PaOmwE3KUzTPN2mbdqvtX%2BvQ%40mail.gmail.com.
For more options, visit <a href="https://groups.google.com/d/optout" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/1f5c5f10-a602-4c64-ab82-633cdd5816fd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Moving a job to a Folder

Sverre Moe-2
import com.cloudbees.hudson.plugins.folder.Folder

def jenkinsInstance = jenkins.model.Jenkins.getInstance()
def newProject = jenkinsInstance.createProject(Folder.class, "my-folder-project")


mandag 6. juni 2016 15.17.13 UTC+2 skrev kumar naresh følgende:
Hi Daniel,

could you please let me know exactly how to create a jenkins folder job using groovy script.

Regards,
Naresh.

On Friday, August 21, 2015 at 12:42:40 AM UTC+5:30, 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 { <a href="http://it.name" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fit.name\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFzPnolFcOKHC2izDRzc7N56F6Jnw&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fit.name\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFzPnolFcOKHC2izDRzc7N56F6Jnw&#39;;return true;">it.name =~ "${JOB_REGEX}" }.each { job ->
  println "Moving '$<a href="http://job.name" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fjob.name\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFpBhY_z17vm0MinSshvhGG4EX8zw&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fjob.name\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFpBhY_z17vm0MinSshvhGG4EX8zw&#39;;return true;">job.name' to '$<a href="http://folder.name" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Ffolder.name\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFH1D4TLgARX8nxi17Smf-wFk7gDA&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Ffolder.name\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFH1D4TLgARX8nxi17Smf-wFk7gDA&#39;;return true;">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 <[hidden email]> 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" <[hidden email]> 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 <a href="https://groups.google.com/d/topic/jenkinsci-users/doYddgacqTQ/unsubscribe" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/topic/jenkinsci-users/doYddgacqTQ/unsubscribe&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/topic/jenkinsci-users/doYddgacqTQ/unsubscribe&#39;;return true;">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+unsubscribe@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/jenkinsci-users/e4cd1d42-0fba-4faf-a023-caab8b466a52%40googlegroups.com?utm_medium=email&amp;utm_source=footer" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-users/e4cd1d42-0fba-4faf-a023-caab8b466a52%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-users/e4cd1d42-0fba-4faf-a023-caab8b466a52%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/jenkinsci-users/e4cd1d42-0fba-4faf-a023-caab8b466a52%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">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+unsubscribe@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/jenkinsci-users/CAL40ccPVuPWnNeaRostT0uggh6PaOmwE3KUzTPN2mbdqvtX%2BvQ%40mail.gmail.com?utm_medium=email&amp;utm_source=footer" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-users/CAL40ccPVuPWnNeaRostT0uggh6PaOmwE3KUzTPN2mbdqvtX%2BvQ%40mail.gmail.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-users/CAL40ccPVuPWnNeaRostT0uggh6PaOmwE3KUzTPN2mbdqvtX%2BvQ%40mail.gmail.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/jenkinsci-users/CAL40ccPVuPWnNeaRostT0uggh6PaOmwE3KUzTPN2mbdqvtX%2BvQ%40mail.gmail.com.
For more options, visit <a href="https://groups.google.com/d/optout" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/beb7cde1-7120-462e-a97e-0da4c45e1a1a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Moving a job to a Folder

raja saggam
thanks that works really good and let me know how can we create view inside the jenkins folder job using groovy script.

On Monday, June 6, 2016 at 7:02:47 PM UTC+5:30, Sverre Moe wrote:
import com.cloudbees.hudson.plugins.folder.Folder

def jenkinsInstance = jenkins.model.Jenkins.getInstance()
def newProject = jenkinsInstance.createProject(Folder.class, "my-folder-project")


mandag 6. juni 2016 15.17.13 UTC+2 skrev kumar naresh følgende:
Hi Daniel,

could you please let me know exactly how to create a jenkins folder job using groovy script.

Regards,
Naresh.

On Friday, August 21, 2015 at 12:42:40 AM UTC+5:30, 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 { <a href="http://it.name" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fit.name\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFzPnolFcOKHC2izDRzc7N56F6Jnw&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fit.name\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFzPnolFcOKHC2izDRzc7N56F6Jnw&#39;;return true;">it.name =~ "${JOB_REGEX}" }.each { job ->
  println "Moving '$<a href="http://job.name" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fjob.name\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFpBhY_z17vm0MinSshvhGG4EX8zw&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fjob.name\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFpBhY_z17vm0MinSshvhGG4EX8zw&#39;;return true;">job.name' to '$<a href="http://folder.name" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Ffolder.name\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFH1D4TLgARX8nxi17Smf-wFk7gDA&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Ffolder.name\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFH1D4TLgARX8nxi17Smf-wFk7gDA&#39;;return true;">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 <[hidden email]> 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" <[hidden email]> 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 <a href="https://groups.google.com/d/topic/jenkinsci-users/doYddgacqTQ/unsubscribe" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/topic/jenkinsci-users/doYddgacqTQ/unsubscribe&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/topic/jenkinsci-users/doYddgacqTQ/unsubscribe&#39;;return true;">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+unsubscribe@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/jenkinsci-users/e4cd1d42-0fba-4faf-a023-caab8b466a52%40googlegroups.com?utm_medium=email&amp;utm_source=footer" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-users/e4cd1d42-0fba-4faf-a023-caab8b466a52%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-users/e4cd1d42-0fba-4faf-a023-caab8b466a52%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/jenkinsci-users/e4cd1d42-0fba-4faf-a023-caab8b466a52%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">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+unsubscribe@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/jenkinsci-users/CAL40ccPVuPWnNeaRostT0uggh6PaOmwE3KUzTPN2mbdqvtX%2BvQ%40mail.gmail.com?utm_medium=email&amp;utm_source=footer" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-users/CAL40ccPVuPWnNeaRostT0uggh6PaOmwE3KUzTPN2mbdqvtX%2BvQ%40mail.gmail.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-users/CAL40ccPVuPWnNeaRostT0uggh6PaOmwE3KUzTPN2mbdqvtX%2BvQ%40mail.gmail.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/jenkinsci-users/CAL40ccPVuPWnNeaRostT0uggh6PaOmwE3KUzTPN2mbdqvtX%2BvQ%40mail.gmail.com.
For more options, visit <a href="https://groups.google.com/d/optout" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/ba93ca7d-c25a-41bd-be8c-da14a0bbc0d4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Moving a job to a Folder

raja saggam
In reply to this post by Sverre Moe-2

Hi Sverre Moe,


thanks that works really good.

I'm actually trying to add build step to execute shell existing jenkins job using groovy script, let me know if there any steps to do so.

Regareds,
kumar.
On Monday, June 6, 2016 at 7:02:47 PM UTC+5:30, Sverre Moe wrote:
import com.cloudbees.hudson.plugins.folder.Folder

def jenkinsInstance = jenkins.model.Jenkins.getInstance()
def newProject = jenkinsInstance.createProject(Folder.class, "my-folder-project")


mandag 6. juni 2016 15.17.13 UTC+2 skrev kumar naresh følgende:
Hi Daniel,

could you please let me know exactly how to create a jenkins folder job using groovy script.

Regards,
Naresh.

On Friday, August 21, 2015 at 12:42:40 AM UTC+5:30, 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 { <a href="http://it.name" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fit.name\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFzPnolFcOKHC2izDRzc7N56F6Jnw&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fit.name\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFzPnolFcOKHC2izDRzc7N56F6Jnw&#39;;return true;">it.name =~ "${JOB_REGEX}" }.each { job ->
  println "Moving '$<a href="http://job.name" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fjob.name\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFpBhY_z17vm0MinSshvhGG4EX8zw&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fjob.name\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFpBhY_z17vm0MinSshvhGG4EX8zw&#39;;return true;">job.name' to '$<a href="http://folder.name" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Ffolder.name\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFH1D4TLgARX8nxi17Smf-wFk7gDA&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Ffolder.name\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFH1D4TLgARX8nxi17Smf-wFk7gDA&#39;;return true;">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 <[hidden email]> 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" <[hidden email]> 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 <a href="https://groups.google.com/d/topic/jenkinsci-users/doYddgacqTQ/unsubscribe" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/topic/jenkinsci-users/doYddgacqTQ/unsubscribe&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/topic/jenkinsci-users/doYddgacqTQ/unsubscribe&#39;;return true;">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+unsubscribe@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/jenkinsci-users/e4cd1d42-0fba-4faf-a023-caab8b466a52%40googlegroups.com?utm_medium=email&amp;utm_source=footer" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-users/e4cd1d42-0fba-4faf-a023-caab8b466a52%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-users/e4cd1d42-0fba-4faf-a023-caab8b466a52%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/jenkinsci-users/e4cd1d42-0fba-4faf-a023-caab8b466a52%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">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+unsubscribe@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/jenkinsci-users/CAL40ccPVuPWnNeaRostT0uggh6PaOmwE3KUzTPN2mbdqvtX%2BvQ%40mail.gmail.com?utm_medium=email&amp;utm_source=footer" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-users/CAL40ccPVuPWnNeaRostT0uggh6PaOmwE3KUzTPN2mbdqvtX%2BvQ%40mail.gmail.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-users/CAL40ccPVuPWnNeaRostT0uggh6PaOmwE3KUzTPN2mbdqvtX%2BvQ%40mail.gmail.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/jenkinsci-users/CAL40ccPVuPWnNeaRostT0uggh6PaOmwE3KUzTPN2mbdqvtX%2BvQ%40mail.gmail.com.
For more options, visit <a href="https://groups.google.com/d/optout" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/94371387-6de7-403e-93b0-5b8e27d208af%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Moving a job to a Folder

Sverre Moe-2
Try the Groovy Postbuild Plugin
You could also use the build step "Execute system Groovy script"

torsdag 9. juni 2016 08.05.39 UTC+2 skrev kumar naresh følgende:

Hi Sverre Moe,


thanks that works really good.

I'm actually trying to add build step to execute shell existing jenkins job using groovy script, let me know if there any steps to do so.

Regareds,
kumar.
On Monday, June 6, 2016 at 7:02:47 PM UTC+5:30, Sverre Moe wrote:
import com.cloudbees.hudson.plugins.folder.Folder

def jenkinsInstance = jenkins.model.Jenkins.getInstance()
def newProject = jenkinsInstance.createProject(Folder.class, "my-folder-project")


mandag 6. juni 2016 15.17.13 UTC+2 skrev kumar naresh følgende:
Hi Daniel,

could you please let me know exactly how to create a jenkins folder job using groovy script.

Regards,
Naresh.

On Friday, August 21, 2015 at 12:42:40 AM UTC+5:30, 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 { <a href="http://it.name" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fit.name\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFzPnolFcOKHC2izDRzc7N56F6Jnw&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fit.name\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFzPnolFcOKHC2izDRzc7N56F6Jnw&#39;;return true;">it.name =~ "${JOB_REGEX}" }.each { job ->
  println "Moving '$<a href="http://job.name" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fjob.name\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFpBhY_z17vm0MinSshvhGG4EX8zw&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fjob.name\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFpBhY_z17vm0MinSshvhGG4EX8zw&#39;;return true;">job.name' to '$<a href="http://folder.name" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Ffolder.name\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFH1D4TLgARX8nxi17Smf-wFk7gDA&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Ffolder.name\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFH1D4TLgARX8nxi17Smf-wFk7gDA&#39;;return true;">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 <[hidden email]> 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" <[hidden email]> 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 <a href="https://groups.google.com/d/topic/jenkinsci-users/doYddgacqTQ/unsubscribe" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/topic/jenkinsci-users/doYddgacqTQ/unsubscribe&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/topic/jenkinsci-users/doYddgacqTQ/unsubscribe&#39;;return true;">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+unsubscribe@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/jenkinsci-users/e4cd1d42-0fba-4faf-a023-caab8b466a52%40googlegroups.com?utm_medium=email&amp;utm_source=footer" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-users/e4cd1d42-0fba-4faf-a023-caab8b466a52%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-users/e4cd1d42-0fba-4faf-a023-caab8b466a52%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/jenkinsci-users/e4cd1d42-0fba-4faf-a023-caab8b466a52%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">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+unsubscribe@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/jenkinsci-users/CAL40ccPVuPWnNeaRostT0uggh6PaOmwE3KUzTPN2mbdqvtX%2BvQ%40mail.gmail.com?utm_medium=email&amp;utm_source=footer" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-users/CAL40ccPVuPWnNeaRostT0uggh6PaOmwE3KUzTPN2mbdqvtX%2BvQ%40mail.gmail.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-users/CAL40ccPVuPWnNeaRostT0uggh6PaOmwE3KUzTPN2mbdqvtX%2BvQ%40mail.gmail.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/jenkinsci-users/CAL40ccPVuPWnNeaRostT0uggh6PaOmwE3KUzTPN2mbdqvtX%2BvQ%40mail.gmail.com.
For more options, visit <a href="https://groups.google.com/d/optout" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/13521d94-cea4-407a-9714-30dcac578fa4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Moving a job to a Folder

raja saggam
HI Sverre,

thanks for reply where I'm actually trying to execute groovy script from manage jenkins->manage nodes->master->script console 

and cloning new jobs using existing jenkins jobs using groovy script and also I wanted to add extra one step to execute shell  to new jobs i.e for example "echo hi" in first line using groovy script .

Regards,
kumar

On Thursday, June 9, 2016 at 11:44:46 AM UTC+5:30, Sverre Moe wrote:
Try the Groovy Postbuild Plugin
You could also use the build step "Execute system Groovy script"

torsdag 9. juni 2016 08.05.39 UTC+2 skrev kumar naresh følgende:

Hi Sverre Moe,


thanks that works really good.

I'm actually trying to add build step to execute shell existing jenkins job using groovy script, let me know if there any steps to do so.

Regareds,
kumar.
On Monday, June 6, 2016 at 7:02:47 PM UTC+5:30, Sverre Moe wrote:
import com.cloudbees.hudson.plugins.folder.Folder

def jenkinsInstance = jenkins.model.Jenkins.getInstance()
def newProject = jenkinsInstance.createProject(Folder.class, "my-folder-project")


mandag 6. juni 2016 15.17.13 UTC+2 skrev kumar naresh følgende:
Hi Daniel,

could you please let me know exactly how to create a jenkins folder job using groovy script.

Regards,
Naresh.

On Friday, August 21, 2015 at 12:42:40 AM UTC+5:30, 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 { <a href="http://it.name" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fit.name\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFzPnolFcOKHC2izDRzc7N56F6Jnw&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fit.name\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFzPnolFcOKHC2izDRzc7N56F6Jnw&#39;;return true;">it.name =~ "${JOB_REGEX}" }.each { job ->
  println "Moving '$<a href="http://job.name" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fjob.name\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFpBhY_z17vm0MinSshvhGG4EX8zw&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fjob.name\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFpBhY_z17vm0MinSshvhGG4EX8zw&#39;;return true;">job.name' to '$<a href="http://folder.name" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Ffolder.name\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFH1D4TLgARX8nxi17Smf-wFk7gDA&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Ffolder.name\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFH1D4TLgARX8nxi17Smf-wFk7gDA&#39;;return true;">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 <[hidden email]> 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" <[hidden email]> 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 <a href="https://groups.google.com/d/topic/jenkinsci-users/doYddgacqTQ/unsubscribe" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/topic/jenkinsci-users/doYddgacqTQ/unsubscribe&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/topic/jenkinsci-users/doYddgacqTQ/unsubscribe&#39;;return true;">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+unsubscribe@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/jenkinsci-users/e4cd1d42-0fba-4faf-a023-caab8b466a52%40googlegroups.com?utm_medium=email&amp;utm_source=footer" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-users/e4cd1d42-0fba-4faf-a023-caab8b466a52%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-users/e4cd1d42-0fba-4faf-a023-caab8b466a52%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/jenkinsci-users/e4cd1d42-0fba-4faf-a023-caab8b466a52%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">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+unsubscribe@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/jenkinsci-users/CAL40ccPVuPWnNeaRostT0uggh6PaOmwE3KUzTPN2mbdqvtX%2BvQ%40mail.gmail.com?utm_medium=email&amp;utm_source=footer" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-users/CAL40ccPVuPWnNeaRostT0uggh6PaOmwE3KUzTPN2mbdqvtX%2BvQ%40mail.gmail.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-users/CAL40ccPVuPWnNeaRostT0uggh6PaOmwE3KUzTPN2mbdqvtX%2BvQ%40mail.gmail.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/jenkinsci-users/CAL40ccPVuPWnNeaRostT0uggh6PaOmwE3KUzTPN2mbdqvtX%2BvQ%40mail.gmail.com.
For more options, visit <a href="https://groups.google.com/d/optout" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/ef8f858c-3d96-4542-a904-d696892fa9d8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Moving a job to a Folder

Muthu Kumaran
In reply to this post by Daniel Laird-2
Hi,

I am trying to add users to a folder group in Jenkins. Can anyone let me know how to accomplish this via groovy script.

1. List the folder
2. List the groups in the folder
3. Add user to the folder group.

Your help is much appreciated.

Thanks in Advance. 

Muthu

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/d9408b61-4981-4c51-a0e0-ae21816c7b51%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Moving a job to a Folder

Victor Martinez
I guess, this is something outside of what this particular topic was about. Maybe it's worth raising this question in another new thread?

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/bbce7213-1f95-4b60-85c0-286287f0dab8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Moving a job to a Folder

Muthu Kumaran
Sure Victor,

you can put this in a separate thread. I was expecting a solution for this issue. Even any relevant articles would be good.

On Friday, November 24, 2017 at 12:34:57 AM UTC+5:30, Victor Martinez wrote:
I guess, this is something outside of what this particular topic was about. Maybe it's worth raising this question in another new thread?

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/7cc981b4-3ae5-44b1-b71a-351bd452604b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.