From d158f47b0712935585260204a482e08e40851c12 Mon Sep 17 00:00:00 2001 From: Daniel Beck Date: Tue, 8 Oct 2019 18:44:50 +0200 Subject: [PATCH 01/12] Use HTTPS URLs in pom.xml --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index ca485a6..2c79178 100644 --- a/pom.xml +++ b/pom.xml @@ -42,7 +42,7 @@ repo.jenkins-ci.org - http://repo.jenkins-ci.org/public/ + https://repo.jenkins-ci.org/public/ @@ -73,7 +73,7 @@ repo.jenkins-ci.org - http://repo.jenkins-ci.org/public/ + https://repo.jenkins-ci.org/public/ From 0a5386b10c6eeddad546002c91668db2c7ae162b Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Wed, 13 Jan 2021 16:09:36 -0700 Subject: [PATCH 02/12] Fix typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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. From e8abb7f96d3e873b2e422c4e731c47c1242a2c07 Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Fri, 15 Jan 2021 08:51:13 -0700 Subject: [PATCH 03/12] Update minimum versions to something a bit more recent --- pom.xml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index caae01e..cc5de2d 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,8 @@ org.jenkins-ci.plugins plugin - 3.2 + 4.16 + scripted-cloud-plugin @@ -43,6 +44,7 @@ UTF-8 3.0 1.19 + 2.249.1 From cb82a53b7cf816cb3d8af86cdab6e2aa59a7c8e8 Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Fri, 15 Jan 2021 08:51:41 -0700 Subject: [PATCH 04/12] Fix dependecy issues with slf4j being too low --- pom.xml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/pom.xml b/pom.xml index cc5de2d..bff7761 100644 --- a/pom.xml +++ b/pom.xml @@ -47,6 +47,29 @@ 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 From e39f2c27623179a4d4597ec8f6b562fc61a0183b Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Fri, 15 Jan 2021 11:07:18 -0700 Subject: [PATCH 05/12] Add missing numExecutors text box --- .../scripted_cloud/ScriptedCloudSlave/configure-entries.jelly | 4 ++++ 1 file changed, 4 insertions(+) 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..2ae1063 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 @@ + + + + From 94bc8e5918ff9a332859566bd2dedc1c3db9ba96 Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Tue, 19 Jan 2021 15:12:35 -0700 Subject: [PATCH 06/12] Use a textarea instead so that the required tag shows up Related to: https://issues.jenkins.io/browse/JENKINS-26407 --- .../plugins/scripted_cloud/ScriptedCloud/config.jelly | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 @@ - + - + From 3ddd322f516a1f473124884c3d7095e9f02a447b Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Tue, 19 Jan 2021 15:17:49 -0700 Subject: [PATCH 07/12] Use invisibleEntry instead of tables Found in https://github.com/jenkinsci/copyartifact-plugin/pull/134/ --- .../ScriptedCloudSlave/configure-entries.jelly | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) 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 2ae1063..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 @@ -57,11 +57,7 @@ description="${%Can this slave be used for multiple builds?}" field="reusable"> - - - - - + @@ -79,11 +75,7 @@ description="${%Can this slave be used for multiple builds?}" field="reusable"> - - - - - + From 30be137be579f02c7eae83462d6d3b0edb58a2e1 Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Tue, 9 Feb 2021 14:30:51 -0700 Subject: [PATCH 08/12] Fix warnings for deprecated methods --- .../plugins/scripted_cloud/ScriptedCloud.java | 12 ++++++------ .../plugins/scripted_cloud/ScriptedCloudSlave.java | 10 ++++------ 2 files changed, 10 insertions(+), 12 deletions(-) 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..fa9c562 100644 --- a/src/main/java/org/jenkinsci/plugins/scripted_cloud/ScriptedCloud.java +++ b/src/main/java/org/jenkinsci/plugins/scripted_cloud/ScriptedCloud.java @@ -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)); } diff --git a/src/main/java/org/jenkinsci/plugins/scripted_cloud/ScriptedCloudSlave.java b/src/main/java/org/jenkinsci/plugins/scripted_cloud/ScriptedCloudSlave.java index c5c13fb..7905790 100644 --- a/src/main/java/org/jenkinsci/plugins/scripted_cloud/ScriptedCloudSlave.java +++ b/src/main/java/org/jenkinsci/plugins/scripted_cloud/ScriptedCloudSlave.java @@ -54,9 +54,7 @@ public ScriptedCloudSlave(String name, String nodeDescription, 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); } From 6835cc57fe34260c5f717a9dee5b08e092cdb9b8 Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Tue, 9 Feb 2021 14:47:35 -0700 Subject: [PATCH 09/12] Move Usage up so that it matches the Jenkins Permanent Agent ordering --- .../scripted_cloud/ScriptedCloudSlaveTemplate/config.jelly | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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..8a517b7 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 @@ + + @@ -49,7 +51,6 @@ - From 079acf1cbf3d1134c5a03d643c6087591294cfed Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Tue, 9 Feb 2021 15:02:03 -0700 Subject: [PATCH 10/12] Move Reusable checkbox down to match the static agent under scripted cloud --- .../ScriptedCloudSlaveTemplate/config.jelly | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) 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 8a517b7..be975da 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 @@ -33,11 +33,6 @@ - - - - - @@ -50,6 +45,9 @@ + + + From 4f795647bf40d8f2f75c266fd1f3ce0ed24137a8 Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Tue, 9 Feb 2021 15:03:39 -0700 Subject: [PATCH 11/12] Fix the title for preprovisioned instances and change the default to zero --- .../scripted_cloud/ScriptedCloudSlaveTemplate/config.jelly | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 be975da..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 @@ -41,8 +41,8 @@ - - + + From 493b478ea18452032d75b004fa9b3ee264a25b92 Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Tue, 9 Feb 2021 15:20:19 -0700 Subject: [PATCH 12/12] Update log() to use String.format() --- .../org/jenkinsci/plugins/scripted_cloud/ScriptedCloud.java | 4 ++-- .../plugins/scripted_cloud/ScriptedCloudLauncher.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) 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 fa9c562..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; @@ -311,7 +311,7 @@ private void executeCommand(String command, String name, List