Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX JENKINS-51876] inform about using a deprecated constructor #91

Merged
merged 8 commits into from Jul 23, 2018
25 changes: 23 additions & 2 deletions src/main/java/hudson/plugins/sshslaves/SSHLauncher.java
Expand Up @@ -47,7 +47,6 @@
import com.trilead.ssh2.SFTPv3FileAttributes;
import com.trilead.ssh2.ServerHostKeyVerifier;
import com.trilead.ssh2.Session;
import com.trilead.ssh2.transport.TransportManager;
import edu.umd.cs.findbugs.annotations.NonNull;
import hudson.AbortException;
import hudson.EnvVars;
Expand Down Expand Up @@ -106,7 +105,6 @@
import java.io.PrintStream;
import java.io.StringWriter;
import java.lang.InterruptedException;
import java.lang.reflect.Field;
import java.net.URL;
import java.text.MessageFormat;
import java.text.NumberFormat;
Expand Down Expand Up @@ -335,6 +333,7 @@ public SSHLauncher(String host, int port, String credentialsId,
Integer launchTimeoutSeconds, Integer maxNumRetries, Integer retryWaitTime) {
this(host, port, credentialsId, jvmOptions, javaPath, null, prefixStartSlaveCmd,
suffixStartSlaveCmd, launchTimeoutSeconds, maxNumRetries, retryWaitTime, null);
LOGGER.warning("This constructor is deprecated and will be removed on next versions, please do not use it.");
}

/** @deprecated Use {@link #SSHLauncher(String, int, String, String, String, String, String, Integer, Integer, Integer)} instead. */
Expand All @@ -344,6 +343,7 @@ public SSHLauncher(String host, int port, String credentialsId,
Integer launchTimeoutSeconds) {
this(host, port, credentialsId, jvmOptions, javaPath, null, prefixStartSlaveCmd,
suffixStartSlaveCmd, launchTimeoutSeconds, null, null, null);
LOGGER.warning("This constructor is deprecated and will be removed on next versions, please do not use it.");
}

/**
Expand All @@ -353,6 +353,7 @@ public SSHLauncher(String host, int port, String credentialsId,
public SSHLauncher(String host, int port, String credentialsId,
String jvmOptions, String javaPath, String prefixStartSlaveCmd, String suffixStartSlaveCmd) {
this(host, port, credentialsId, jvmOptions, javaPath, null, prefixStartSlaveCmd, suffixStartSlaveCmd, null, null, null, null);
LOGGER.warning("This constructor is deprecated and will be removed on next versions, please do not use it.");
}

public static StandardUsernameCredentials lookupSystemCredentials(String credentialsId) {
Expand Down Expand Up @@ -386,11 +387,15 @@ SSH_SCHEME, new HostnamePortRequirement(host, port)),
* @param launchTimeoutSeconds Launch timeout in seconds
* @param maxNumRetries The number of times to retry connection if the SSH connection is refused during initial connect
* @param retryWaitTime The number of seconds to wait between retries
*
* @deprecated Use
* {@link #SSHLauncher(String, int, String, String, String, JDKInstaller, String, String, Integer, Integer, Integer, SshHostKeyVerificationStrategy)} instead.
*/
public SSHLauncher(String host, int port, StandardUsernameCredentials credentials,
String jvmOptions, String javaPath, String prefixStartSlaveCmd, String suffixStartSlaveCmd,
Integer launchTimeoutSeconds, Integer maxNumRetries, Integer retryWaitTime) {
this(host, port, credentials, jvmOptions, javaPath, null, prefixStartSlaveCmd, suffixStartSlaveCmd, launchTimeoutSeconds, maxNumRetries, retryWaitTime, null);
LOGGER.warning("This constructor is deprecated and will be removed on next versions, please do not use it.");
}

/** @deprecated Use {@link #SSHLauncher(String, int, StandardUsernameCredentials, String, String, String, String, Integer, Integer, Integer)} instead. */
Expand All @@ -399,20 +404,23 @@ public SSHLauncher(String host, int port, StandardUsernameCredentials credential
String jvmOptions, String javaPath, String prefixStartSlaveCmd, String suffixStartSlaveCmd,
Integer launchTimeoutSeconds) {
this(host, port, credentials, jvmOptions, javaPath, null, prefixStartSlaveCmd, suffixStartSlaveCmd, launchTimeoutSeconds, null, null, null);
LOGGER.warning("This constructor is deprecated and will be removed on next versions, please do not use it.");
}

