Thank you very much Reinhold Füreder

I will look into reflection, but probably just choose to ignore the errors and 
they do not end up causing problems anyways.
And I will consider filling a bug with Jenkins.


[Agility PR Solutions]<https://agilitypr.com/>
Jason Grammenos | Operations and Infrastructure Analyst
P: 613.232.7797 | Toll-free: 866.545.3745
Work hours: Monday-Friday, 8am-4:30pm ET
jason.gramme...@agilitypr.com
agilitypr.com<https://agilitypr.com/> (formerly MediaMiser)

From: jenkinsci-users@googlegroups.com 
[mailto:jenkinsci-users@googlegroups.com] On Behalf Of Reinhold Füreder
Sent: December 19, 2017 1:45 AM
To: jenkinsci-users@googlegroups.com
Subject: RE: Jenkins init.groovy compilation

Hi Jason,

yes, I remember stumbling over this as well.

Partially I have actually uses a workaround for that compilation failure: 
However, I am not sure it is worth it – because it is based on using 
reflection, e.g.:

def instance = Jenkins.getInstance()
…
    // LDAPSecurityRealm class depends on "LDAP" plugin => use reflection for 
creation:
    def ldapSecurityRealmClass = 
this.class.classLoader.loadClass('hudson.security.LDAPSecurityRealm')
    SecurityRealm ldapRealm = ldapSecurityRealmClass.newInstance(server, 
rootDN, userSearchBase, userSearch, groupSearchBase, managerDN, 
managerPassword, inhibitInferRootDN)
    instance.setSecurityRealm(ldapRealm)
    instance.save()


And later on, IIRC, I mostly “only” relied on the init scripts (one for each 
responsibility “area”) checking whether or not a restart due to plugin 
installation/updates is still pending based on a kind of marker file (and 
ignoring compilation failures):

def restartFile = new File(instance.getRootDir(), "JenkinsRestartByInitScript")
if (restartFile.exists()) {
  println "--> Jenkins restart is pending: skipping this hook script"
  return
}
// Here follows the logic like setting up the LDAP security realm…


HTH -- although this is not a real solution,
                Reinhold
--
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<mailto:jenkinsci-users+unsubscr...@googlegroups.com>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/AM4P190MB00677F1A1C76C862343A189EF70F0%40AM4P190MB0067.EURP190.PROD.OUTLOOK.COM<https://groups.google.com/d/msgid/jenkinsci-users/AM4P190MB00677F1A1C76C862343A189EF70F0%40AM4P190MB0067.EURP190.PROD.OUTLOOK.COM?utm_medium=email&utm_source=footer>.
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/YTOPR0101MB100385502D752D88B987294DE40F0%40YTOPR0101MB1003.CANPRD01.PROD.OUTLOOK.COM.
For more options, visit https://groups.google.com/d/optout.

Reply via email to