Re: Is it possible to re-run init.groovy.d scripts whilst Jenkins is running?

2018-08-29 Thread Edd Grant
Thanks for this Jan, wasn't aware of this, will investigate further.

On Thursday, 9 August 2018 06:59:10 UTC+1, Jan Monterrubio wrote:
>
> You can post the script contents to the script run endpoint I believe. 
>
> “
> A Jenkins Admin can execute groovy scripts remotely by sending an HTTP 
> POST request to /script/ url or /scriptText/.
>
> “
>
> From 
>
> https://wiki.jenkins.io/display/JENKINS/Jenkins+Script+Console#JenkinsScriptConsole-Remoteaccess
>
> On Fri, Aug 3, 2018 at 11:31 AM Cuong Tran  > wrote:
>
>> Can't you run your script under script console /script?
>>
>> -- 
>> 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/d6fd715e-63a0-49d4-8454-0c5485a78fed%40googlegroups.com
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
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/f4167889-1ede-4179-ab22-f4fc6c9a0ed7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Is it possible to re-run init.groovy.d scripts whilst Jenkins is running?

2018-08-29 Thread Edd Grant
Hi Ewelina,

Thanks for this, I have installed the configuration-as-code plugin and have 
had a quick look. I can see there's a "reload existing configuration" 
button in the UI. Is this accessible via the Jenkins API? I ask as we want 
to be able to dynamically configure the Jenkins master without having to 
take it out of service.

Many thanks,

Edd 

On Thursday, 9 August 2018 10:02:04 UTC+1, Ewelina Wilkosz wrote:
>
> Hi Edd,
>
> maybe you can have a look at 
> https://github.com/jenkinsci/configuration-as-code-plugin
> release 1.0 is coming soon, we have a number of alphas already out. maybe 
> it can solve your issues - if not it's always good to hear what's missing :)
>
> On Friday, August 3, 2018 at 10:08:52 AM UTC+2, Edd Grant wrote:
>>
>> Hi folks,
>>
>> We've spent quite a lot of effort automating the configuration of our 
>> Jenkins (2.122) master using init.groovy.d scripts. It's working really 
>> well apart from one caveat, being that (as far as I can tell) we have to 
>> restart the master in order to kick off the scripts in the init.groovy.d 
>> directory, thus causing downtime for our users.
>>
>> I would really like to find a way to be able to run these scripts on an 
>> already running Jenkins master. Is there an API endpoint (or some other 
>> means) which would trigger this process?
>>
>> Many thanks,
>>
>> Edd 
>>
>

-- 
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/bf96224b-fea7-4a11-95d7-6e9fab1a5211%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Is it possible to re-run init.groovy.d scripts whilst Jenkins is running?

2018-08-03 Thread Edd Grant
Hi folks,

We've spent quite a lot of effort automating the configuration of our 
Jenkins (2.122) master using init.groovy.d scripts. It's working really 
well apart from one caveat, being that (as far as I can tell) we have to 
restart the master in order to kick off the scripts in the init.groovy.d 
directory, thus causing downtime for our users.

I would really like to find a way to be able to run these scripts on an 
already running Jenkins master. Is there an API endpoint (or some other 
means) which would trigger this process?

Many thanks,

Edd 

-- 
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/e997c2c1-5ebb-4bfa-a86e-8456c58dd1ed%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Break init scripts up in to re-usable classes

2018-03-13 Thread Edd Grant
Thanks for the response R Tyler Croy, I'm suddenly kicking myself for not 
finding that plugin when I looked for stuff like this!

I notice the plugin is currently at 0.1 alpha, do (or do other folks here) 
have any experience using it? It it fairly reliable doing the things it 
mentions in the docs (LDAP config etc)? I'm torn as we have additional 
requirements such as loading up trust stores etc and I'd rather not have 2 
separate mechanisms to configure different bits of Jenkins.

Cheers,

Edd 

