use of hudson.model.Computer in project support-core-plugin by jenkinsci.
the class FileDescriptorLimit method addContents.
private void addContents(@NonNull Container container, @NonNull final Node node) {
Computer c = node.toComputer();
if (c == null) {
return;
}
if (c instanceof SlaveComputer && !Boolean.TRUE.equals(((SlaveComputer) c).isUnix())) {
return;
}
if (!node.createLauncher(TaskListener.NULL).isUnix()) {
return;
}
String name;
if (node instanceof Jenkins) {
name = "master";
} else {
name = "slave/" + node.getNodeName();
}
container.add(new Content("nodes/" + name + "/file-descriptors.txt") {
@Override
public void writeTo(OutputStream os) throws IOException {
PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(os, "utf-8")));
out.println(node.getDisplayName());
out.println("======");
out.println();
try {
out.println(getUlimit(node));
} catch (IOException e) {
SupportLogFormatter.printStackTrace(e, out);
} finally {
out.flush();
}
}
});
}
use of hudson.model.Computer in project support-core-plugin by jenkinsci.
the class ProcFilesRetriever method addUnixContents.
protected void addUnixContents(@NonNull Container container, @NonNull final Node node) {
Computer c = node.toComputer();
if (c == null || c.isOffline()) {
return;
}
// fast path bailout for Windows
if (!Boolean.TRUE.equals(c.isUnix())) {
return;
}
SystemPlatform nodeSystemPlatform = getSystemPlatform(node);
if (!SystemPlatform.LINUX.equals(nodeSystemPlatform)) {
return;
}
String name;
if (node instanceof Jenkins) {
name = "master";
} else {
name = "slave/" + node.getNodeName();
}
for (Map.Entry<String, String> procDescriptor : getFilesToRetrieve().entrySet()) {
container.add(new FilePathContent("nodes/" + name + "/proc/" + procDescriptor.getValue(), new FilePath(c.getChannel(), procDescriptor.getKey())));
}
afterAddUnixContents(container, node, name);
}
use of hudson.model.Computer in project selenium_java by sergueik.
the class BuildDetailsImpl method resolveBuildNode.
private BuildNode resolveBuildNode(final Node node) {
String address = "UNKNOWN";
String hostname = "UNKNOWN";
try {
final InetAddress iaddr = InetAddress.getLocalHost();
address = iaddr.getHostAddress();
hostname = iaddr.getHostName();
} catch (final UnknownHostException e) {
LOGGER.log(Level.SEVERE, "An error occurred while trying to resolve the master's network name and address: " + e.getMessage(), e);
}
final Computer computer = node.toComputer();
final BuildNode retval = new BuildNodeImpl(address, hostname, computer.getDisplayName(), String.format("%s/%s", hostname, computer.getUrl()), node.getNodeName(), node.getNodeDescription(), node.getLabelString());
return retval;
}
use of hudson.model.Computer in project sonar-scanner-jenkins by SonarSource.
the class SonarRunnerBuilder method computeJdkToUse.
private void computeJdkToUse(Run<?, ?> build, FilePath workspace, TaskListener listener, EnvVars env) throws IOException, InterruptedException {
JDK jdkToUse = getJdkToUse(getProject(build));
if (jdkToUse != null) {
Computer computer = workspace.toComputer();
// just in case we are not in a build
if (computer != null) {
jdkToUse = jdkToUse.forNode(computer.getNode(), listener);
}
jdkToUse.buildEnvVars(env);
}
}
use of hudson.model.Computer in project sonar-scanner-jenkins by SonarSource.
the class BuilderUtils method getBuildTool.
@CheckForNull
public static <T extends ToolInstallation & EnvironmentSpecific<T> & NodeSpecific<T>> T getBuildTool(@Nullable T tool, EnvVars env, TaskListener listener, FilePath workspace) throws IOException, InterruptedException {
Computer computer = workspace.toComputer();
if (computer == null) {
return null;
}
Node node = computer.getNode();
if (tool == null || node == null) {
return null;
}
T t = tool.forNode(node, listener);
t = t.forEnvironment(env);
return t;
}
Aggregations