diff --git a/README.md b/README.md index 31e5017..865a40b 100644 --- a/README.md +++ b/README.md @@ -38,4 +38,4 @@ When you want the slaves to be dynamically provisioned based on a template, choo To add a node, go to `Manage Jenkins` > `Manage Nodes` > `New Node` and choose `Slave virtual computer running on scripted cloud`. You can configure which scripted cloud to use in the next screen of the wizard. -**Attention:** When `reusable` is turned of, this node will be deleted after the next usage. \ No newline at end of file +**Attention:** When `reusable` is turned off, this node will be deleted after the next usage. diff --git a/pom.xml b/pom.xml index be08e75..bff7761 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,8 @@ org.jenkins-ci.plugins plugin - 3.2 + 4.16 + scripted-cloud-plugin @@ -43,19 +44,43 @@ UTF-8 3.0 1.19 + 2.249.1 + + + org.slf4j + slf4j-api + 1.7.26 + + + org.slf4j + jcl-over-slf4j + 1.7.26 + + + org.slf4j + log4j-over-slf4j + 1.7.26 + + + org.slf4j + slf4j-jdk14 + 1.7.26 + + + repo.jenkins-ci.org - http://repo.jenkins-ci.org/public/ + https://repo.jenkins-ci.org/public/ repo.jenkins-ci.org - http://repo.jenkins-ci.org/public/ + https://repo.jenkins-ci.org/public/ diff --git a/src/main/java/org/jenkinsci/plugins/scripted_cloud/ScriptedCloud.java b/src/main/java/org/jenkinsci/plugins/scripted_cloud/ScriptedCloud.java index 2dae591..488a455 100644 --- a/src/main/java/org/jenkinsci/plugins/scripted_cloud/ScriptedCloud.java +++ b/src/main/java/org/jenkinsci/plugins/scripted_cloud/ScriptedCloud.java @@ -82,7 +82,7 @@ public synchronized Collection provision(Label labe final List templates = getMatchingTemplates(label); for (ScriptedCloudSlaveTemplate t : templates) { - LOGGER.log(Level.INFO, "Template: " + t.getDescription()); + LOGGER.log(Level.INFO, String.format("Template: %s", t.getDescription())); boolean canProvision = true; @@ -123,7 +123,7 @@ private boolean canProvisionSlaveTemplate(@Nonnull ScriptedCloudSlaveTemplate te } private int getTemplateInstancesCount(@Nonnull ScriptedCloudSlaveTemplate template) { - Computer[] computers = Jenkins.getInstance().getComputers(); + Computer[] computers = Jenkins.get().getComputers(); int count = 0; for (Computer computer : computers){ @@ -138,7 +138,7 @@ private int getTemplateInstancesCount(@Nonnull ScriptedCloudSlaveTemplate templa } private int getInstancesCount() { - Computer[] computers = Jenkins.getInstance().getComputers(); + Computer[] computers = Jenkins.get().getComputers(); int count = 0; for (Computer computer : computers){ @@ -188,7 +188,7 @@ public Node call() throws Exception { template.getSecToWaitOnline(), template.getReusable()); - Jenkins.getInstance().addNode(slave); + Jenkins.get().addNode(slave); LOGGER.log(Level.INFO, String.format("Asking ScriptedCloud %s to schedule new Jenkins slave %s", name, slaveName)); @@ -284,11 +284,11 @@ private void executeCommand(String command, String name, List envVars.put(ev.getKey(), ev.getValue())); envVars.put("SLAVE_NAME", name); - envVars.put("JENKINS_URL", Jenkins.getInstance().getRootUrl()); + envVars.put("JENKINS_URL", Jenkins.get().getRootUrl()); // Support for Jenkins security - if (Jenkins.getInstance().isUseSecurity()) { - envVars.put("JNLP_SECRET", jenkins.slaves.JnlpSlaveAgentProtocol.SLAVE_SECRET.mac(name)); + if (Jenkins.get().isUseSecurity()) { + envVars.put("JNLP_SECRET", jenkins.slaves.JnlpAgentReceiver.SLAVE_SECRET.mac(name)); } @@ -311,7 +311,7 @@ private void executeCommand(String command, String name, List> nodeProperties, String cloudName, List envVars, String secToWaitOnline, Boolean reusable) throws FormException, IOException { - super(name, nodeDescription, remoteFS, numExecutors, mode, labelString, - new ScriptedCloudLauncher(delegateLauncher, Util.tryParseNumber(secToWaitOnline, 10 * 60).intValue()) - , retentionStrategy, nodeProperties); + super(name, remoteFS, new ScriptedCloudLauncher(delegateLauncher, Util.tryParseNumber(secToWaitOnline, 10 * 60).intValue()) ); this.cloudName = cloudName; this.reusable = reusable; @@ -82,7 +80,7 @@ public String getCloudName() { } public Cloud getCloud() { - return Jenkins.getInstance().getCloud(getCloudName()); + return Jenkins.get().getCloud(getCloudName()); } public String getSecToWaitOnline() { @@ -101,7 +99,7 @@ public int getSecToWaitOnlineInt(){ */ @Nonnull public ScriptedCloud getScriptedCloud() { - Cloud cloud = Jenkins.getInstance().getCloud(getCloudName()); + Cloud cloud = Jenkins.get().getCloud(getCloudName()); if (cloud instanceof ScriptedCloud) { return (ScriptedCloud) cloud; } else { @@ -248,7 +246,7 @@ public boolean configure(StaplerRequest req, JSONObject o) public List getScriptedClouds() { List result = new ArrayList(); - for (Cloud cloud : Jenkins.getInstance().clouds) { + for (Cloud cloud : Jenkins.get().clouds) { if (cloud instanceof ScriptedCloud) { result.add((ScriptedCloud) cloud); } diff --git a/src/main/resources/org/jenkinsci/plugins/scripted_cloud/ScriptedCloud/config.jelly b/src/main/resources/org/jenkinsci/plugins/scripted_cloud/ScriptedCloud/config.jelly index c721d86..d9f4acb 100644 --- a/src/main/resources/org/jenkinsci/plugins/scripted_cloud/ScriptedCloud/config.jelly +++ b/src/main/resources/org/jenkinsci/plugins/scripted_cloud/ScriptedCloud/config.jelly @@ -10,11 +10,11 @@ - + - + diff --git a/src/main/resources/org/jenkinsci/plugins/scripted_cloud/ScriptedCloudSlave/configure-entries.jelly b/src/main/resources/org/jenkinsci/plugins/scripted_cloud/ScriptedCloudSlave/configure-entries.jelly index 926b3d3..557b6b4 100644 --- a/src/main/resources/org/jenkinsci/plugins/scripted_cloud/ScriptedCloudSlave/configure-entries.jelly +++ b/src/main/resources/org/jenkinsci/plugins/scripted_cloud/ScriptedCloudSlave/configure-entries.jelly @@ -31,6 +31,10 @@ + + + + @@ -53,11 +57,7 @@ description="${%Can this slave be used for multiple builds?}" field="reusable"> - - - - - + @@ -75,11 +75,7 @@ description="${%Can this slave be used for multiple builds?}" field="reusable"> - - - - - + diff --git a/src/main/resources/org/jenkinsci/plugins/scripted_cloud/ScriptedCloudSlaveTemplate/config.jelly b/src/main/resources/org/jenkinsci/plugins/scripted_cloud/ScriptedCloudSlaveTemplate/config.jelly index d93b4ea..3a8b17c 100644 --- a/src/main/resources/org/jenkinsci/plugins/scripted_cloud/ScriptedCloudSlaveTemplate/config.jelly +++ b/src/main/resources/org/jenkinsci/plugins/scripted_cloud/ScriptedCloudSlaveTemplate/config.jelly @@ -20,6 +20,8 @@ + + @@ -31,11 +33,6 @@ - - - - - @@ -44,12 +41,14 @@ - - + + + + + -