[JIRA] (JENKINS-59632) Plugin does not respect the jenkinsUrl configuration from configuration-as-code

2019-11-15 Thread rty...@brokenco.de (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 R. Tyler Croy commented on  JENKINS-59632  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: Plugin does not respect the jenkinsUrl configuration from configuration-as-code   
 

  
 
 
 
 

 
 I have a workaround which I am using for now, which relies on the init.groovy.d/ support in Jenkins: 

 

/*
 * This script helps work around an issue with the Jenkins Kubernetes plugin
 * which doesn't properly receive the configured `jenkinsUrl` on restart.
 *
 * The script is making an assumption that we can wait for a few seconds on
 * bootstrap before overwriting the URL on the object directly
 *
 * See: //issues.jenkins-ci.org/browse/JENKINS-59632>
 */
import jenkins.model.*
import org.csanchez.jenkins.plugins.kubernetes.*

/*
 * Spinning off a separate thread to do this work so this doesn't block the
 * bootstrap of the Jenkins master
 */
Thread.start {
sleep 5000
/*
 * On the off chance we have more clouds, this is looking for the
 * Kubernetes one only, and then setting the URL to what we have in our
 * environment defined as an override.
 */
for (cloud in Jenkins.instance.clouds) {
if (cloud.class == KubernetesCloud) {
if (System.env.KUBERNETES_JENKINS_URL) {
println "Overwriting the Kubernetes Jenkisn URL to: ${System.env.KUBERNETES_JENKINS_URL}"
cloud.setJenkinsUrl(System.env.KUBERNETES_JENKINS_URL);
Jenkins.instance.save();
}
}
}
}
 

  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)  
 
 

 
   
 

  
   

[JIRA] (JENKINS-59632) Plugin does not respect the jenkinsUrl configuration from configuration-as-code

2019-10-02 Thread rty...@brokenco.de (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 R. Tyler Croy created an issue  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
 Jenkins /  JENKINS-59632  
 
 
  Plugin does not respect the jenkinsUrl configuration from configuration-as-code   
 

  
 
 
 
 

 
Issue Type: 
  Bug  
 
 
Assignee: 
 Unassigned  
 
 
Components: 
 kubernetes-plugin  
 
 
Created: 
 2019-10-02 20:02  
 
 
Environment: 
 Jenkins 2.176.3, plugin version 1.19.1  
 
 
Priority: 
  Major  
 
 
Reporter: 
 R. Tyler Croy  
 

  
 
 
 
 

 
 It appears the the "Jenkins URL" configuration in the main configuration is not properly over-writable from the configuration as code plugin. The configuration snippet below is always overwritten at runtime, it seems, with whatever the Kubernetes master Service IP turns out to be. In the case of my local testing of our Jenkins master image, which is not running in Kubernetes, after booting with the configuration below the "Jenkins URL" setting is `http://:` 

 

---
jenkins:
  clouds:
  - kubernetes:
  connectTimeout: 5
  jenkinsUrl: "https://some-external-dns-entry/"