On Monday, 12 March 2018 21:57:42 UTC, Edd Grant wrote:
>
> Hi folks,
>
> I'm using the init hook script mechanism ($JENKINS_HOME/init.groovy.d) to 
> programmatically configure Jenkins. I'm building up quite a library of code 
> and want to split it out in to re-usable classes, to keep things 
> maintainable and make it easier to write well focused tests etc. I have 
> tried the following with no luck:
>
> 1: Trying to split classes out in to separate scripts and using Groovy's 
> 'evaluate' function to load the classes from each script (basically trying 
> to re-implement some sort of importing behaviour). This doesn't work at all 
> due to the way Groovy manipulates scripts.
>
> 2: Putting my classes in a jar file and adding this to WEB-INF/lib in the 
> Jenkins war. This approach leads to classloader errors, presumably because 
> the jar classloader that my code belongs to doesn't have access to Jenkins' 
> PluginManager 'uberClassLoader'?  
>
> 3: Same as [2] but adding the jar to the JVM's classpath rather than 
> adding it to the jar. Same result as [2].
>
> Has anyone tried doing anything similar to this before? I'm really keen to 
> be able to do things like organise my code in packages and keep it in small 
> maintainable units. Grateful for any suggestions.
>
> Cheers,
>
> Edd
>

-- 
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/69f48e62-b013-4721-9413-1a43ef53ab2d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Break init scripts up in to re-usable classes

2018-03-12 Thread Edd Grant
Gah, spotted a typo. Just to avoid confusion [3] should say "rather than 
adding it to the *war*", not the jar.

Cheers,

Edd

On Monday, 12 March 2018 21:57:42 UTC, Edd Grant wrote:
>
> Hi folks,
>
> I'm using the init hook script mechanism ($JENKINS_HOME/init.groovy.d) to 
> programmatically configure Jenkins. I'm building up quite a library of code 
> and want to split it out in to re-usable classes, to keep things 
> maintainable and make it easier to write well focused tests etc. I have 
> tried the following with no luck:
>
> 1: Trying to split classes out in to separate scripts and using Groovy's 
> 'evaluate' function to load the classes from each script (basically trying 
> to re-implement some sort of importing behaviour). This doesn't work at all 
> due to the way Groovy manipulates scripts.
>
> 2: Putting my classes in a jar file and adding this to WEB-INF/lib in the 
> Jenkins war. This approach leads to classloader errors, presumably because 
> the jar classloader that my code belongs to doesn't have access to Jenkins' 
> PluginManager 'uberClassLoader'?  
>
> 3: Same as [2] but adding the jar to the JVM's classpath rather than 
> adding it to the jar. Same result as [2].
>
> Has anyone tried doing anything similar to this before? I'm really keen to 
> be able to do things like organise my code in packages and keep it in small 
> maintainable units. Grateful for any suggestions.
>
> Cheers,
>
> Edd
>

-- 
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/8cfd77ba-9ad2-4553-8925-17950a90462b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Break init scripts up in to re-usable classes

2018-03-12 Thread Edd Grant
Hi folks,

I'm using the init hook script mechanism ($JENKINS_HOME/init.groovy.d) to 
programmatically configure Jenkins. I'm building up quite a library of code 
and want to split it out in to re-usable classes, to keep things 
maintainable and make it easier to write well focused tests etc. I have 
tried the following with no luck:

1: Trying to split classes out in to separate scripts and using Groovy's 
'evaluate' function to load the classes from each script (basically trying 
to re-implement some sort of importing behaviour). This doesn't work at all 
due to the way Groovy manipulates scripts.

2: Putting my classes in a jar file and adding this to WEB-INF/lib in the 
Jenkins war. This approach leads to classloader errors, presumably because 
the jar classloader that my code belongs to doesn't have access to Jenkins' 
PluginManager 'uberClassLoader'?  

3: Same as [2] but adding the jar to the JVM's classpath rather than adding 
it to the jar. Same result as [2].

Has anyone tried doing anything similar to this before? I'm really keen to 
be able to do things like organise my code in packages and keep it in small 
maintainable units. Grateful for any suggestions.

Cheers,

Edd

-- 
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/dfb93cdd-c2d9-4c05-a7d6-007158e3d821%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.