hudson.model.Run.getCharacteristicEnvVars()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(3.3k)|赞(0)|评价(0)|浏览(90)

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

Run.getCharacteristicEnvVars介绍

[英]Builds up the environment variable map that's sufficient to identify a process as ours. This is used to kill run-away processes via ProcessTree#killAll(Map).
[中]建立环境变量映射,该映射足以将流程识别为我们的流程。这用于通过ProcessTree#killAll(Map)终止失控进程。

代码示例

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

private static Map<String, String> getEnvVars(Run<?, ?> build, TaskListener listener) {
  Map<String, String> messageEnvVars = new HashMap<>();
  if (build != null) {
    messageEnvVars.putAll(build.getCharacteristicEnvVars());
    try {
      messageEnvVars.putAll(build.getEnvironment(listener));
    } catch (Exception e) {
      listener.getLogger().printf("Couldn't get Env Variables: %s%n", e.getMessage());
      LOGGER.log(Level.WARNING, "Couldn't get Env Variables", e);
    }
  }
  return messageEnvVars;
}

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

env.putAll(getCharacteristicEnvVars());

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

public static Map<String, String> getEnvVars(Run<?, ?> build, TaskListener listener) {
  Map<String, String> messageEnvVars = new HashMap<String, String>();
  if (build != null) {
    messageEnvVars.putAll(build.getCharacteristicEnvVars());
    if (build instanceof AbstractBuild) {
      messageEnvVars.putAll(((AbstractBuild) build).getBuildVariables());
    }
    try {
      messageEnvVars.putAll(build.getEnvironment(listener));
    } catch (Exception e) {
      LOGGER.log(Level.SEVERE, "Couldn't get Env Variables: ", e);
    }
  }
  return messageEnvVars;
}

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

env.putAll(getCharacteristicEnvVars());

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

result.putAll(run.getCharacteristicEnvVars());

代码示例来源:origin: KostyaSha/yet-another-docker-plugin

/**
 * Return all job related vars without executor vars.
 * I.e. slave is running in osx, but docker image for shell is linux.
 */
protected static EnvVars getEnvVars(Run run, TaskListener listener) throws IOException, InterruptedException {
  final EnvVars envVars = run.getCharacteristicEnvVars();
  // from run.getEnvironment(listener) but without computer vars
  for (EnvironmentContributor ec : EnvironmentContributor.all().reverseView()) {
    // job vars
    ec.buildEnvironmentFor(run.getParent(), envVars, listener);
    // build vars
    if (ec instanceof CoreEnvironmentContributor) {
      // exclude executor computer related vars
      envVars.put("BUILD_DISPLAY_NAME", run.getDisplayName());
      String rootUrl = Jenkins.getInstance().getRootUrl();
      if (rootUrl != null) {
        envVars.put("BUILD_URL", rootUrl + run.getUrl());
      }
      // and remove useless job var from CoreEnvironmentContributor
      envVars.remove("JENKINS_HOME");
      envVars.remove("HUDSON_HOME");
    } else {
      ec.buildEnvironmentFor(run, envVars, listener); // build vars
    }
  }
  return envVars;
}

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

EnvVars env = getCharacteristicEnvVars();
Computer c = Computer.currentComputer();
if (c != null) {

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

EnvVars env = getCharacteristicEnvVars();
Computer c = Computer.currentComputer();
if (c != null) {

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

EnvVars env = getCharacteristicEnvVars();
Computer c = Computer.currentComputer();
if (c != null) {

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

EnvVars env = getCharacteristicEnvVars();
Computer c = Computer.currentComputer();
if (c != null) {

相关文章

微信公众号

最新文章

更多

Run类方法