I recently watched Sam's video guides on how to modify Jenkins settings via Groovy scripts.
-- I'm trying to modify the default shell programmatically and running into difficulties. On a different Jenkins instance, I see that hudson.tasks.Shell.xml contains this config
How do I access that field using Groovy? I found hudson.tasks.Shell.DescriptorImpl.setShell(String shell) doc. When I tried to access hudson.tasks via Hudson.instance.tasks.dump() I got this error
1. Jenkins.instance vs Hudson.instance? Which contains what and why? 2. How do I access the setShell() method? Thanks for your help in advance You received this message because you are subscribed to the Google Groups "Jenkins Developers" 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-dev/f6ab5198-ddf5-406b-bb89-4d3e6bc48f62%40googlegroups.com. For more options, visit https://groups.google.com/d/optout. |
Hi Calvin,
-- Jenkins.instance vs Hudson.instance? Which contains what and why?
Hudson.instance.tasks. As designed, there is no "tasks" in the Jenkins object: https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/jenkins/model/Jenkins.java . Likely you got confused by package names. How do I access the setShell() method? It should be something like that (untested): Jenkins.instance.getDescriptor(hudson.tasks.Shell.class).setShell() Oleg On Sunday, April 15, 2018 at 10:32:45 PM UTC+2, Calvin wrote:
You received this message because you are subscribed to the Google Groups "Jenkins Developers" 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-dev/3176f78e-0d2b-4539-b9b2-370a962150da%40googlegroups.com. For more options, visit https://groups.google.com/d/optout. |
Thank you Oleg. I'll dig more into Descriptor.java to get a better understanding.
-- On Monday, April 16, 2018 at 2:11:23 AM UTC-7, Oleg Nenashev wrote:
You received this message because you are subscribed to the Google Groups "Jenkins Developers" 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-dev/61b81205-cee0-456c-bd9d-7f19e921a6b0%40googlegroups.com. For more options, visit https://groups.google.com/d/optout. |
Free forum by Nabble | Edit this page |