From dc2ec9c57cd04e45d60c1eee35f49d92ff26489f Mon Sep 17 00:00:00 2001 From: monksy Date: Tue, 29 Aug 2023 16:31:12 -0500 Subject: [PATCH 01/18] Updated misisng command in readme --- README.md | 17 ++++-- pom.xml | 178 +++++++++++++++++++++++++++++------------------------- 2 files changed, 110 insertions(+), 85 deletions(-) diff --git a/README.md b/README.md index a118b9b..0c4206a 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,23 @@ -ssh-plugin +# ssh-plugin =========== -You can use the SSH Plugin to run shell commands on a remote machine via ssh. +## About + +This is a Jenkins plugin that allows for you to run operations with SSH. (I.e. commands, file management etc) + +## Usage Documentation and Examples More documentation available on the Jenkins wiki: https://wiki.jenkins-ci.org/display/JENKINS/SSH+Plugin -Contribute ------------- +## Building this project + +```shell +mvn install +``` + +## Contribute Fork and send a pull request (or create an issue on GitHub or in JIRA) diff --git a/pom.xml b/pom.xml index 094c31b..e00b9bf 100644 --- a/pom.xml +++ b/pom.xml @@ -1,94 +1,110 @@ - - 4.0.0 - Execute shell scripts on remote host -using ssh (pre and post build). -Based on the cool scp plugin. - - org.jenkins-ci.plugins - plugin - 1.609.3 - + + 4.0.0 + Execute shell scripts on remote host + using ssh (pre and post build). + Based on the cool scp plugin. + + + org.jenkins-ci.plugins + plugin + 4.71 + + + + 11 + 11 + 2.320 + + ssh + Jenkins SSH plugin + 2.7-SNAPSHOT + hpi + http://wiki.jenkins-ci.org/display/JENKINS/SSH+plugin - ssh - Jenkins SSH plugin - 2.7-SNAPSHOT - hpi - http://wiki.jenkins-ci.org/display/JENKINS/SSH+plugin + + + edmund_wagner + Edmund Wagner + + + ljader + Lukasz Jader + + - - - edmund_wagner - Edmund Wagner - - - ljader - Lukasz Jader - - - - - - org.jenkins-ci.plugins - jsch - 0.1.54.1 - + + + org.jenkins-ci.plugins + jsch + 0.1.55.61.va_e9ee26616e7 + org.jenkins-ci.plugins ssh-credentials - 1.12 + 277.v95c2fec1c047 - + - - - - maven-release-plugin - - deploy - - - - org.jenkins-ci.tools - maven-hpi-plugin - true - - 2.5 - - - - + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.11.0 + + 11 + + + + maven-release-plugin + + deploy + + + + org.jenkins-ci.tools + maven-hpi-plugin + 3.36 + true + + 2.5 + + + + - - - maven.jenkins-ci.org - https://repo.jenkins-ci.org/releases/ - - - maven.jenkins-ci.org - https://repo.jenkins-ci.org/snapshots/ - - + + + maven.jenkins-ci.org + https://repo.jenkins-ci.org/releases/ + + + maven.jenkins-ci.org + https://repo.jenkins-ci.org/snapshots/ + + - - - - repo.jenkins-ci.org - https://repo.jenkins-ci.org/public/ - - + + + + repo.jenkins-ci.org + https://repo.jenkins-ci.org/public/ + + - - - repo.jenkins-ci.org - https://repo.jenkins-ci.org/public/ - - + + + repo.jenkins-ci.org + https://repo.jenkins-ci.org/releases/ + + - - scm:git:git@github.com:jenkinsci/ssh-plugin.git - scm:git:git@github.com:jenkinsci/ssh-plugin.git - HEAD - + + scm:git:git@github.com:jenkinsci/ssh-plugin.git + scm:git:git@github.com:jenkinsci/ssh-plugin.git + HEAD + From 77099138b115f22de9843bdd305817c982e5c51e Mon Sep 17 00:00:00 2001 From: monksy Date: Tue, 29 Aug 2023 16:37:29 -0500 Subject: [PATCH 02/18] Server target expects jdk8.. sigh. --- pom.xml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index e00b9bf..a94d881 100644 --- a/pom.xml +++ b/pom.xml @@ -12,8 +12,6 @@ - 11 - 11 2.320 ssh @@ -53,7 +51,7 @@ maven-compiler-plugin 3.11.0 - 11 + 8 From 18b7fc355f094dcc4354a9235a28114e7f4604cb Mon Sep 17 00:00:00 2001 From: monksy Date: Tue, 29 Aug 2023 16:58:19 -0500 Subject: [PATCH 03/18] Min version 11. --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index a94d881..e8623e8 100644 --- a/pom.xml +++ b/pom.xml @@ -51,7 +51,7 @@ maven-compiler-plugin 3.11.0 - 8 + 11 From 14c05251344e3c3c02415d9bd6a539a5dca5e3dd Mon Sep 17 00:00:00 2001 From: monksy Date: Tue, 29 Aug 2023 18:49:04 -0500 Subject: [PATCH 04/18] Updating jenkins --- Jenkinsfile | 8 +++++++- pom.xml | 8 -------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index f0bdcc9..3fad3f3 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,4 +1,10 @@ #!/usr/bin/env groovy /* `buildPlugin` step provided by: https://github.com/jenkins-infra/pipeline-library */ -buildPlugin() \ No newline at end of file +buildPlugin( + useContainerAgent: true, + configurations: [ + [platform: 'linux', jdk: 11], + [platform: 'linux', jdk: 17], + [platform: 'windows', jdk: 11], + ]) \ No newline at end of file diff --git a/pom.xml b/pom.xml index e8623e8..44da6ff 100644 --- a/pom.xml +++ b/pom.xml @@ -46,14 +46,6 @@ - - org.apache.maven.plugins - maven-compiler-plugin - 3.11.0 - - 11 - - maven-release-plugin From d581b2bd1086bd2cb4e8de8cd6a4d6e4c147d17a Mon Sep 17 00:00:00 2001 From: monksy Date: Tue, 29 Aug 2023 19:00:03 -0500 Subject: [PATCH 05/18] added in comment to kick off build. --- pom.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pom.xml b/pom.xml index 44da6ff..c7678f1 100644 --- a/pom.xml +++ b/pom.xml @@ -29,6 +29,10 @@ ljader Lukasz Jader + + monksy + Steven H + From ef13654fbf3bc99bafe2b8e23afe3d3c3cd216c8 Mon Sep 17 00:00:00 2001 From: monksy Date: Thu, 31 Aug 2023 00:44:31 -0500 Subject: [PATCH 06/18] Updated the jelly files. --- src/main/resources/index.jelly | 1 + .../org/jvnet/hudson/plugins/SSHBuildWrapper/config.jelly | 1 + .../org/jvnet/hudson/plugins/SSHBuildWrapper/global.jelly | 1 + .../resources/org/jvnet/hudson/plugins/SSHBuilder/config.jelly | 1 + 4 files changed, 4 insertions(+) diff --git a/src/main/resources/index.jelly b/src/main/resources/index.jelly index 17230b5..094279d 100644 --- a/src/main/resources/index.jelly +++ b/src/main/resources/index.jelly @@ -1,3 +1,4 @@ +
This plugin executes shell commands remotely using SSH protocol.
diff --git a/src/main/resources/org/jvnet/hudson/plugins/SSHBuildWrapper/config.jelly b/src/main/resources/org/jvnet/hudson/plugins/SSHBuildWrapper/config.jelly index 2bd6b4c..4ef5a00 100644 --- a/src/main/resources/org/jvnet/hudson/plugins/SSHBuildWrapper/config.jelly +++ b/src/main/resources/org/jvnet/hudson/plugins/SSHBuildWrapper/config.jelly @@ -1,3 +1,4 @@ + diff --git a/src/main/resources/org/jvnet/hudson/plugins/SSHBuildWrapper/global.jelly b/src/main/resources/org/jvnet/hudson/plugins/SSHBuildWrapper/global.jelly index e4cdc3a..cbb7a47 100644 --- a/src/main/resources/org/jvnet/hudson/plugins/SSHBuildWrapper/global.jelly +++ b/src/main/resources/org/jvnet/hudson/plugins/SSHBuildWrapper/global.jelly @@ -1,3 +1,4 @@ + diff --git a/src/main/resources/org/jvnet/hudson/plugins/SSHBuilder/config.jelly b/src/main/resources/org/jvnet/hudson/plugins/SSHBuilder/config.jelly index 2148173..aa6a2a8 100644 --- a/src/main/resources/org/jvnet/hudson/plugins/SSHBuilder/config.jelly +++ b/src/main/resources/org/jvnet/hudson/plugins/SSHBuilder/config.jelly @@ -1,3 +1,4 @@ + From 310019cdadc8dbcf69b8a7662541cbdf766ebf34 Mon Sep 17 00:00:00 2001 From: monksy Date: Thu, 31 Aug 2023 01:17:21 -0500 Subject: [PATCH 07/18] Moved it to unsecured for the plugin tests. --- .../credentialsForSameSiteAreMerged/config.xml | 7 ++----- .../loadAllThreePossibleSiteConfigs/config.xml | 7 ++----- .../loadConfigWorksFromOlder23Version/config.xml | 7 ++----- 3 files changed, 6 insertions(+), 15 deletions(-) diff --git a/src/test/resources/org/jvnet/hudson/plugins/SSHBuildWrapperTest/credentialsForSameSiteAreMerged/config.xml b/src/test/resources/org/jvnet/hudson/plugins/SSHBuildWrapperTest/credentialsForSameSiteAreMerged/config.xml index 34cebd0..efd840b 100644 --- a/src/test/resources/org/jvnet/hudson/plugins/SSHBuildWrapperTest/credentialsForSameSiteAreMerged/config.xml +++ b/src/test/resources/org/jvnet/hudson/plugins/SSHBuildWrapperTest/credentialsForSameSiteAreMerged/config.xml @@ -1,13 +1,10 @@ - 1.609.3 + 2.320 1 NORMAL true - - hudson.model.Hudson.Read:anonymous - hudson.model.Item.Read:anonymous - + diff --git a/src/test/resources/org/jvnet/hudson/plugins/SSHBuildWrapperTest/loadAllThreePossibleSiteConfigs/config.xml b/src/test/resources/org/jvnet/hudson/plugins/SSHBuildWrapperTest/loadAllThreePossibleSiteConfigs/config.xml index 34cebd0..efd840b 100644 --- a/src/test/resources/org/jvnet/hudson/plugins/SSHBuildWrapperTest/loadAllThreePossibleSiteConfigs/config.xml +++ b/src/test/resources/org/jvnet/hudson/plugins/SSHBuildWrapperTest/loadAllThreePossibleSiteConfigs/config.xml @@ -1,13 +1,10 @@ - 1.609.3 + 2.320 1 NORMAL true - - hudson.model.Hudson.Read:anonymous - hudson.model.Item.Read:anonymous - + diff --git a/src/test/resources/org/jvnet/hudson/plugins/SSHBuildWrapperTest/loadConfigWorksFromOlder23Version/config.xml b/src/test/resources/org/jvnet/hudson/plugins/SSHBuildWrapperTest/loadConfigWorksFromOlder23Version/config.xml index 34cebd0..efd840b 100644 --- a/src/test/resources/org/jvnet/hudson/plugins/SSHBuildWrapperTest/loadConfigWorksFromOlder23Version/config.xml +++ b/src/test/resources/org/jvnet/hudson/plugins/SSHBuildWrapperTest/loadConfigWorksFromOlder23Version/config.xml @@ -1,13 +1,10 @@ - 1.609.3 + 2.320 1 NORMAL true - - hudson.model.Hudson.Read:anonymous - hudson.model.Item.Read:anonymous - + From d9be9a8344b399476b4b920f8a64bfa944e8b646 Mon Sep 17 00:00:00 2001 From: monksy Date: Thu, 31 Aug 2023 02:12:43 -0500 Subject: [PATCH 08/18] Removed author name --- pom.xml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/pom.xml b/pom.xml index c7678f1..44da6ff 100644 --- a/pom.xml +++ b/pom.xml @@ -29,10 +29,6 @@ ljader Lukasz Jader - - monksy - Steven H - From 2fc29139ef1b25039607c793c38f29f1d1480488 Mon Sep 17 00:00:00 2001 From: Mark Waite Date: Fri, 13 Oct 2023 14:40:34 -0600 Subject: [PATCH 09/18] Suppress spotbugs warning for null req parameter Javadoc for the method promises that the parameter will be non-null, even though the annnotation is Nullable for backwards compatibility. --- src/main/java/org/jvnet/hudson/plugins/SSHBuildWrapper.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/org/jvnet/hudson/plugins/SSHBuildWrapper.java b/src/main/java/org/jvnet/hudson/plugins/SSHBuildWrapper.java index ea4bd99..bd5d506 100644 --- a/src/main/java/org/jvnet/hudson/plugins/SSHBuildWrapper.java +++ b/src/main/java/org/jvnet/hudson/plugins/SSHBuildWrapper.java @@ -45,6 +45,7 @@ import com.cloudbees.plugins.credentials.CredentialsProvider; import com.cloudbees.plugins.credentials.common.StandardUsernameCredentials; import com.jcraft.jsch.JSchException; +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; public final class SSHBuildWrapper extends BuildWrapper { @@ -211,6 +212,8 @@ public String getHelpFile() { } @Override + @SuppressFBWarnings(value = "NP_PARAMETER_MUST_BE_NONNULL_BUT_MARKED_AS_NULLABLE", + justification = "Javadoc promises req is always non-null") public BuildWrapper newInstance(StaplerRequest req, JSONObject formData) { return req.bindJSON(clazz, formData); } From 0a187aeeb4dd2dc96e39275f3370b490d42b808b Mon Sep 17 00:00:00 2001 From: Mark Waite Date: Fri, 13 Oct 2023 14:41:41 -0600 Subject: [PATCH 10/18] Iterate the map with more efficient entrySet() Suppresses a spotbugs warning --- .../jvnet/hudson/plugins/VariableReplacerUtil.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/jvnet/hudson/plugins/VariableReplacerUtil.java b/src/main/java/org/jvnet/hudson/plugins/VariableReplacerUtil.java index f70a652..2dc52ef 100644 --- a/src/main/java/org/jvnet/hudson/plugins/VariableReplacerUtil.java +++ b/src/main/java/org/jvnet/hudson/plugins/VariableReplacerUtil.java @@ -19,10 +19,10 @@ public static String preludeWithEnvVars(String originalCommand, Map entry : vars.entrySet()) { //TODO handle case sensitivity for command and each variable - if (originalCommand.contains(variable) ) { - sb.append(variable).append("=\"").append(vars.get(variable)).append("\"\n"); + if (originalCommand.contains(entry.getKey()) ) { + sb.append(entry.getKey()).append("=\"").append(entry.getValue()).append("\"\n"); } } sb.append("\n"); @@ -36,9 +36,9 @@ public static String scrub(String command, Map vars, Set } vars.remove("_"); for (String sensitive : eyesOnlyVars) { - for (String variable : vars.keySet()) { - if (variable.equals(sensitive)) { - String value = vars.get(variable); + for (Map.Entry entry : vars.entrySet()) { + if (entry.getKey().equals(sensitive)) { + String value = vars.get(entry.getKey()); //TODO handle case sensitivity for command and each value if (command.contains(value)) { if (command.contains("\"" + value + "\"")) { From c274b5f4c1540818856635e533f6766c3c52e975 Mon Sep 17 00:00:00 2001 From: Mark Waite Date: Fri, 13 Oct 2023 14:42:37 -0600 Subject: [PATCH 11/18] Require Jenkins 2.361.4 and Java 11 Use the plugin bill of materials so that dependency versions are provided by the BOM rather than being separately maintained here. Use https for the SCM URL instead of ssh. --- pom.xml | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/pom.xml b/pom.xml index 44da6ff..f068626 100644 --- a/pom.xml +++ b/pom.xml @@ -8,11 +8,11 @@ org.jenkins-ci.plugins plugin - 4.71 + 4.74 - 2.320 + 2.361.4 ssh Jenkins SSH plugin @@ -35,15 +35,25 @@ org.jenkins-ci.plugins jsch - 0.1.55.61.va_e9ee26616e7 org.jenkins-ci.plugins ssh-credentials - 277.v95c2fec1c047 + + + + io.jenkins.tools.bom + bom-2.361.x + 2102.v854b_fec19c92 + import + pom + + + + @@ -55,7 +65,6 @@ org.jenkins-ci.tools maven-hpi-plugin - 3.36 true 2.5 @@ -75,8 +84,6 @@ - repo.jenkins-ci.org @@ -92,7 +99,7 @@ - scm:git:git@github.com:jenkinsci/ssh-plugin.git + scm:git:https://github.com/jenkinsci/ssh-plugin.git scm:git:git@github.com:jenkinsci/ssh-plugin.git HEAD From 99cc85be7070aded69688f8710a310ab7ca9078c Mon Sep 17 00:00:00 2001 From: Mark Waite Date: Fri, 13 Oct 2023 14:43:45 -0600 Subject: [PATCH 12/18] Test with Java 21 Java 21 was released Sep 19, 2023. We want to announce Java 21 support in October and would like the most used plugins to be compiled and tested with Java 21. The acceptance test harness and plugin bill of materials tests are already passing with Java 21. This is a further step to improve plugin readiness for use with Java 21 and for development with Java 21. The change intentionally tests only two Java configurations, Java 17 and Java 21 because I believe that the risk of a regression that only affects Java 11 is low. We generate Java 11 byte code with the Java 17 and the Java 21 builds, so Java 11 byte code is already tested. --- Jenkinsfile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 3fad3f3..a4ea544 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -4,7 +4,6 @@ buildPlugin( useContainerAgent: true, configurations: [ - [platform: 'linux', jdk: 11], - [platform: 'linux', jdk: 17], - [platform: 'windows', jdk: 11], + [platform: 'linux', jdk: 21], + [platform: 'windows', jdk: 17], ]) \ No newline at end of file From a413e6d73bf600aad9ea351d3e72e5051ed95230 Mon Sep 17 00:00:00 2001 From: Mark Waite Date: Sun, 17 Dec 2023 14:16:06 -0700 Subject: [PATCH 13/18] Use parent pom 4.76 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index f068626..6e1a637 100644 --- a/pom.xml +++ b/pom.xml @@ -8,7 +8,7 @@ org.jenkins-ci.plugins plugin - 4.74 + 4.76 From 4bd64820ca0bf9f939245b672d7d1972d25893f4 Mon Sep 17 00:00:00 2001 From: Mark Waite Date: Thu, 18 Jan 2024 11:22:04 -0700 Subject: [PATCH 14/18] Use parent pom 4.77 https://github.com/jenkinsci/plugin-pom/releases/tag/plugin-4.77 includes: * jenkins-test-harness * spotbugs-maven-plugin --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 6e1a637..c70e3ad 100644 --- a/pom.xml +++ b/pom.xml @@ -8,7 +8,7 @@ org.jenkins-ci.plugins plugin - 4.76 + 4.77 From 2410b543cfc40b57979bdf83fed8ae742784b36f Mon Sep 17 00:00:00 2001 From: Mark Waite Date: Thu, 18 Jan 2024 11:25:21 -0700 Subject: [PATCH 15/18] Add end of line --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index a4ea544..453a79f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -6,4 +6,4 @@ buildPlugin( configurations: [ [platform: 'linux', jdk: 21], [platform: 'windows', jdk: 17], - ]) \ No newline at end of file + ]) From 0bcba1ca8652b99d0038e23a9d8b97ba5a47c5f8 Mon Sep 17 00:00:00 2001 From: Mark Waite Date: Thu, 15 Aug 2024 06:22:09 -0600 Subject: [PATCH 16/18] Remove trailing spaces --- README.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 0c4206a..eb384ff 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ # ssh-plugin -=========== -## About +## About This is a Jenkins plugin that allows for you to run operations with SSH. (I.e. commands, file management etc) @@ -14,10 +13,9 @@ https://wiki.jenkins-ci.org/display/JENKINS/SSH+Plugin ## Building this project ```shell -mvn install +mvn install ``` ## Contribute Fork and send a pull request (or create an issue on GitHub or in JIRA) - From 8f834ac7f290c97f56e6e7f7d7f2acb88ac124cc Mon Sep 17 00:00:00 2001 From: Mark Waite Date: Thu, 15 Aug 2024 06:32:06 -0600 Subject: [PATCH 17/18] Use most recent parent pom --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index c70e3ad..8948745 100644 --- a/pom.xml +++ b/pom.xml @@ -8,7 +8,7 @@ org.jenkins-ci.plugins plugin - 4.77 + 4.86 From f3011990f5786bbf35a64ec0437efb18014d927c Mon Sep 17 00:00:00 2001 From: Mark Waite Date: Thu, 15 Aug 2024 06:32:15 -0600 Subject: [PATCH 18/18] Require Jenkins 2.426.3 or newer https://www.jenkins.io/doc/developer/plugin-development/choosing-jenkins-baseline/ says: > Do not use versions no longer supported by the update center Jenkins 2.361.4 is not supported by the update center. https://stats.jenkins.io/pluginversions/ssh.html shows that users of the plugin are not upgrading Jenkins core, even if they are using the most recent release of the plugin. Only 53% of the current installations are on 2.361.4 or newer. --- pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 8948745..c1a4d9c 100644 --- a/pom.xml +++ b/pom.xml @@ -12,7 +12,7 @@ - 2.361.4 + 2.426.3 ssh Jenkins SSH plugin @@ -46,8 +46,8 @@ io.jenkins.tools.bom - bom-2.361.x - 2102.v854b_fec19c92 + bom-2.426.x + 3208.vb_21177d4b_cd9 import pom