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

Update to the newest ssh-slaves version #100

Merged
merged 3 commits into from
Jul 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
buildPlugin(jenkinsVersions: [null, '2.32.3'])
buildPlugin()
15 changes: 12 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
<properties>
<revision>1.31</revision>
<changelist>-SNAPSHOT</changelist>
<jenkins.version>2.7.3</jenkins.version>
<java.level>7</java.level>
<jenkins.version>2.150.1</jenkins.version>
<java.level>8</java.level>
<findbugs.failOnError>false</findbugs.failOnError>
</properties>

Expand Down Expand Up @@ -56,8 +56,17 @@
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>ssh-slaves</artifactId>
<version>1.25</version>
<version>1.30.0</version>
<scope>test</scope>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.jenkins-ci</groupId>
<artifactId>symbol-annotation</artifactId>
<version>1.7</version>
</dependency>
</dependencies>
</dependencyManagement>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@

package org.jenkinsci.plugins.durabletask;

import com.cloudbees.plugins.credentials.Credentials;
import com.cloudbees.plugins.credentials.CredentialsScope;
import com.cloudbees.plugins.credentials.SystemCredentialsProvider;
import com.cloudbees.plugins.credentials.domains.Domain;
import com.cloudbees.plugins.credentials.impl.UsernamePasswordCredentialsImpl;
import hudson.EnvVars;
import hudson.FilePath;
import hudson.Launcher;
Expand Down Expand Up @@ -318,7 +323,10 @@ private void awaitCompletion(Controller c) throws IOException, InterruptedExcept
}

private DumbSlave createDockerSlave(DockerContainer container, String javaPath) throws hudson.model.Descriptor.FormException, IOException {
return new DumbSlave("docker", "/home/test", new SSHLauncher(container.ipBound(22), container.port(22), "test", "test", "", "", javaPath, null, null));
SystemCredentialsProvider.getInstance().setDomainCredentialsMap(Collections.singletonMap(Domain.global(), Collections.<Credentials>singletonList(new UsernamePasswordCredentialsImpl(CredentialsScope.GLOBAL, "test", null, "test", "test"))));
SSHLauncher sshLauncher = new SSHLauncher(container.ipBound(22), container.port(22), "test");
sshLauncher.setJavaPath(javaPath);
return new DumbSlave("docker", "/home/test", sshLauncher);
}

private void runOnDocker(DumbSlave s) throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@

package org.jenkinsci.plugins.durabletask;

import com.cloudbees.plugins.credentials.Credentials;
import com.cloudbees.plugins.credentials.CredentialsScope;
import com.cloudbees.plugins.credentials.SystemCredentialsProvider;
import com.cloudbees.plugins.credentials.domains.Domain;
import com.cloudbees.plugins.credentials.impl.UsernamePasswordCredentialsImpl;
import hudson.EnvVars;
import hudson.FilePath;
import hudson.Launcher;
Expand All @@ -35,6 +40,7 @@
import java.io.OutputStream;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.concurrent.BlockingQueue;
Expand Down Expand Up @@ -80,7 +86,10 @@ public class EncodingTest {
listener = StreamTaskListener.fromStdout();
launcher = r.jenkins.createLauncher(listener);
JavaContainer container = dockerUbuntu.create();
s = new DumbSlave("docker", "/home/test", new SSHLauncher(container.ipBound(22), container.port(22), "test", "test", "", "-Dfile.encoding=ISO-8859-1"));
SystemCredentialsProvider.getInstance().setDomainCredentialsMap(Collections.singletonMap(Domain.global(), Collections.<Credentials>singletonList(new UsernamePasswordCredentialsImpl(CredentialsScope.GLOBAL, "test", null, "test", "test"))));
SSHLauncher sshLauncher = new SSHLauncher(container.ipBound(22), container.port(22), "test");
sshLauncher.setJvmOptions("-Dfile.encoding=ISO-8859-1");
s = new DumbSlave("docker", "/home/test", sshLauncher);
r.jenkins.addNode(s);
r.waitOnline(s);
assertEquals("ISO-8859-1", s.getChannel().call(new DetectCharset()));
Expand Down