/** @deprecated Use {@link #SSHLauncher(String, int, StandardUsernameCredentials, String, String, String, String, Integer, Integer, Integer)} instead. */
@Deprecated
public SSHLauncher(String host, int port, StandardUsernameCredentials credentials,
String jvmOptions, String javaPath, String prefixStartSlaveCmd, String suffixStartSlaveCmd) {
this(host, port, credentials, jvmOptions, javaPath, null, prefixStartSlaveCmd, suffixStartSlaveCmd, null, null, null, null);
LOGGER.warning("This constructor is deprecated and will be removed on next versions, please do not use it.");
}

/** @deprecated Use {@link #SSHLauncher(String, int, StandardUsernameCredentials, String, String, String, String)} instead. */
@Deprecated
public SSHLauncher(String host, int port, SSHUser credentials,
String jvmOptions, String javaPath, String prefixStartSlaveCmd, String suffixStartSlaveCmd) {
this(host, port, (StandardUsernameCredentials) credentials, jvmOptions, javaPath, null, prefixStartSlaveCmd, suffixStartSlaveCmd, null, null, null, null);
LOGGER.warning("This constructor is deprecated and will be removed on next versions, please do not use it.");
}

/**
Expand All @@ -434,6 +442,7 @@ public SSHLauncher(String host, int port, String username, String password, Stri
String jvmOptions, String javaPath, String prefixStartSlaveCmd, String suffixStartSlaveCmd) {
this(host, port, username, password, privatekey, jvmOptions, javaPath, null, prefixStartSlaveCmd,
suffixStartSlaveCmd);
LOGGER.warning("This constructor is deprecated and will be removed on next versions, please do not use it.");
}

/**
Expand Down Expand Up @@ -472,6 +481,7 @@ public SSHLauncher(String host, int port, String username, String password, Stri
this.maxNumRetries = null;
this.retryWaitTime = null;
this.sshHostKeyVerificationStrategy = null;
LOGGER.warning("This constructor is deprecated and will be removed on next versions, please do not use it.");
}

/**
Expand All @@ -491,6 +501,7 @@ public SSHLauncher(String host, int port, String username, String password, Stri
public SSHLauncher(String host, int port, StandardUsernameCredentials credentials, String jvmOptions,
String javaPath, JDKInstaller jdkInstaller, String prefixStartSlaveCmd, String suffixStartSlaveCmd) {
this(host, port, credentials, jvmOptions, javaPath, jdkInstaller, prefixStartSlaveCmd, suffixStartSlaveCmd, null, null, null);
LOGGER.warning("This constructor is deprecated and will be removed on next versions, please do not use it.");
}

@Deprecated
Expand All @@ -515,11 +526,14 @@ public SSHLauncher(String host, int port, StandardUsernameCredentials credential


this(host, port, credentials, jvmOptions, javaPath, jdkInstaller, prefixStartSlaveCmd, suffixStartSlaveCmd, launchTimeoutSeconds, maxNumRetries, retryWaitTime, null);
LOGGER.warning("This constructor is deprecated and will be removed on next versions, please do not use it.");
}


/**
* @deprecated
*
* deprecated but used by not deprecated constructor
*/
@Deprecated
public SSHLauncher(String host, int port, StandardUsernameCredentials credentials, String jvmOptions,
Expand Down Expand Up @@ -572,10 +586,17 @@ public SSHLauncher(String host, int port, String credentialsId, String jvmOption
public SSHLauncher(String host, int port, SSHUser credentials, String jvmOptions,
String javaPath, JDKInstaller jdkInstaller, String prefixStartSlaveCmd, String suffixStartSlaveCmd) {
this(host, port, (StandardUsernameCredentials) credentials, jvmOptions, javaPath, jdkInstaller, prefixStartSlaveCmd, suffixStartSlaveCmd);
LOGGER.warning("This constructor is deprecated and will be removed on next versions, please do not use it.");
}

/**
* @deprecated Use
* {@link #SSHLauncher(String, int, String, String, String, JDKInstaller, String, String, Integer, Integer, Integer, SshHostKeyVerificationStrategy)} instead.
*/
@Deprecated
public SSHLauncher(String host, int port, String username, String password, String privatekey, String jvmOptions) {
this(host,port,username,password,privatekey,jvmOptions,null, null, null);
LOGGER.warning("This constructor is deprecated and will be removed on next versions, please do not use it.");
}

public String getCredentialsId() {
Expand Down