/** * Serves the workspace files. */ public DirectoryBrowserSupport doWs( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException, InterruptedException { checkPermission(Item.WORKSPACE); FilePath ws = getSomeWorkspace(); if ((ws == null) || (!ws.exists())) { // if there's no workspace, report a nice error message // Would be good if when asked for *plain*, do something else! // (E.g. return 404, or send empty doc.) // Not critical; client can just check if content type is not text/plain, // which also serves to detect old versions of Hudson. req.getView(this,"noWorkspace.jelly").forward(req,rsp); return null; } else { Computer c = ws.toComputer(); String title; if (c == null) { title = Messages.AbstractProject_WorkspaceTitle(getDisplayName()); } else { title = Messages.AbstractProject_WorkspaceTitleOnComputer(getDisplayName(), c.getDisplayName()); } return new DirectoryBrowserSupport(this, ws, title, "folder.png", true); } }
private String getComputerName(final FilePath workspace) { Computer computer = workspace.toComputer(); if (computer != null) { return computer.getName(); } return StringUtils.EMPTY; }
@Override public void tearDown(Run<?, ?> build, FilePath workspace, Launcher launcher, TaskListener listener) throws IOException, InterruptedException { Computer computer = workspace.toComputer(); if (computer == null) { throw new IllegalStateException("Computer is null"); } if (MesosComputer.class.isInstance(computer)) { String msg = "Taking single-use slave " + computer.getName() + " offline."; LOGGER.warning(msg); listener.getLogger().println(msg); computer.setTemporarilyOffline(true, OfflineCause.create(Messages._MesosSingleUseSlave_OfflineCause())); } else { listener.getLogger().println("Not a single-use slave, this is a " + computer.getClass()); } } }
@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; }
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); } }
final Computer computer = workspace.toComputer(); if (computer == null) { throw new AbortException("Cannot get Coverity tools installation");
/** * Serves the workspace files. */ public DirectoryBrowserSupport doWs( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException, InterruptedException { checkPermission(Item.WORKSPACE); FilePath ws = getSomeWorkspace(); if ((ws == null) || (!ws.exists())) { // if there's no workspace, report a nice error message // Would be good if when asked for *plain*, do something else! // (E.g. return 404, or send empty doc.) // Not critical; client can just check if content type is not text/plain, // which also serves to detect old versions of Hudson. req.getView(this,"noWorkspace.jelly").forward(req,rsp); return null; } else { Computer c = ws.toComputer(); String title; if (c == null) { title = Messages.AbstractProject_WorkspaceTitle(getDisplayName()); } else { title = Messages.AbstractProject_WorkspaceTitleOnComputer(getDisplayName(), c.getDisplayName()); } return new DirectoryBrowserSupport(this, ws, title, "folder.png", true); } }
throw new IOException(Messages.NodeJSBuilders_noInstallationFound(nodeJSInstallationName)); Computer computer = workspace.toComputer(); if (computer == null) { throw new AbortException(Messages.NodeJSBuilders_nodeOffline());
Server server = createServer(launcher, listener, build); try { WorkspaceConfiguration workspaceConfiguration = new WorkspaceConfiguration(server.getUrl(), getWorkspaceName(build, workspaceFilePath.toComputer()), getProjectPath(build), getCloakedPaths(build), getLocalPath()); final Run<?, ?> previousBuild = build.getPreviousBuild(); Computer computer = workspaceFilePath.toComputer(); if (computer != null) { BuildWorkspaceConfiguration nodeConfiguration = new BuildWorkspaceConfigurationRetriever().getLatestForNode(computer.getNode(), previousBuild);