Promoted build plugin

1,042 views
Skip to first unread message

Per Lindfors

unread,
May 31, 2013, 3:10:12 AM5/31/13
to job-dsl...@googlegroups.com


Hi

I'm trying to create jobs from a template(by 'using') that has the promoted build plugon configured. The config for the promotion is copied to the new job, but i dont know how to also copy the promotions directory(directory in the template job that holds config, builds etc. for the promoted builds). I know this can be achived with the 'copy job' plugin but I rather use the job-dsl plugin.

Any ideas? Is this even possible?

/Per

Andrew Harmel-Law

unread,
Jun 17, 2013, 8:30:40 AM6/17/13
to job-dsl...@googlegroups.com
Hi Per,

Apologies it took so long for someone to get back to you.  I hope I can help.

The DSL doesn't currently support the PromotedBuilds Jenkins plugin (though it would be great if someone added it - or you could use it now via a custom configure block).  

However, I think your problem might be that you are trying to use "using" to copy an exiting job completely (config.xml, directories, etc).  Unfortunately "using" isn't that clever - we only take the config.xml.  Could you describe your use-case in a little more detail (and tell me if I'm on the right track) and hopefully we can get you set up.

Cheers, Andrew

/Per

--
You received this message because you are subscribed to the Google Groups "job-dsl-plugin" group.
To unsubscribe from this group and stop receiving emails from it, send an email to job-dsl-plugi...@googlegroups.com.
To post to this group, send email to job-dsl...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/job-dsl-plugin/babded4a-23e1-4a0c-8a3e-8c9941a128c7%40googlegroups.com?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Per Lindfors

unread,
Jun 18, 2013, 2:53:49 AM6/18/13
to job-dsl...@googlegroups.com
Hi Andrew,
 
Yes, you are on the right track. I'm a newbie to DSL and it took me some time to figure out that 'using' is only copying the config.xml. I've sort of figured out that I could use the custom config option, but this is where my knowledge and skills ends. My use case is pretty straight forward - we would like to automate as much as possible in the development process, including setting up jobs in Jenkins. At the moment there are two 'standard jobs' that every project will have, one that fires upon change in SVN and run unittests. With this job you should be able to promote builds and also make a release with the Maven release plugin. The other job runs Sonar.
 
We have accomplished this with a mix of copy-job plugin and a lot of pre/post steps in the config. The bottomline is that this 'provisioning' job is complex and and hard to maintain. It would be a lot better to only use the DSL plugin and 'write code' instead of configuring a combination of other Jenkins plugins. By using the DSL plugin, it seems to me that you get a stable and maintainable provisioning job in Jenkins(if I knew how to use the config option...).
 
It would be much appriciated if you or someone could give me some hints or direct me to some examples on how to use the config option in trying to copy the contents in the promotions directory or maybe creating the promotion from scratch.
 
Regards
 
/Per


--
You received this message because you are subscribed to a topic in the Google Groups "job-dsl-plugin" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/job-dsl-plugin/XYSd8-es24g/unsubscribe.

To unsubscribe from this group and all its topics, send an email to job-dsl-plugi...@googlegroups.com.

To post to this group, send email to job-dsl...@googlegroups.com.

Andrew Harmel-Law

unread,
Jun 18, 2013, 7:38:44 AM6/18/13
to job-dsl...@googlegroups.com

Hi Per,

Thanks for choosing job-dsl!  Your use case sounds (generally) quite familiar.  There are others out there (including my company in the past) who, when they do something like create a new SVN branch, or fork a github repo, want to copy their Jenkins Job Suite too so they can still have all the Jenkins benefits even when they are not working on the trunk / mainline.

Regarding your specific use case, I guess you're using this promoted builds plugin and this job copy plugin.  Unfortunately, at the moment, neither is supported by the DSL out of the box.  This leaves you with three options:

1. Use the configure block support (which lets you effectively code XML directly but with nice Groovy syntax) - this is quite simple to use
2. Implement support for these plugins yourself (and submit them to the project for inclusion in the DSL if you like) - again this is quite simple, but a little more work
3. Change the way you are creating your builds - see below

Options 1 and 2 have links in them to get you started.  Option 3 might however be the way to go.  Assuming I'm right in my statement in the opening paragraph about your general usage, may I ask a little about the specifics of your situation?

Question 1: it seems like the significant part of your problem is the copying of elements (beyond the config.xml) from one job's workspace to another. Is this correct?
Question 2: do you have scripts which do the workspace copying at the moment?  If so, you could re-use these and call them from steps created by the Job-DSL. We also do have support for the copyArtifacts plugin hwich might help you
Question 3: Do you use build slaves? Do you build on different Operating Systems?  I know this can make some things difficult
Question 4: do you need to copy the contents of the workspace? Job-Copy doesn't seem to do this, and job-dsl seems to be a very similar solution to what it does do.  Build-Promotion however does access the files of other jobs (i believe) but doesn't move them (I think).  Could you elaborate on this a little for me so I can provide a bit more help as I am guessing this is the nu b of your problem

