本文整理汇总了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;
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例7: EnvVariableResolver
import hudson.model.AbstractBuild; //导入方法依赖的package包/类
public EnvVariableResolver(AbstractBuild<?, ?> build, BuildListener listener)
throws IOException, InterruptedException {
environment = build.getEnvironment(listener);
environment.overrideAll(build.getBuildVariables());
}