use of hudson.slaves.JNLPLauncher in project support-core-plugin by jenkinsci.
the class AboutJenkinsTest method testAboutNodesContent.
@Test
@Issue("JENKINS-65097")
public void testAboutNodesContent() throws Exception {
DumbSlave tcp1 = j.createSlave("tcp1", "test", null);
tcp1.setLauncher(new JNLPLauncher(false));
((JNLPLauncher) tcp1.getLauncher()).setWebSocket(false);
tcp1.save();
String aboutMdToString = SupportTestUtils.invokeComponentToString(Objects.requireNonNull(ExtensionList.lookup(Component.class).get(AboutJenkins.class)));
assertThat(aboutMdToString, containsString(" * `" + tcp1.getNodeName() + "` (`hudson.slaves.DumbSlave`)"));
assertThat(aboutMdToString, containsString(" - Launch method: `hudson.slaves.JNLPLauncher`"));
assertThat(aboutMdToString, containsString(" - WebSocket: false"));
((JNLPLauncher) tcp1.getLauncher()).setWebSocket(true);
tcp1.save();
aboutMdToString = SupportTestUtils.invokeComponentToString(Objects.requireNonNull(ExtensionList.lookup(Component.class).get(AboutJenkins.class)));
assertThat(aboutMdToString, containsString(" * `" + tcp1.getNodeName() + "` (`hudson.slaves.DumbSlave`)"));
assertThat(aboutMdToString, containsString(" - Launch method: `hudson.slaves.JNLPLauncher`"));
assertThat(aboutMdToString, containsString(" - WebSocket: true"));
}
use of hudson.slaves.JNLPLauncher in project vsphere-cloud-plugin by jenkinsci.
the class CloudProvisioningStateTest method createRecord.
private CloudProvisioningRecord createRecord(CloudProvisioningState instance) {
recordNumber++;
final String cloneNamePrefix = "prefix" + recordNumber;
final vSphereCloudSlaveTemplate template = new vSphereCloudSlaveTemplate(cloneNamePrefix, "masterImageName", null, "snapshotName", false, "cluster", "resourcePool", "datastore", "folder", "customizationSpec", "templateDescription", 0, 1, "remoteFS", "", Mode.NORMAL, false, false, 0, 0, false, "targetResourcePool", "targetHost", null, new JNLPLauncher(), RetentionStrategy.NOOP, Collections.<NodeProperty<?>>emptyList(), Collections.<VSphereGuestInfoProperty>emptyList());
stubVSphereCloudTemplates.add(template);
final List<vSphereCloudSlaveTemplate> templates = new ArrayList<vSphereCloudSlaveTemplate>();
templates.add(template);
final List<CloudProvisioningRecord> records = instance.calculateProvisionableTemplates(templates);
assertThat(records, IsIterableWithSize.<CloudProvisioningRecord>iterableWithSize(1));
final CloudProvisioningRecord record = records.get(0);
return record;
}
use of hudson.slaves.JNLPLauncher in project configuration-as-code-plugin by jenkinsci.
the class BuildAgentsTest method configure_build_agents.
@Test
@ConfiguredWithReadme(value = "build_agents/README.md")
public void configure_build_agents() {
assertThat(j.getInstance().getComputers().length, is(3));
Slave slave = (Slave) j.getInstance().getNode("utility-node");
assertThat(slave.getRemoteFS(), is("/home/user1"));
JNLPLauncher jnlpLauncher = ((JNLPLauncher) slave.getLauncher());
assertThat(jnlpLauncher.getWorkDirSettings().getWorkDirPath(), is("/tmp"));
assertThat(jnlpLauncher.getWorkDirSettings().getInternalDir(), is("remoting"));
assertTrue(jnlpLauncher.getWorkDirSettings().isDisabled());
assertFalse(jnlpLauncher.getWorkDirSettings().isFailIfWorkDirIsMissing());
assertThat(j.getInstance().getNode("utility-node-2").getNumExecutors(), is(4));
assertThat(j.getInstance().getNode("utility-node-2").getMode(), is(Mode.NORMAL));
slave = (Slave) j.getInstance().getNode("utility-node-2");
assertThat(slave.getRemoteFS(), is("/home/user2"));
SSHLauncher launcher = ((SSHLauncher) slave.getLauncher());
assertThat(launcher.getHost(), is("192.168.1.1"));
assertThat(launcher.getPort(), is(22));
assertThat(launcher.getCredentialsId(), is("test"));
assertThat(launcher.getMaxNumRetries(), is(3));
assertThat(launcher.getRetryWaitTime(), is(30));
}
use of hudson.slaves.JNLPLauncher in project vsphere-cloud-plugin by jenkinsci.
the class vSphereCloudSlaveTemplate method determineLauncher.
private ComputerLauncher determineLauncher(final VSphere vSphere, final String cloneName) throws VSphereException {
if (launcher instanceof JNLPLauncher) {
return launcher;
}
if (launcher instanceof CommandLauncher) {
return launcher;
}
if (launcher instanceof SSHLauncher) {
final SSHLauncher sshLauncher = (SSHLauncher) launcher;
LOGGER.log(Level.FINER, "Slave {0} uses SSHLauncher - obtaining IP address...", cloneName);
final String ip = vSphere.getIp(vSphere.getVmByName(cloneName), 1000);
LOGGER.log(Level.FINER, "Slave {0} has IP address {1}", new Object[] { cloneName, ip });
final SSHLauncher launcherWithIPAddress = new SSHLauncher(ip, sshLauncher.getPort(), sshLauncher.getCredentialsId(), sshLauncher.getJvmOptions(), sshLauncher.getJavaPath(), sshLauncher.getPrefixStartSlaveCmd(), sshLauncher.getSuffixStartSlaveCmd(), sshLauncher.getLaunchTimeoutSeconds(), sshLauncher.getMaxNumRetries(), sshLauncher.getRetryWaitTime());
return launcherWithIPAddress;
}
throw new IllegalStateException("Unsupported launcher (" + launcher + ") in template configuration");
}
Aggregations