hudson.Launcher.decorateByEnv()方法的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(3.5k)|赞(0)|评价(0)|浏览(127)

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

Launcher.decorateByEnv介绍

[英]Returns a decorated Launcher that automatically adds the specified environment variables. Those that are specified in ProcStarter#envs(String...) will take precedence over what's specified here.
[中]返回自动添加指定环境变量的修饰启动器。在ProcStarter#envs(字符串…)中指定的那些将优先于此处指定的内容。

代码示例

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

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

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

  1. public Processor(
  2. AbstractBuild<?, ?> build,
  3. Launcher launcher,
  4. BuildListener listener,
  5. Configuration config
  6. ) {
  7. this.build = build;
  8. Result result = build.getResult();
  9. if (result == null) {
  10. this.launcher = launcher;
  11. } else {
  12. this.launcher = launcher.decorateByEnv(
  13. new EnvVars("BUILD_RESULT", result.toString())); //NON-NLS
  14. }
  15. this.listener = listener;
  16. this.config = config;
  17. logger = new Logger(listener, build);
  18. }

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

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

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

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

相关文章