本文整理汇总了Java中hudson.model.Node.getChannel方法的典型用法代码示例。如果您正苦于以下问题:Java Node.getChannel方法的具体用法?Java Node.getChannel怎么用?Java Node.getChannel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hudson.model.Node
的用法示例。
在下文中一共展示了Node.getChannel方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: executeTest
import hudson.model.Node; //导入方法依赖的package包/类
/**
* Used to execute/start a remote process that initializes the testing
* process.
*
* @param build
* the current build
* @param listener
* the build's listener
* @param entry
* containing the {@link Node} and its {@link EnvVars}
* @return the started process
* @throws InterruptedException
* @throws IOException
* @since 1.0
*/
private Proc executeTest(AbstractBuild<?, ?> build, BuildListener listener,
Entry<Node, EnvVars> entry) throws InterruptedException,
IOException {
final EnvVars vars = NodeUtils.getEnvironment(entry.getKey(),
entry.getValue());
final Node node = entry.getKey();
// Get testing environment on the specific node
FilePath testEnv = FilePathUtils.getPathToTestEnvOnNode(node, build);
// Create a remote launcher
RemoteLauncher remoteLaucher = new RemoteLauncher(listener,
node.getChannel(), true);
// Create process starter
ProcStarter starter = remoteLaucher.launch()
.cmds(buildShellCmds(vars, node, build)).stdout(listener)
.stderr(listener.getLogger()).pwd(testEnv.getParent());
// Launch the process
Proc proc = remoteLaucher.launch(starter);
return proc;
}
示例2: startZAP
import hudson.model.Node; //导入方法依赖的package包/类
/**
* Start ZAProxy using command line. It uses host and port configured in Jenkins admin mode and
* ZAProxy program is launched in daemon mode (i.e without UI).
* ZAProxy is started on the build's machine (so master machine ou slave machine) thanks to
* {@link FilePath} object and {@link Launcher} object.
*
* @param build
* @param listener the listener to display log during the job execution in jenkins
* @param launcher the object to launch a process locally or remotely
* @throws InterruptedException
* @throws IOException
* @throws IllegalArgumentException
*/
public void startZAP(AbstractBuild<?, ?> build, BuildListener listener, Launcher launcher)
throws IllegalArgumentException, IOException, InterruptedException {
checkParams(build, listener);
FilePath ws = build.getWorkspace();
if (ws == null) {
Node node = build.getBuiltOn();
if (node == null) {
throw new NullPointerException("no such build node: " + build.getBuiltOnStr());
}
throw new NullPointerException("no workspace from node " + node + " which is computer " + node.toComputer() + " and has channel " + node.getChannel());
}
// Contains the absolute path to ZAP program
FilePath zapPathWithProgName = new FilePath(ws.getChannel(), zapProgram + getZAPProgramNameWithSeparator(build));
listener.getLogger().println("Start ZAProxy [" + zapPathWithProgName.getRemote() + "]");
// Command to start ZAProxy with parameters
List<String> cmd = new ArrayList<String>();
cmd.add(zapPathWithProgName.getRemote());
cmd.add(CMD_LINE_DAEMON);
cmd.add(CMD_LINE_HOST);
cmd.add(zapProxyHost);
cmd.add(CMD_LINE_PORT);
cmd.add(String.valueOf(zapProxyPort));
cmd.add(CMD_LINE_CONFIG);
cmd.add(CMD_LINE_API_KEY + "=" + API_KEY);
// Set the default directory used by ZAP if it's defined and if a scan is provided
if(scanURL && zapDefaultDir != null && !zapDefaultDir.isEmpty()) {
cmd.add(CMD_LINE_DIR);
cmd.add(zapDefaultDir);
}
// Adds command line arguments if it's provided
if(!cmdLinesZAP.isEmpty()) {
addZapCmdLine(cmd);
}
EnvVars envVars = build.getEnvironment(listener);
// on Windows environment variables are converted to all upper case,
// but no such conversions are done on Unix, so to make this cross-platform,
// convert variables to all upper cases.
for(Map.Entry<String,String> e : build.getBuildVariables().entrySet())
envVars.put(e.getKey(),e.getValue());
FilePath workDir = new FilePath(ws.getChannel(), zapProgram);
// JDK choice
computeJdkToUse(build, listener, envVars);
// Launch ZAP process on remote machine (on master if no remote machine)
launcher.launch().cmds(cmd).envs(envVars).stdout(listener).pwd(workDir).start();
// Call waitForSuccessfulConnectionToZap(int, BuildListener) remotely
build.getWorkspace().act(new WaitZAProxyInitCallable(this, listener));
}
示例3: getPathToRootProjectWorkspaceOnNode
import hudson.model.Node; //导入方法依赖的package包/类
/**
* Used to get the path to the project's workspace on the Slave.
*
* @param node
* the Slave
* @param build
* the current project
* @return the path as FilePath
* @since 1.0
*/
public static FilePath getPathToRootProjectWorkspaceOnNode(Node node,
AbstractBuild<?, ?> build) {
FilePath workspace = null;
if (node != null && node.toComputer().isOnline()) {
workspace = new FilePath(node.getChannel(), node.getRootPath()
.getRemote() + "/workspace/" + build.getProject().getName());
}
return workspace;
}
示例4: getPathToTestEnvOnNode
import hudson.model.Node; //导入方法依赖的package包/类
/**
* Used to get the path to the testing environment folder on the
* {@link Node}
*
* @param node
* the {@link Node}
* @param build
* the current build
* @param pathToTestEnv
* the path to the test environment relative to the 'home'
* directory on the {@link Node}
* @return the path as FilePath
* @throws InterruptedException
* @throws IOException
* @since 1.0
*/
public static FilePath getPathToTestEnvOnNode(Node node,
AbstractBuild<?, ?> build) throws InterruptedException, IOException {
FilePath workEnv = null;
if (node != null && node.toComputer().isOnline()) {
workEnv = new FilePath(node.getChannel(), FilePath
.getHomeDirectory(node.getChannel()).getRemote()
+ "/"
+ ((DTBuild) build).getTestJob().getSlaveTestEnv());
}
return workEnv;
}
示例5: getPathToTestProjectWorkspaceOnNode
import hudson.model.Node; //导入方法依赖的package包/类
/**
* Used to get the path to the project's workspace in the test environment
* on the Slave.
*
* @param node
* the {@link Node}
* @param build
* the current build
* @param pathToTestEnv
* the path to the testing environment specified in the project
* configuration
* @param projectName
* the project's name
* @return the path to the project inside the test environment folder on the
* node as FilePath
* @throws InterruptedException
* @throws IOException
* @since 1.0
*/
public static FilePath getPathToTestProjectWorkspaceOnNode(Node node,
AbstractBuild<?, ?> build) throws InterruptedException, IOException {
String projectName = ((DTBuild) build).getTestJob().getDisplayName();
FilePath workspace = null;
if (node != null && node.toComputer().isOnline()) {
workspace = new FilePath(node.getChannel(), getPathToTestEnvOnNode(
node, build).getRemote()
+ "/" + projectName);// getTestJob(build).getDisplayName()
}
return workspace;
}
示例6: getStatistics
import hudson.model.Node; //导入方法依赖的package包/类
/**
* Used to get the statistics file directly from the testing environment of
* the Slave node.
*
* @param node
* the Slave node
* @param build
* the current build
* @param pathToTestEnv
* the path to the test environment
* @return
* @throws InterruptedException
* @throws IOException
* @since 1.0
*/
public static FilePath getStatistics(Node node, AbstractBuild<?, ?> build)
throws InterruptedException, IOException {
FilePath statisticsFile = null;
if (node != null && node.toComputer().isOnline()) {
statisticsFile = new FilePath(node.getChannel(),
getPathToTestEnvOnNode(node, build)
+ "/"
+ ((DTBuild) build).getTestJob()
.getStatisticsFile());
}
return statisticsFile;
}
示例7: getStatisticsFromWS
import hudson.model.Node; //导入方法依赖的package包/类
/**
* Used to get the statistics file from the workspace of the current build
* of the Slave node.
*
* @param node
* the Slave node
* @param build
* the current build
* @return the file
* @since 1.0
*/
public static FilePath getStatisticsFromWS(Node node,
AbstractBuild<?, ?> build) {
return new FilePath(node.getChannel(),
getPathToRootProjectWorkspaceOnNode(build.getBuiltOn(), build)
.getRemote()
+ "/"
+ ((DTBuild) build).getTestJob().getStatisticsFile());
}
示例8: createFoldersOnNode
import hudson.model.Node; //导入方法依赖的package包/类
/**
* Used to create folder/s on the specified {@link Node}
*
* @param node
* the node
* @param path
* the requested folder structure
* @return the path to the last child directory created as FilePath
* @throws IOException
* @throws InterruptedException
* @since 1.0
*/
public static FilePath createFoldersOnNode(Node node, String path)
throws IOException, InterruptedException {
FilePath pathToFolder = new FilePath(node.getChannel(), path);
pathToFolder.mkdirs();
return pathToFolder;
}