當前位置: 首頁>>代碼示例>>Java>>正文


Java AbstractBuild.getEnvironment方法代碼示例

本文整理匯總了Java中hudson.model.AbstractBuild.getEnvironment方法的典型用法代碼示例。如果您正苦於以下問題:Java AbstractBuild.getEnvironment方法的具體用法?Java AbstractBuild.getEnvironment怎麽用?Java AbstractBuild.getEnvironment使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在hudson.model.AbstractBuild的用法示例。


在下文中一共展示了AbstractBuild.getEnvironment方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: perform

import hudson.model.AbstractBuild; //導入方法依賴的package包/類
@Override
public boolean perform(AbstractBuild<?, ?> build, Launcher launcher,
        BuildListener listener) throws InterruptedException, IOException {
    EnvVars envVars = build.getEnvironment(listener);
    String expandedFilename = envVars.expand(filename);
    String expandedContent = envVars.expand(content);
    
    FilePath file = build.getWorkspace().child(expandedFilename);
    file.write(expandedContent, encoding);
    return true;
}
 
開發者ID:jenkinsci,項目名稱:run-selector-plugin,代碼行數:12,代碼來源:FileWriteBuilder.java

示例2: parseBuildParams

import hudson.model.AbstractBuild; //導入方法依賴的package包/類
private void parseBuildParams(AbstractBuild<?, ?> build, BuildListener listener) throws IOException, InterruptedException {
    final EnvVars envVars = build.getEnvironment(listener);
    final VariableResolver<String> buildVariableResolver = build.getBuildVariableResolver();

    clearEvaluated();
    evaluatedJaasEndpoint = evaluate(jaasEndpoint, buildVariableResolver, envVars);
    evaluatedTestProjectUrl = evaluate(testProjectUrl, buildVariableResolver, envVars);
    evaluatedEnvId = evaluate(envId, buildVariableResolver, envVars);
    evaluatedLoadScenarioId = evaluate(loadScenarioId, buildVariableResolver, envVars);
    evaluatedTimeout = evaluate(executionStartTimeoutInSeconds, buildVariableResolver, envVars);
}
 
開發者ID:griddynamics,項目名稱:jagger-jaas-jenkins-plugin,代碼行數:12,代碼來源:JaggerTestExecutionBuilder.java

示例3: newTelegramService

import hudson.model.AbstractBuild; //導入方法依賴的package包/類
public TelegramService newTelegramService(AbstractBuild r, BuildListener listener) {


        String authToken = this.authToken;
        if (StringUtils.isEmpty(authToken)) {
            authToken = getDescriptor().getToken();
        }
        String chatId = this.chatId;
        if (StringUtils.isEmpty(chatId)) {
            chatId = getDescriptor().getChatId();
        }

        EnvVars env = null;
        try {
            env = r.getEnvironment(listener);
        } catch (Exception e) {
            listener.getLogger().println("Error retrieving environment vars: " + e.getMessage());
            env = new EnvVars();
        }
        authToken = env.expand(authToken);
        chatId = env.expand(chatId);

        return new StandardTelegramService(authToken, chatId);
    }
 
開發者ID:FluffyFairyGames,項目名稱:jenkins-telegram-plugin,代碼行數:25,代碼來源:TelegramNotifier.java

示例4: setUp

import hudson.model.AbstractBuild; //導入方法依賴的package包/類
/**
 * {@inheritDoc}
 */
@Override
public EphemeralDeployment setUp(AbstractBuild build, Launcher launcher, BuildListener listener)
    throws IOException, InterruptedException {
  EnvVars environment = build.getEnvironment(listener);
  FilePath workspace = requireNonNull(build.getWorkspace());

  try {
    synchronized (deployment) {
      deployment.insert(workspace, environment, listener.getLogger());
    }
  } catch (CloudManagementException e) {
    e.printStackTrace(listener.error(e.getMessage()));
    return null; // Build must be aborted
  }

  return new EphemeralDeployment(environment);
}
 
開發者ID:GoogleCloudPlatform,項目名稱:jenkins-deployment-manager-plugin,代碼行數:21,代碼來源:GoogleCloudManagerBuildWrapper.java

示例5: sendNotificationToSlack

import hudson.model.AbstractBuild; //導入方法依賴的package包/類
private void sendNotificationToSlack(AbstractBuild<?, ?> build, BuildListener listener, String url) throws Exception {
  HttpClient httpClient = HttpClientBuilder.create().build();

  EnvVars envVars = build.getEnvironment(listener);
  Request payload = new Request(Attachment.build(envVars, build.getResult()));

  HttpPost request = new HttpPost(url);
  StringEntity params = new StringEntity(GsonHelper.getCommonParser().toJson(payload));
  request.addHeader("content-type", "application/json");
  request.setEntity(params);

  httpClient.execute(request);
}
 
開發者ID:xmartlabs,項目名稱:BuildSlackNotifier,代碼行數:14,代碼來源:BuildSlackNotifier.java

示例6: consolidateEnvVars

import hudson.model.AbstractBuild; //導入方法依賴的package包/類
protected Map<String, String> consolidateEnvVars(TaskListener listener,
        AbstractBuild<?, ?> build,
        Launcher launcher) {
    // EnvVars extends TreeMap
    TreeMap<String, String> overrides = new TreeMap<String, String>();
    // merge from all potential sources
    if (build != null) {
        try {
            EnvVars buildEnv = build.getEnvironment(listener);
            if (isVerbose())
                listener.getLogger()
                        .println("build env vars:  " + buildEnv);
            overrides.putAll(buildEnv);
        } catch (IOException | InterruptedException e) {
            if (isVerbose())
                e.printStackTrace(listener.getLogger());
        }
    }

    try {
        EnvVars computerEnv = null;
        Computer computer = Computer.currentComputer();
        if (computer != null) {
            computerEnv = computer.getEnvironment();
        } else {
            if (launcher != null)
                computer = launcher.getComputer();
            if (computer != null) {
                computerEnv = computer.getEnvironment();
            }
        }
        if (isVerbose())
            listener.getLogger().println(
                    "computer env vars:  " + computerEnv);
        if (computerEnv != null)
            overrides.putAll(computerEnv);
    } catch (IOException | InterruptedException e2) {
        if (isVerbose())
            e2.printStackTrace(listener.getLogger());
    }

    return overrides;
}
 
開發者ID:openshift,項目名稱:jenkins-client-plugin,代碼行數:44,代碼來源:BaseStep.java

示例7: EnvVariableResolver

import hudson.model.AbstractBuild; //導入方法依賴的package包/類
public EnvVariableResolver(AbstractBuild<?, ?> build, BuildListener listener)
        throws IOException, InterruptedException {
    environment = build.getEnvironment(listener);
    environment.overrideAll(build.getBuildVariables());
}
 
開發者ID:agovindaraju,項目名稱:vmware-vrealize-orchestrator,代碼行數:6,代碼來源:EnvVariableResolver.java


注:本文中的hudson.model.AbstractBuild.getEnvironment方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。