本文整理匯總了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());
}