hudson.FilePath.createLauncher()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(4.5k)|赞(0)|评价(0)|浏览(134)

本文整理了Java中hudson.FilePath.createLauncher()方法的一些代码示例,展示了FilePath.createLauncher()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FilePath.createLauncher()方法的具体详情如下:
包路径:hudson.FilePath
类名称:FilePath
方法名:createLauncher

FilePath.createLauncher介绍

[英]Creates a Launcher for starting processes on the node that has this file.
[中]创建启动器,用于在包含此文件的节点上启动进程。

代码示例

代码示例来源:origin: jenkinsci/jenkins

private PollingResult pollWithWorkspace(TaskListener listener, SCM scm, R lb, @Nonnull FilePath ws, WorkspaceList l) throws InterruptedException, IOException {
  // if doing non-concurrent build, acquire a workspace in a way that causes builds to block for this workspace.
  // this prevents multiple workspaces of the same job --- the behavior of Hudson < 1.319.
  //
  // OTOH, if a concurrent build is chosen, the user is willing to create a multiple workspace,
  // so better throughput is achieved over time (modulo the initial cost of creating that many workspaces)
  // by having multiple workspaces
  Node node = lb.getBuiltOn();
  Launcher launcher = ws.createLauncher(listener).decorateByEnv(getEnvironment(node,listener));
  WorkspaceList.Lease lease = l.acquire(ws, !concurrentBuild);
  try {
    String nodeName = node != null ? node.getSelfLabel().getName() : "[node_unavailable]";
    listener.getLogger().println("Polling SCM changes on " + nodeName);
    LOGGER.fine("Polling SCM changes of " + getName());
    if (pollingBaseline==null) // see NOTE-NO-BASELINE above
      calcPollingBaseline(lb,launcher,listener);
    PollingResult r = scm.poll(this, launcher, ws, listener, pollingBaseline);
    pollingBaseline = r.remote;
    return r;
  } finally {
    lease.release();
  }
}

代码示例来源:origin: jenkinsci/nodejs-plugin

@Override
  public String invoke(File f, VirtualChannel channel) throws IOException, InterruptedException {
    Charset charset = Charset.defaultCharset();
    FilePath basePath = new FilePath(f);
    Launcher launcher = basePath.createLauncher(new StreamTaskListener(new NullOutputStream(), charset));
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    Proc starter = launcher.launch().cmdAsSingleString("uname -m").stdout(baos).start();
    int exitCode = starter.join();
    if (exitCode != 0) {
      throw new IOException("Fail to execute 'uname -m' because: " + baos.toString(charset.name()));
    }
    return new String(baos.toByteArray(), charset).trim();
  }
};

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

private PollingResult pollWithWorkspace(TaskListener listener, SCM scm, R lb, @Nonnull FilePath ws, WorkspaceList l) throws InterruptedException, IOException {
  // if doing non-concurrent build, acquire a workspace in a way that causes builds to block for this workspace.
  // this prevents multiple workspaces of the same job --- the behavior of Hudson < 1.319.
  //
  // OTOH, if a concurrent build is chosen, the user is willing to create a multiple workspace,
  // so better throughput is achieved over time (modulo the initial cost of creating that many workspaces)
  // by having multiple workspaces
  Node node = lb.getBuiltOn();
  Launcher launcher = ws.createLauncher(listener).decorateByEnv(getEnvironment(node,listener));
  WorkspaceList.Lease lease = l.acquire(ws, !concurrentBuild);
  try {
    String nodeName = node != null ? node.getSelfLabel().getName() : "[node_unavailable]";
    listener.getLogger().println("Polling SCM changes on " + nodeName);
    LOGGER.fine("Polling SCM changes of " + getName());
    if (pollingBaseline==null) // see NOTE-NO-BASELINE above
      calcPollingBaseline(lb,launcher,listener);
    PollingResult r = scm.poll(this, launcher, ws, listener, pollingBaseline);
    pollingBaseline = r.remote;
    return r;
  } finally {
    lease.release();
  }
}

代码示例来源:origin: jenkinsci/nodejs-plugin

Launcher launch = temp.createLauncher(listener);
ProcStarter starter = launch.launch().cmds(new File("cmd"), "/c", "for %A in (.) do msiexec TARGETDIR=\"%~sA\" /a "+ temp.getName() + "\\nodejs.msi /qn /L* " + temp.getName() + "\\log.txt");
starter=starter.pwd(expected);

代码示例来源:origin: org.jenkins-ci.plugins.workflow/workflow-job

launcher = workspace.createLauncher(listener).decorateByEnv(getEnvironment(c.getNode(), listener));
  lease = c.getWorkspaceList().acquire(workspace, !isConcurrentBuild());
} else {

代码示例来源:origin: org.eclipse.hudson.main/hudson-core

Launcher launcher = ws.createLauncher(listener);
try {
  LOGGER.fine("Polling SCM changes of " + getName());

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

Launcher launcher = ws.createLauncher(listener);
try {
  LOGGER.fine("Polling SCM changes of " + getName());

代码示例来源:origin: hudson/hudson-2.x

Launcher launcher = ws.createLauncher(listener);
try {
  LOGGER.fine("Polling SCM changes of " + getName());

代码示例来源:origin: org.eclipse.hudson/hudson-core

Launcher launcher = ws.createLauncher(listener);
try {
  LOGGER.fine("Polling SCM changes of " + getName());

代码示例来源:origin: org.hudsonci.plugins/run-condition

launcher = ws.createLauncher(listener);

相关文章