Hi there,

On 01/12/2015 01:46 PM, Kenneth Baltrinic wrote:
I am working on creating a chef cookbook to automate our Jenkins
infrastructure.  I am using the opscode Jenkins cookbook as my starting
point but it only has a few basic resources.  I can see I am going to
need use the cookbook's jenkins_script resource to configure Jenkins via
groovy.

What are you trying to configure via Groovy? Quite a lot of stuff can be done via the REST API or the CLI, but using the Groovy console generally seems more suited to fairly low-level operations.

I know it's not Chef, but have you seen the Puppet module for Jenkins? Likely there are some insights to be found in its code:
https://forge.puppetlabs.com/rtyler/jenkins


That would be fine except I am having considerable difficulty figuring
out how to configure Jenkins via groovy.  There does not seem to be a
lot of information out there either in the Jenkins docs nor in blogs,
etc.  None of the plug-ins document their API, etc.  There are API docs
for main Jenkins which help but only if you already understand the big
picture, which is what I am struggling with right now.  I understand how
to configure all of our Jenkins boxes via the UI, but how do I learn to
translate that into knowledge of writing groovy scripts?  Right now the
only means I am seeing is to spend a very long time digging my way
through the source code itself and learning from trial and error.  Is
there another way?

How do people out there learn and use the Jenkins API?

Trial-and-error is probably the most common way :) But this mailing list and the IRC channel are good resources too.

But when you say you're struggling with the big picture, what are you trying to do? Plugins generally don't need to be configured, especially not via Groovy scripts — most plugin configuration is done per-job and so is bundled with with config.xml for the job.

You should be able to get pretty far by building the config you want in the web UI, exporting the config XML via $JENKINS_URL/job/$JOB_NAME/config.xml, which you can then later POST to the REST API in another Jenkins instance.

Regards,
Chris

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

Reply via email to