Moving a job to a Folder

已查看 2,369 次
跳至第一个未读帖子

Daniel Laird

未读,
2015年8月6日 16:45:472015/8/6
收件人 Jenkins Users
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

Gergely Brautigam

未读,
2015年8月10日 09:02:322015/8/10
收件人 Jenkins Users
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.

VFloyd

未读,
2015年8月14日 13:48:032015/8/14
收件人 Jenkins Users
Any ideas on how to move more than one job at a time into a folder?

Stephen Connolly

未读,
2015年8月14日 18:00:072015/8/14
收件人 jenkins...@googlegroups.com
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!)
--
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-use...@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.
For more options, visit https://groups.google.com/d/optout.


--
Sent from my phone

Vanetta Floyd

未读,
2015年8月14日 19:49:122015/8/14
收件人 jenkins...@googlegroups.com

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?

--
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-use...@googlegroups.com.

Stephen Connolly

未读,
2015年8月15日 02:19:242015/8/15
收件人 jenkins...@googlegroups.com
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
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-use...@googlegroups.com.
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.

Vanetta Floyd

未读,
2015年8月15日 07:36:272015/8/15
收件人 jenkins...@googlegroups.com

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

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-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CA%2BnPnMwBeqFvZAspj%2BcFRekgQvKrbSg4JZm9Fn9wX_63ei2Ndw%40mail.gmail.com.

Stephen Connolly

未读,
2015年8月15日 09:58:082015/8/15
收件人 jenkins...@googlegroups.com


On Saturday, August 15, 2015, Vanetta Floyd <vanett...@gmail.com> 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
 
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.

Daniel Serodio

未读,
2015年8月20日 15:12:402015/8/20
收件人 Jenkins Users
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" <vanett...@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+unsubscribe@googlegroups.com.

--
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.

Khai Do

未读,
2015年8月21日 14:55:272015/8/21
收件人 Jenkins Users
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 :)

kumar naresh

未读,
2016年6月6日 09:17:132016/6/6
收件人 Jenkins Users
Hi Daniel,

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

Regards,
Naresh.

Sverre Moe

未读,
2016年6月6日 09:32:472016/6/6
收件人 Jenkins Users
import com.cloudbees.hudson.plugins.folder.Folder

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

kumar naresh

未读,
2016年6月9日 02:05:392016/6/9
收件人 Jenkins Users

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.

Sverre Moe

未读,
2016年6月9日 02:14:462016/6/9
收件人 Jenkins Users
Try the Groovy Postbuild Plugin
You could also use the build step "Execute system Groovy script"
已删除帖子

Muthu Kumaran

未读,
2017年11月23日 10:15:122017/11/23
收件人 Jenkins Users
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

Victor Martinez

未读,
2017年11月23日 14:04:572017/11/23
收件人 Jenkins Users
I guess, this is something outside of what this particular topic was about. Maybe it's worth raising this question in another new thread?

Muthu Kumaran

未读,
2017年11月24日 06:06:562017/11/24
收件人 Jenkins Users
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:
回复全部
回复作者
转发
0 个新帖子