private void useRootUrl(Map<String, String> errors, @CheckForNull String rootUrl){ LOGGER.log(Level.FINE, "Root URL set during SetupWizard to {0}", new Object[]{ rootUrl }); JenkinsLocationConfiguration.getOrDie().setUrl(rootUrl); }
JenkinsLocationConfiguration.get().setUrl(getURL().toString());
JenkinsLocationConfiguration.get().setUrl(getURL().toString());
JenkinsLocationConfiguration.get().setUrl(getURL().toString());
public void configureCloud() throws Exception { cloud = setupCloud(this); createSecret(cloud.connect()); cloud.getTemplates().clear(); cloud.addTemplate(buildBusyboxTemplate("busybox")); // Agents running in Kubernetes (minikube) need to connect to this server, so localhost does not work URL url = story.j.getURL(); String hostAddress = System.getProperty("jenkins.host.address"); if (hostAddress == null) { hostAddress = InetAddress.getLocalHost().getHostAddress(); } URL nonLocalhostUrl = new URL(url.getProtocol(), hostAddress, url.getPort(), url.getFile()); JenkinsLocationConfiguration.get().setUrl(nonLocalhostUrl.toString()); story.j.jenkins.clouds.add(cloud); }
private void updateRootURLConfig() { if (Jenkins.getInstance().getRootUrl() != null && JenkinsLocationConfiguration.get().getUrl() == null) { JenkinsLocationConfiguration.get().setUrl( Jenkins.getInstance().getRootUrl()); } }
@Test public void getJenkinsUrlOrDie_UrlInLocation() { JenkinsLocationConfiguration.get().setUrl("http://mylocation"); KubernetesCloud cloud = new KubernetesCloud("name"); assertEquals("http://mylocation/", cloud.getJenkinsUrlOrDie()); }
jenkins.servletContext.setAttribute("version","?"); WebAppMain.installExpressionFactory(new ServletContextEvent(jenkins.servletContext)); JenkinsLocationConfiguration.get().setUrl(getURL().toString());
@Test(expected = IllegalStateException.class) public void getJenkinsUrlOrDie_NoJenkinsUrl() { JenkinsLocationConfiguration.get().setUrl(null); KubernetesCloud cloud = new KubernetesCloud("name"); String url = cloud.getJenkinsUrlOrDie(); fail("Should have thrown IllegalStateException at this point but got " + url + " instead."); }
@Before public void configureCloud() throws Exception { cloud = setupCloud(this); createSecret(cloud.connect()); cloud.getTemplates().clear(); cloud.addTemplate(buildBusyboxTemplate("busybox")); // Agents running in Kubernetes (minikube) need to connect to this server, so localhost does not work URL url = r.getURL(); String hostAddress = System.getProperty("jenkins.host.address"); if (hostAddress == null) { hostAddress = InetAddress.getLocalHost().getHostAddress(); } URL nonLocalhostUrl = new URL(url.getProtocol(), hostAddress, url.getPort(), url.getFile()); JenkinsLocationConfiguration.get().setUrl(nonLocalhostUrl.toString()); r.jenkins.clouds.add(cloud); DescribableList<NodeProperty<?>, NodePropertyDescriptor> list = r.jenkins.getGlobalNodeProperties(); EnvironmentVariablesNodeProperty newEnvVarsNodeProperty = new hudson.slaves.EnvironmentVariablesNodeProperty(); list.add(newEnvVarsNodeProperty); EnvVars envVars = newEnvVarsNodeProperty.getEnvVars(); envVars.put("GLOBAL", "GLOBAL"); envVars.put("JAVA_HOME_X", "java-home-x"); r.jenkins.save(); }