public static @Nonnull JCloudsCloud getByName(@Nonnull String name) throws IllegalArgumentException { Cloud cloud = Jenkins.getActiveInstance().clouds.getByName(name); if (cloud instanceof JCloudsCloud) return (JCloudsCloud) cloud; throw new IllegalArgumentException("'" + name + "' is not an OpenStack cloud but " + cloud); }
/** * If there's no distributed build set up, it's pointless to provide * this axis. */ @Override public boolean isInstantiable() { Hudson h = Hudson.getInstance(); return !h.getNodes().isEmpty() || !h.clouds.isEmpty(); } }
public void run(Reactor session) throws Exception { XmlFile cfg = getConfigFile(); if (cfg.exists()) { // reset some data that may not exist in the disk file // so that we can take a proper compensation action later. primaryView = null; views.clear(); // load from disk cfg.unmarshal(Hudson.this); } // if we are loading old data that doesn't have this field if (slaves == null) { slaves = new NodeList(); } clouds.setOwner(Hudson.this); items.clear(); } });
clouds.rebuildHetero(req, json, Cloud.all(), "cloud");
clouds.rebuildHetero(req, json, Cloud.all(), "cloud");
clouds.rebuildHetero(req, json, Cloud.all(), "cloud");
clouds.rebuildHetero(req, json, Cloud.all(), "cloud");
jenkins.clouds.add(cloud); jenkins.setNumExecutors(0);
@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(); }
public void run(Reactor session) throws Exception { XmlFile cfg = getConfigFile(); if (cfg.exists()) { // reset some data that may not exist in the disk file // so that we can take a proper compensation action later. primaryView = null; views.clear(); // load from disk cfg.unmarshal(Hudson.this); } // if we are loading old data that doesn't have this field if (slaves == null) { slaves = new NodeList(); } clouds.setOwner(Hudson.this); items.clear(); } });
public void run(Reactor session) throws Exception { XmlFile cfg = getConfigFile(); if (cfg.exists()) { // reset some data that may not exist in the disk file // so that we can take a proper compensation action later. primaryView = null; views.clear(); // load from disk cfg.unmarshal(Hudson.this); } // if we are loading old data that doesn't have this field if (slaves == null) { slaves = new NodeList(); } clouds.setOwner(Hudson.this); items.clear(); } });
public void run(Reactor session) throws Exception { XmlFile cfg = getConfigFile(); if (cfg.exists()) { // reset some data that may not exist in the disk file // so that we can take a proper compensation action later. primaryView = null; views.clear(); // load from disk cfg.unmarshal(Hudson.this); } // if we are loading old data that doesn't have this field if (slaves == null) { slaves = new NodeList(); } clouds.setOwner(Hudson.this); items.clear(); } });
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); }
public static MesosCloud get() { return Hudson.getInstance().clouds.get(MesosCloud.class); }
static JCloudsCloud getByName(String name) { return (JCloudsCloud) Jenkins.getInstance().clouds.getByName(name); }
public void cleanLeakedResources() { Jenkins instance = Jenkins.getInstance(); if (instance == null) { return; } for (AzureVMCloud cloud : instance.clouds.getAll(AzureVMCloud.class)) { cleanLeakedResources(cloud, cloud.getResourceGroupName(), DeploymentRegistrar.getInstance()); } }
@Before public void configureCloud() throws Exception { cloud = new KubernetesCloud("kubernetes"); r.jenkins.clouds.add(cloud); }
/** * Gets a {@link Cloud} by {@link Cloud#name its name}, or null. */ public Cloud getCloud(String name) { return clouds.getByName(name); }
/** * Gets the first {@link OpenShiftCloud} instance configured or null */ public static OpenShiftCloud get() { return Hudson.getInstance().clouds.get(OpenShiftCloud.class); }
public void run(Reactor session) throws Exception { loadConfig(); // if we are loading old data that doesn't have this field if (slaves != null && !slaves.isEmpty() && nodes.isLegacy()) { nodes.setNodes(slaves); slaves = null; } else { nodes.load(); } clouds.setOwner(Jenkins.this); } });