I hope all these answers and questions make sense. 

Looking forward to hearing from you. 

Gareth Bowles

unread,
Aug 20, 2013, 7:26:27 PM8/20/13
to job-dsl...@googlegroups.com
Just resurrecting this thread as we ran into the problem at work today.

The specific issue with the Promoted Builds plugin is that most of the XML config for a promotion isn't written to the job's config.xml; it goes into a separate file $JENKINS_HOME/jobs/<jobname>/promotions/<promotionname>/config.xml.  So the Job DSL plugin would need to make a special case for this; it seems like it would be better to update the plugin to be aware of the Promoted Builds plugin rather than try to write out multiple files with configure blocks, although you could probably achieve the second option.

David Campos

unread,
Jan 17, 2014, 12:36:09 PM1/17/14
to job-dsl...@googlegroups.com
There is already a way to control the creation of folders and new files? Is it possible to create the promotion folder?

Eddie Sholl

unread,
Oct 1, 2014, 3:50:33 AM10/1/14
to job-dsl...@googlegroups.com
There's mention of the manual solution to the problem. Creating additional config files out of the DSL. I can't find any other mention or examples for how to achieve this.

Any ideas or pointers on solving this? It sounds like both folders and files would be required.

This is an annoying stumbling block, its a shame the promotion plugin picked this model to implement, because its so incompatible with the DSL approach. I guess that's the joy of plugins though :)

Eddie Sholl

unread,
Oct 2, 2014, 6:49:05 AM10/2/14
to job-dsl...@googlegroups.com
As I learn a bit more about how the plugin is working, it seems like there's a couple of options. As I understand it, right now there's no way to programmatically create the other bits and pieces needed here from inside the DSL file context. For example, you can't find the output path for each job, and that doesn't really make sense because the job might not even exist yet.

As far as I can tell, the options are either:

* Enhance the DSL plugin so it can generate additional items, either generic support for this or really tailored to the promotion plugin
* After running the DSL for generation, have a second job that runs a groovy script etc that finds the jobs that need a publish step, and programmatically add the folders and files. This all occurs after the DSL has completed.

Does that sound about right?

Steve Jansen

unread,
Dec 28, 2014, 9:55:51 AM12/28/14
to job-dsl...@googlegroups.com
FYI - https://github.com/jenkinsci/job-dsl-plugin/pull/291 adds support for the promoted-builds plugin

hgabre

unread,
Jul 7, 2015, 5:07:44 AM7/7/15
to job-dsl...@googlegroups.com
Can I ask what the current status of the "JobDSL + Promoted Builds plugin combo" is? I know that the JobDSL extension point is ready to be used but I don't know if there is a new Promoted builds plugin which is able to use that extension point.

Ferenc Kovacs

unread,
Dec 10, 2015, 11:14:48 AM12/10/15
to job-dsl-plugin
see https://issues.jenkins-ci.org/browse/JENKINS-21750 for the current status, basically it got stuck as the separate jenkins plugin proposed got rejected, but as others suggested I think it would be fine to simply put it under src/main/groovy/ into the promoted builds plugin.

Jim Searle

unread,
Apr 4, 2016, 3:54:00 PM4/4/16
to job-dsl-plugin
It looks like https://issues.jenkins-ci.org/browse/JENKINS-21750 is done and ready be merged.  Do you know how long it will be until that happens and we can use this?  and is it an update to the plugin or Jenkins itself?  Sorry I don't know how all that works.  I've converted our entire system to JobDSL, but this is the last missing piece so I need to decide if I should wait or implement with configure.

Ferenc Kovacs

unread,
Apr 4, 2016, 5:21:01 PM4/4/16
to job-dsl...@googlegroups.com
you can find a 2.26 snapshot build in the comments at https://github.com/jenkinsci/promoted-builds-plugin/pull/82#issuecomment-201712737 or build yourself until the official release is made. 


--
You received this message because you are subscribed to a topic in the Google Groups "job-dsl-plugin" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/job-dsl-plugin/XYSd8-es24g/unsubscribe.
To unsubscribe from this group and all its topics, send an email to job-dsl-plugi...@googlegroups.com.
To post to this group, send email to job-dsl...@googlegroups.com.

Jim Searle

unread,
Apr 5, 2016, 11:35:56 AM4/5/16
to job-dsl-plugin
Thanks!  Our company only allows running released plugins so I'll have to wait until it is officially released.  Will the usage also show up in the https://jenkinsci.github.io/job-dsl-plugin/# when job-dsl-plugin is released?
Reply all
Reply to author
Forward
0 new messages