diff --git a/.github/dependabot.yml b/.github/dependabot.yml
index 04ceb6e8..b7814523 100644
--- a/.github/dependabot.yml
+++ b/.github/dependabot.yml
@@ -3,4 +3,8 @@ updates:
- package-ecosystem: "maven"
directory: "/"
schedule:
- interval: "weekly"
+ interval: "daily"
+ - package-ecosystem: "github-actions"
+ directory: /
+ schedule:
+ interval: "daily"
\ No newline at end of file
diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml
index 10fb79a1..bbef3509 100644
--- a/.github/release-drafter.yml
+++ b/.github/release-drafter.yml
@@ -1,6 +1,4 @@
# https://github.com/jenkinsci/.github/blob/master/.github/release-drafter.adoc
+# https://www.jenkins.io/doc/developer/publishing/releasing-cd/#release-notes
_extends: .github
-# Semantic versioning is used d=for this plugin: https://semver.org/
-version-template: $MAJOR.$MINOR.$PATCH
-tag-template: ssh-slaves-$NEXT_PATCH_VERSION
-name-template: $NEXT_PATCH_VERSION
+
diff --git a/.github/workflows/cd.yaml b/.github/workflows/cd.yaml
new file mode 100644
index 00000000..feb707ce
--- /dev/null
+++ b/.github/workflows/cd.yaml
@@ -0,0 +1,59 @@
+# Note: additional setup is required, see https://www.jenkins.io/redirect/continuous-delivery-of-plugins
+
+name: cd
+on:
+ workflow_dispatch:
+ check_run:
+ types:
+ - completed
+
+jobs:
+ validate:
+ runs-on: ubuntu-latest
+ outputs:
+ should_release: ${{ steps.verify-ci-status.outputs.result == 'success' && steps.interesting-categories.outputs.interesting == 'true' }}
+ steps:
+ - name: Verify CI status
+ uses: jenkins-infra/verify-ci-status-action@v1.2.0
+ id: verify-ci-status
+ with:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ output_result: true
+
+ - name: Release Drafter
+ uses: release-drafter/release-drafter@v5
+ if: steps.verify-ci-status.outputs.result == 'success'
+ with:
+ name: next
+ tag: next
+ version: next
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+
+ - name: Check interesting categories
+ uses: jenkins-infra/interesting-category-action@v1.0.0
+ id: interesting-categories
+ if: steps.verify-ci-status.outputs.result == 'success'
+ with:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+
+ release:
+ runs-on: ubuntu-latest
+ needs: [validate]
+ if: needs.validate.outputs.should_release == 'true'
+ steps:
+ - name: Check out
+ uses: actions/checkout@v3
+ with:
+ fetch-depth: 0
+ - name: Set up JDK 8
+ uses: actions/setup-java@v3
+ with:
+ distribution: 'adopt'
+ java-version: 8
+ - name: Release
+ uses: jenkins-infra/jenkins-maven-cd-action@v1.2.0
+ with:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
+ MAVEN_TOKEN: ${{ secrets.MAVEN_TOKEN }}
\ No newline at end of file
diff --git a/.github/workflows/jenkins-security-scan.yml b/.github/workflows/jenkins-security-scan.yml
new file mode 100644
index 00000000..17136b16
--- /dev/null
+++ b/.github/workflows/jenkins-security-scan.yml
@@ -0,0 +1,16 @@
+name: Jenkins Security Scan
+on:
+ push:
+ branches:
+ - main
+# see https://github.com/jenkins-infra/jenkins-security-scan/issues/3
+# pull_request:
+# types: [ opened, synchronize, reopened ]
+ workflow_dispatch:
+
+jobs:
+ security-scan:
+ uses: jenkins-infra/jenkins-security-scan/.github/workflows/jenkins-security-scan.yaml@v1
+ with:
+ java-cache: '' # Optionally enable use of a build dependency cache. Specify 'maven' or 'gradle' as appropriate.
+ java-version: 11 # What version of Java to set up for the build.
diff --git a/.mvn/extensions.xml b/.mvn/extensions.xml
index 43d62816..a65d82e1 100644
--- a/.mvn/extensions.xml
+++ b/.mvn/extensions.xml
@@ -2,6 +2,6 @@
io.jenkins.tools.incrementals
git-changelist-maven-extension
- 1.2
+ 1.3
diff --git a/.mvn/maven.config b/.mvn/maven.config
index 2a0299c4..f7daf60d 100644
--- a/.mvn/maven.config
+++ b/.mvn/maven.config
@@ -1,2 +1,3 @@
-Pconsume-incrementals
-Pmight-produce-incrementals
+-Dchangelist.format=%d.v%s
diff --git a/pom.xml b/pom.xml
index 580b2177..9cc94948 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,11 +5,11 @@
org.jenkins-ci.plugins
plugin
- 4.31
+ 4.40
ssh-slaves
- ${revision}${changelist}
+ ${revision}.${changelist}
hpi
SSH Build Agents plugin
@@ -25,9 +25,9 @@
- 1.33.1
- -SNAPSHOT
- 2.289.1
+ 1
+ 999999-SNAPSHOT
+ 2.319.1
8
1.31.0
@@ -102,8 +102,8 @@
io.jenkins.tools.bom
- bom-2.277.x
- 961.vf0c9f6f59827
+ bom-2.319.x
+ 1246.va_b_50630c1d19
pom
import
@@ -111,10 +111,6 @@
org.jenkins-ci.plugins
jackson2-api
-
- org.slf4j
- slf4j-api
-
@@ -134,7 +130,7 @@
org.jenkins-ci.modules
sshd
- 3.1.0
+ 3.228.v4c9f9e652c86
test
@@ -162,7 +158,7 @@
org.testcontainers
testcontainers
- 1.16.2
+ 1.16.3
test
diff --git a/src/main/java/hudson/plugins/sshslaves/SSHLauncher.java b/src/main/java/hudson/plugins/sshslaves/SSHLauncher.java
index 44664078..7e781f74 100644
--- a/src/main/java/hudson/plugins/sshslaves/SSHLauncher.java
+++ b/src/main/java/hudson/plugins/sshslaves/SSHLauncher.java
@@ -419,60 +419,58 @@ public void launch(final SlaveComputer computer, final TaskListener listener) th
launcherExecutorService = Executors.newSingleThreadExecutor(
new NamingThreadFactory(Executors.defaultThreadFactory(), "SSHLauncher.launch for '" + computer.getName() + "' node"));
Set> callables = new HashSet<>();
- callables.add(new Callable() {
- public Boolean call() throws InterruptedException {
- Boolean rval = Boolean.FALSE;
- try {
- String[] preferredKeyAlgorithms = getSshHostKeyVerificationStrategyDefaulted().getPreferredKeyAlgorithms(computer);
- if (preferredKeyAlgorithms != null && preferredKeyAlgorithms.length > 0) { // JENKINS-44832
- connection.setServerHostKeyAlgorithms(preferredKeyAlgorithms);
- } else {
- listener.getLogger().println("Warning: no key algorithms provided; JENKINS-42959 disabled");
- }
-
- listener.getLogger().println(logConfiguration());
-
- openConnection(listener, computer);
-
- verifyNoHeaderJunk(listener);
- reportEnvironment(listener);
-
- final String workingDirectory = getWorkingDirectory(computer);
- if (workingDirectory == null) {
- listener.error("Cannot get the working directory for " + computer);
- return Boolean.FALSE;
- }
-
- String java = null;
- if (StringUtils.isNotBlank(javaPath)) {
- java = expandExpression(computer, javaPath);
- } else {
- checkJavaIsInPath(listener);
- //FIXME deprecated on 2020-12-10, it will removed after 2021-09-01
- JavaVersionChecker javaVersionChecker = new JavaVersionChecker(computer, listener, getJvmOptions(),
- connection);
- java = javaVersionChecker.resolveJava();
- }
-
- copyAgentJar(listener, workingDirectory);
-
- startAgent(computer, listener, java, workingDirectory);
-
- PluginImpl.register(connection);
- rval = Boolean.TRUE;
- } catch (RuntimeException|Error e) {
- String msg = Messages.SSHLauncher_UnexpectedError();
- if(StringUtils.isNotBlank(e.getMessage())){
- msg = e.getMessage();
- }
- e.printStackTrace(listener.error(msg));
- } catch (AbortException e) {
- listener.getLogger().println(e.getMessage());
- } catch (IOException e) {
- e.printStackTrace(listener.getLogger());
- } finally {
- return rval;
+ callables.add(() -> {
+ Boolean rval = Boolean.FALSE;
+ try {
+ String[] preferredKeyAlgorithms = getSshHostKeyVerificationStrategyDefaulted().getPreferredKeyAlgorithms(computer);
+ if (preferredKeyAlgorithms != null && preferredKeyAlgorithms.length > 0) { // JENKINS-44832
+ connection.setServerHostKeyAlgorithms(preferredKeyAlgorithms);
+ } else {
+ listener.getLogger().println("Warning: no key algorithms provided; JENKINS-42959 disabled");
+ }
+
+ listener.getLogger().println(logConfiguration());
+
+ openConnection(listener, computer);
+
+ verifyNoHeaderJunk(listener);
+ reportEnvironment(listener);
+
+ final String workingDirectory = getWorkingDirectory(computer);
+ if (workingDirectory == null) {
+ listener.error("Cannot get the working directory for " + computer);
+ return Boolean.FALSE;
+ }
+
+ String java = null;
+ if (StringUtils.isNotBlank(javaPath)) {
+ java = expandExpression(computer, javaPath);
+ } else {
+ checkJavaIsInPath(listener);
+ //FIXME deprecated on 2020-12-10, it will removed after 2021-09-01
+ JavaVersionChecker javaVersionChecker = new JavaVersionChecker(computer, listener, getJvmOptions(),
+ connection);
+ java = javaVersionChecker.resolveJava();
+ }
+
+ copyAgentJar(listener, workingDirectory);
+
+ startAgent(computer, listener, java, workingDirectory);
+
+ PluginImpl.register(connection);
+ rval = Boolean.TRUE;
+ } catch (RuntimeException|Error e) {
+ String msg = Messages.SSHLauncher_UnexpectedError();
+ if(StringUtils.isNotBlank(e.getMessage())){
+ msg = e.getMessage();
}
+ e.printStackTrace(listener.error(msg));
+ } catch (AbortException e) {
+ listener.getLogger().println(e.getMessage());
+ } catch (IOException e) {
+ e.printStackTrace(listener.getLogger());
+ } finally {
+ return rval;
}
});
diff --git a/src/main/java/hudson/plugins/sshslaves/verifiers/MissingVerificationStrategyAdministrativeMonitor.java b/src/main/java/hudson/plugins/sshslaves/verifiers/MissingVerificationStrategyAdministrativeMonitor.java
index 62994a60..4235400f 100644
--- a/src/main/java/hudson/plugins/sshslaves/verifiers/MissingVerificationStrategyAdministrativeMonitor.java
+++ b/src/main/java/hudson/plugins/sshslaves/verifiers/MissingVerificationStrategyAdministrativeMonitor.java
@@ -65,6 +65,11 @@ public String getDisplayName() {
}
public String getAgentNames() {
- return agentNames != null ? agentNames.toString() : "";
+ return agentNames != null ? agentNames.toString() : "";
+ }
+
+ @Override
+ public boolean isSecurity() {
+ return true;
}
}
diff --git a/src/test/java/hudson/plugins/sshslaves/SSHLauncherTest.java b/src/test/java/hudson/plugins/sshslaves/SSHLauncherTest.java
index 3d27c7c9..f0b69b31 100644
--- a/src/test/java/hudson/plugins/sshslaves/SSHLauncherTest.java
+++ b/src/test/java/hudson/plugins/sshslaves/SSHLauncherTest.java
@@ -76,6 +76,7 @@
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNotSame;
+import static org.junit.Assert.assertThrows;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
@@ -154,12 +155,7 @@ private static boolean checkSupported(final String testVersionOutput) throws IOE
}
private static void assertNotSupported(final String testVersionOutput) throws AssertionError {
- try {
- checkSupported(testVersionOutput);
- fail("Expected version " + testVersionOutput + " to be not supported, but it is supported");
- } catch (IOException e) {
- // expected
- }
+ assertThrows(IOException.class, () -> checkSupported(testVersionOutput));
}
private void checkRoundTrip(String host) throws Exception {
@@ -400,7 +396,7 @@ public void getMd5Hash() {
try {
byte[] bytes = "Leave me alone!".getBytes();
String result = SSHLauncher.getMd5Hash(bytes);
- assertTrue("1EB226C8E950BAC1494BE197E84A264C".equals(result));
+ assertEquals("1EB226C8E950BAC1494BE197E84A264C", result);
} catch (Exception e) {
e.printStackTrace();
}
@@ -420,7 +416,7 @@ public void readInputStreamIntoByteArrayAndClose() {
byte[] bytes = SSHLauncher.readInputStreamIntoByteArrayAndClose(inputStream);
assertNotNull(bytes);
assertTrue(bytes.length > 0);
- assertTrue("Don't change me or add newlines!".equals(new String(bytes)));
+ assertEquals("Don't change me or add newlines!", new String(bytes));
} catch (Exception e) {
e.printStackTrace();
diff --git a/src/test/java/hudson/plugins/sshslaves/agents/AgentDSAConnectionTest.java b/src/test/java/hudson/plugins/sshslaves/agents/AgentDSAConnectionTest.java
index e9184ac7..ff7de11f 100644
--- a/src/test/java/hudson/plugins/sshslaves/agents/AgentDSAConnectionTest.java
+++ b/src/test/java/hudson/plugins/sshslaves/agents/AgentDSAConnectionTest.java
@@ -11,12 +11,14 @@
import hudson.plugins.sshslaves.categories.AgentSSHTest;
import hudson.plugins.sshslaves.categories.SSHKeyAuthenticationTest;
import static org.junit.Assert.assertTrue;
+import org.junit.Ignore;
/**
* Connect to a remote SSH Agent
*
* @author Kuisathaverat
*/
+@Ignore("Only for manual test.")
@Category({ AgentSSHTest.class, SSHKeyAuthenticationTest.class})
public class AgentDSAConnectionTest extends AgentConnectionBase {
public static final String SSH_AGENT_NAME = "ssh-agent-dsa";
diff --git a/src/test/java/hudson/plugins/sshslaves/agents/AgentECDHSha2Nistp256ConnectionTest.java b/src/test/java/hudson/plugins/sshslaves/agents/AgentECDHSha2Nistp256ConnectionTest.java
index b491c093..37a2b09a 100644
--- a/src/test/java/hudson/plugins/sshslaves/agents/AgentECDHSha2Nistp256ConnectionTest.java
+++ b/src/test/java/hudson/plugins/sshslaves/agents/AgentECDHSha2Nistp256ConnectionTest.java
@@ -11,12 +11,14 @@
import hudson.plugins.sshslaves.categories.AgentSSHTest;
import hudson.plugins.sshslaves.categories.SSHKexTest;
import static org.junit.Assert.assertTrue;
+import org.junit.Ignore;
/**
* Connect to a remote SSH Agent
*
* @author Kuisathaverat
*/
+@Ignore("Only for manual test.")
@Category({ AgentSSHTest.class, SSHKexTest.class})
public class AgentECDHSha2Nistp256ConnectionTest extends AgentConnectionBase {
public static final String SSH_AGENT_NAME = "ssh-agent-ecdh-sha2-nistp256";
diff --git a/src/test/java/hudson/plugins/sshslaves/agents/AgentECDHSha2Nistp384ConnectionTest.java b/src/test/java/hudson/plugins/sshslaves/agents/AgentECDHSha2Nistp384ConnectionTest.java
index 59666c22..b6a475af 100644
--- a/src/test/java/hudson/plugins/sshslaves/agents/AgentECDHSha2Nistp384ConnectionTest.java
+++ b/src/test/java/hudson/plugins/sshslaves/agents/AgentECDHSha2Nistp384ConnectionTest.java
@@ -11,12 +11,14 @@
import hudson.plugins.sshslaves.categories.AgentSSHTest;
import hudson.plugins.sshslaves.categories.SSHKexTest;
import static org.junit.Assert.assertTrue;
+import org.junit.Ignore;
/**
* Connect to a remote SSH Agent
*
* @author Kuisathaverat
*/
+@Ignore("Only for manual test.")
@Category({ AgentSSHTest.class, SSHKexTest.class})
public class AgentECDHSha2Nistp384ConnectionTest extends AgentConnectionBase {
public static final String SSH_AGENT_NAME = "ssh-agent-ecdh-sha2-nistp384";
diff --git a/src/test/java/hudson/plugins/sshslaves/agents/AgentRSA256ConnectionTest.java b/src/test/java/hudson/plugins/sshslaves/agents/AgentRSA256ConnectionTest.java
index ed66f2a7..5bfa655e 100644
--- a/src/test/java/hudson/plugins/sshslaves/agents/AgentRSA256ConnectionTest.java
+++ b/src/test/java/hudson/plugins/sshslaves/agents/AgentRSA256ConnectionTest.java
@@ -11,12 +11,14 @@
import hudson.plugins.sshslaves.categories.AgentSSHTest;
import hudson.plugins.sshslaves.categories.SSHKeyAuthenticationTest;
import static org.junit.Assert.assertTrue;
+import org.junit.Ignore;
/**
* Connect to a remote SSH Agent
*
* @author Kuisathaverat
*/
+@Ignore("Only for manual test.")
@Category({ AgentSSHTest.class, SSHKeyAuthenticationTest.class})
public class AgentRSA256ConnectionTest extends AgentConnectionBase {
public static final String SSH_AGENT_NAME = "ssh-agent-rsa256";
diff --git a/src/test/java/hudson/plugins/sshslaves/agents/AgentRSA_AES128CBC_ConnectionTest.java b/src/test/java/hudson/plugins/sshslaves/agents/AgentRSA_AES128CBC_ConnectionTest.java
index 6c8b64f0..a12387f9 100644
--- a/src/test/java/hudson/plugins/sshslaves/agents/AgentRSA_AES128CBC_ConnectionTest.java
+++ b/src/test/java/hudson/plugins/sshslaves/agents/AgentRSA_AES128CBC_ConnectionTest.java
@@ -11,12 +11,14 @@
import hudson.plugins.sshslaves.categories.AgentSSHTest;
import hudson.plugins.sshslaves.categories.SSHKeyAuthenticationTest;
import static org.junit.Assert.assertTrue;
+import org.junit.Ignore;
/**
* Connect to a remote SSH Agent
*
* @author Kuisathaverat
*/
+@Ignore("Only for manual test.")
@Category({ AgentSSHTest.class, SSHKeyAuthenticationTest.class})
public class AgentRSA_AES128CBC_ConnectionTest extends AgentConnectionBase {
public static final String SSH_AGENT_NAME = "ssh-agent-rsa";
diff --git a/src/test/java/hudson/plugins/sshslaves/agents/AgentRSA_AES192CBC_ConnectionTest.java b/src/test/java/hudson/plugins/sshslaves/agents/AgentRSA_AES192CBC_ConnectionTest.java
index 12ad532a..ca27295f 100644
--- a/src/test/java/hudson/plugins/sshslaves/agents/AgentRSA_AES192CBC_ConnectionTest.java
+++ b/src/test/java/hudson/plugins/sshslaves/agents/AgentRSA_AES192CBC_ConnectionTest.java
@@ -11,12 +11,14 @@
import hudson.plugins.sshslaves.categories.AgentSSHTest;
import hudson.plugins.sshslaves.categories.SSHKeyAuthenticationTest;
import static org.junit.Assert.assertTrue;
+import org.junit.Ignore;
/**
* Connect to a remote SSH Agent
*
* @author Kuisathaverat
*/
+@Ignore("Only for manual test.")
@Category({ AgentSSHTest.class, SSHKeyAuthenticationTest.class})
public class AgentRSA_AES192CBC_ConnectionTest extends AgentConnectionBase {
public static final String SSH_AGENT_NAME = "ssh-agent-rsa";
diff --git a/src/test/java/hudson/plugins/sshslaves/agents/AgentRSA_DESCBC_ConnectionTest.java b/src/test/java/hudson/plugins/sshslaves/agents/AgentRSA_DESCBC_ConnectionTest.java
index 3527a87f..4a09361b 100644
--- a/src/test/java/hudson/plugins/sshslaves/agents/AgentRSA_DESCBC_ConnectionTest.java
+++ b/src/test/java/hudson/plugins/sshslaves/agents/AgentRSA_DESCBC_ConnectionTest.java
@@ -11,12 +11,14 @@
import hudson.plugins.sshslaves.categories.AgentSSHTest;
import hudson.plugins.sshslaves.categories.SSHKeyAuthenticationTest;
import static org.junit.Assert.assertTrue;
+import org.junit.Ignore;
/**
* Connect to a remote SSH Agent
*
* @author Kuisathaverat
*/
+@Ignore("Only for manual test.")
@Category({ AgentSSHTest.class, SSHKeyAuthenticationTest.class})
public class AgentRSA_DESCBC_ConnectionTest extends AgentConnectionBase {
public static final String SSH_AGENT_NAME = "ssh-agent-rsa";
diff --git a/src/test/java/hudson/plugins/sshslaves/agents/AgentRSA_DES_EDE3CBC_ConnectionTest.java b/src/test/java/hudson/plugins/sshslaves/agents/AgentRSA_DES_EDE3CBC_ConnectionTest.java
index 7403667a..dcfdea27 100644
--- a/src/test/java/hudson/plugins/sshslaves/agents/AgentRSA_DES_EDE3CBC_ConnectionTest.java
+++ b/src/test/java/hudson/plugins/sshslaves/agents/AgentRSA_DES_EDE3CBC_ConnectionTest.java
@@ -11,12 +11,14 @@
import hudson.plugins.sshslaves.categories.AgentSSHTest;
import hudson.plugins.sshslaves.categories.SSHKeyAuthenticationTest;
import static org.junit.Assert.assertTrue;
+import org.junit.Ignore;
/**
* Connect to a remote SSH Agent
*
* @author Kuisathaverat
*/
+@Ignore("Only for manual test.")
@Category({ AgentSSHTest.class, SSHKeyAuthenticationTest.class})
public class AgentRSA_DES_EDE3CBC_ConnectionTest extends AgentConnectionBase {
public static final String SSH_AGENT_NAME = "ssh-agent-rsa";
diff --git a/src/test/java/hudson/plugins/sshslaves/agents/AgentUbuntu1404RSAConnectionTest.java b/src/test/java/hudson/plugins/sshslaves/agents/AgentUbuntu1404RSAConnectionTest.java
index 2f643ff2..855159f9 100644
--- a/src/test/java/hudson/plugins/sshslaves/agents/AgentUbuntu1404RSAConnectionTest.java
+++ b/src/test/java/hudson/plugins/sshslaves/agents/AgentUbuntu1404RSAConnectionTest.java
@@ -11,12 +11,14 @@
import hudson.plugins.sshslaves.categories.AgentSSHTest;
import hudson.plugins.sshslaves.categories.SSHKeyAuthenticationTest;
import static org.junit.Assert.assertTrue;
+import org.junit.Ignore;
/**
* Connect to a remote SSH Agent
*
* @author Kuisathaverat
*/
+@Ignore("Only for manual test.")
@Category({ AgentSSHTest.class, SSHKeyAuthenticationTest.class})
public class AgentUbuntu1404RSAConnectionTest extends AgentConnectionBase {
public static final String SSH_AGENT_NAME = "ssh-agent-ubuntu-14.04";
diff --git a/src/test/java/hudson/plugins/sshslaves/agents/AgentUbuntu1604RSAConnectionTest.java b/src/test/java/hudson/plugins/sshslaves/agents/AgentUbuntu1604RSAConnectionTest.java
index 1793b399..d73777b5 100644
--- a/src/test/java/hudson/plugins/sshslaves/agents/AgentUbuntu1604RSAConnectionTest.java
+++ b/src/test/java/hudson/plugins/sshslaves/agents/AgentUbuntu1604RSAConnectionTest.java
@@ -11,12 +11,14 @@
import hudson.plugins.sshslaves.categories.AgentSSHTest;
import hudson.plugins.sshslaves.categories.SSHKeyAuthenticationTest;
import static org.junit.Assert.assertTrue;
+import org.junit.Ignore;
/**
* Connect to a remote SSH Agent
*
* @author Kuisathaverat
*/
+@Ignore("Only for manual test.")
@Category({ AgentSSHTest.class, SSHKeyAuthenticationTest.class})
public class AgentUbuntu1604RSAConnectionTest extends AgentConnectionBase {
public static final String SSH_AGENT_NAME = "ssh-agent-ubuntu-16.04";
diff --git a/src/test/java/hudson/plugins/sshslaves/agents/AgentUbuntu1804RSAConnectionTest.java b/src/test/java/hudson/plugins/sshslaves/agents/AgentUbuntu1804RSAConnectionTest.java
index 73acbab4..2c0cd94f 100644
--- a/src/test/java/hudson/plugins/sshslaves/agents/AgentUbuntu1804RSAConnectionTest.java
+++ b/src/test/java/hudson/plugins/sshslaves/agents/AgentUbuntu1804RSAConnectionTest.java
@@ -11,12 +11,14 @@
import hudson.plugins.sshslaves.categories.AgentSSHTest;
import hudson.plugins.sshslaves.categories.SSHKeyAuthenticationTest;
import static org.junit.Assert.assertTrue;
+import org.junit.Ignore;
/**
* Connect to a remote SSH Agent
*
* @author Kuisathaverat
*/
+@Ignore("Only for manual test.")
@Category({ AgentSSHTest.class, SSHKeyAuthenticationTest.class})
public class AgentUbuntu1804RSAConnectionTest extends AgentConnectionBase {
public static final String SSH_AGENT_NAME = "ssh-agent-ubuntu-18.04";
diff --git a/src/test/java/hudson/plugins/sshslaves/agents/AgentUbuntu2004RSAConnectionTest.java b/src/test/java/hudson/plugins/sshslaves/agents/AgentUbuntu2004RSAConnectionTest.java
index 5151f7de..c08d9e48 100644
--- a/src/test/java/hudson/plugins/sshslaves/agents/AgentUbuntu2004RSAConnectionTest.java
+++ b/src/test/java/hudson/plugins/sshslaves/agents/AgentUbuntu2004RSAConnectionTest.java
@@ -1,6 +1,7 @@
package hudson.plugins.sshslaves.agents;
import java.io.IOException;
+import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
@@ -18,6 +19,7 @@
*
* @author Kuisathaverat
*/
+@Ignore("Only for manual test.")
@Category({ AgentSSHTest.class, SSHKeyAuthenticationTest.class})
public class AgentUbuntu2004RSAConnectionTest extends AgentConnectionBase {
public static final String SSH_AGENT_NAME = "ssh-agent-ubuntu-20.04";
diff --git a/src/test/java/hudson/plugins/sshslaves/verifiers/TrustHostKeyActionTest.java b/src/test/java/hudson/plugins/sshslaves/verifiers/TrustHostKeyActionTest.java
index 2ed2c10d..db177361 100644
--- a/src/test/java/hudson/plugins/sshslaves/verifiers/TrustHostKeyActionTest.java
+++ b/src/test/java/hudson/plugins/sshslaves/verifiers/TrustHostKeyActionTest.java
@@ -187,25 +187,21 @@ private Object newCommandFactory(Class commandFactoryClass) throws ClassNotFound
return java.lang.reflect.Proxy.newProxyInstance(
commandFactoryClass.getClassLoader(),
new java.lang.Class[]{commandFactoryClass},
- new java.lang.reflect.InvocationHandler() {
+ (proxy, method, args) -> {
- @Override
- public Object invoke(Object proxy, java.lang.reflect.Method method, Object[] args) throws java.lang.Throwable {
+ if (method.getName().equals("createCommand")) {
+ Class commandClass;
+ try {
+ commandClass = Class.forName("org.apache.sshd.server.command.UnknownCommand");
+ } catch (ClassNotFoundException e) {
+ commandClass = Class.forName("org.apache.sshd.server.scp.UnknownCommand");
+ }
- if (method.getName().equals("createCommand")) {
- Class commandClass;
- try {
- commandClass = Class.forName("org.apache.sshd.server.command.UnknownCommand");
- } catch (ClassNotFoundException e) {
- commandClass = Class.forName("org.apache.sshd.server.scp.UnknownCommand");
- }
+ return commandClass.getConstructor(String.class).newInstance(args[0]);
+ }
- return commandClass.getConstructor(String.class).newInstance(args[0]);
- }
-
- return null;
- }
- });
+ return null;
+ });
}
private Class newCommandAuthenticatorClass() throws ClassNotFoundException {
@@ -223,18 +219,14 @@ private Object newAuthenticator(Class passwordAuthenticatorClass) throws ClassNo
return java.lang.reflect.Proxy.newProxyInstance(
passwordAuthenticatorClass.getClassLoader(),
new java.lang.Class[]{passwordAuthenticatorClass},
- new java.lang.reflect.InvocationHandler() {
-
- @Override
- public Object invoke(Object proxy, java.lang.reflect.Method method, Object[] args) throws java.lang.Throwable {
+ (proxy, method, args) -> {
- if (method.getName().equals("authenticate")) {
- return Boolean.TRUE;
- }
+ if (method.getName().equals("authenticate")) {
+ return Boolean.TRUE;
+ }
- return null;
- }
- });
+ return null;
+ });
}
private Object invoke(Object target, String methodName, Class[] parameterTypes, Object[] args) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {