Re: Automating Jenkins Deployments with Chef
Chris, Thank you for your reply. Yes, I am using the copy config.xml approach for a lot of scenarios but it seems like a back door approach. I would have more confidence in the robustness of my code if I were using an API that threw errors when I did things wrong rather than potentially write some bad xml that either breaks jenkins all together (i've had it refuse to start a few times) or misbehave is subtle ways. All that said though, to answer your question about specific examples, here are two of my other posts on things I am trying to configure in Jenkins via groovy. How to configure Maven Installation via Groovy https://groups.google.com/forum/#!topic/jenkinsci-users/wsvDiFVQ7xo Create UserPrivateKeySource Credential via Groovy? https://groups.google.com/forum/#!topic/jenkinsci-users/Ou3k6Mqr3vg In the case of the former, I am presently using an xml template as the solution. In the latter case, I have not go there yet as there does seem to be hope of getting the API to work. (fingers crossed). --Ken On Monday, January 12, 2015 at 7:46:06 AM UTC-5, 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. 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? -- 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/ed568564-34be-41d4-8a2d-63672dfdc84d%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Automating Jenkins Deployments with Chef
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.
Automating Jenkins Deployments with Chef
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. 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? -- 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/a3c7f63e-578b-4104-b45e-61f646d04bff%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.