本文整理汇总了Java中org.jenkinsci.plugins.tokenmacro.MacroEvaluationException类的典型用法代码示例。如果您正苦于以下问题:Java MacroEvaluationException类的具体用法?Java MacroEvaluationException怎么用?Java MacroEvaluationException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MacroEvaluationException类属于org.jenkinsci.plugins.tokenmacro包,在下文中一共展示了MacroEvaluationException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: evaluate
import org.jenkinsci.plugins.tokenmacro.MacroEvaluationException; //导入依赖的package包/类
@Override
public String evaluate(AbstractBuild<?, ?> build, TaskListener listener, String macroName) throws MacroEvaluationException, IOException, InterruptedException {
EnforcePublisher enforcePublisher = (EnforcePublisher) build.getProject().getPublishersList().get(EnforcePublisher.DESCRIPTOR);
PieChartData pieChartData = enforcePublisher.getPieChartData(build, listener);
if (null == pieChartData) {
return "";
}
StringBuilder coverageResult = new StringBuilder();
if (pieChartData.coverageDataExists()) {
coverageResult.append("Coverage Result: ");
coverageResult.append(pieChartData.getRoundedPercentage(2));
coverageResult.append("% of code coverage, ");
coverageResult.append(pieChartData.getCoveragePercentStatus());
coverageResult.append(" status.");
}
return coverageResult.toString();
}
示例2: evaluate
import org.jenkinsci.plugins.tokenmacro.MacroEvaluationException; //导入依赖的package包/类
@Override
public String evaluate(AbstractBuild<?, ?> context, TaskListener listener, String macroName)
throws MacroEvaluationException, IOException, InterruptedException {
GhprcCause cause = (GhprcCause) context.getCause(GhprcCause.class);
if (cause == null) {
return "";
}
if (macroName.equals("PR_Title")) {
return cause.getTitle();
} else if (macroName.equals("PR_Email")) {
return cause.getAuthorEmail();
} else {
return "";
}
}
示例3: replacedCopy
import org.jenkinsci.plugins.tokenmacro.MacroEvaluationException; //导入依赖的package包/类
/**
* Copy Factory
*
* @param r replacer
* @return replaced copy
*/
public AWSEBDeploymentConfig replacedCopy(Utils.Replacer r) throws MacroEvaluationException, IOException, InterruptedException {
return new AWSEBDeploymentConfig(
r.r(this.getCredentialId()),
r.r(this.getAwsRegion()),
r.r(this.getApplicationName()),
r.r(this.getEnvironmentName()),
r.r(this.getBucketName()),
r.r(this.getKeyPrefix()),
r.r(this.getVersionLabelFormat()),
r.r(this.getVersionDescriptionFormat()),
r.r(this.getRootObject()),
r.r(this.getIncludes()),
r.r(this.getExcludes()),
this.isZeroDowntime(),
this.getSleepTime(),
this.isCheckHealth(),
this.getMaxAttempts(),
this.credentials
);
}
示例4: evaluate
import org.jenkinsci.plugins.tokenmacro.MacroEvaluationException; //导入依赖的package包/类
@Override
public String evaluate(AbstractBuild<?, ?> build, TaskListener listener, String macroName) throws MacroEvaluationException, IOException, InterruptedException {
AbstractTestResultAction<?> testResultContainer = build.getAction(AbstractTestResultAction.class);
StringBuilder testResult = new StringBuilder();
if (testResultContainer != null) {
String testResultDescription = testResultContainer.getBuildHealth().getDescription();
testResult.append(testResultDescription);
Integer failedUnitTests = testResultContainer.getFailedTests().size();
if (failedUnitTests > 0) {
testResult.append("\nFailures:");
Integer processedUnitTests = 0;
for (TestResult testResultItem : testResultContainer.getFailedTests()) {
testResult.append(Constants.LINE_SEPARATOR).append("\n").append(testResultItem.getFullName());
if ((null != testResultItem.getErrorDetails()) && !testResultItem.getErrorDetails().trim().isEmpty()) {
testResult.append("\n-------- Message --------\n").append(testResultItem.getErrorDetails().trim());
}
if ((null != testResultItem.getStderr()) && !testResultItem.getStderr().trim().isEmpty()) {
testResult.append("\n-------- Stacktrace --------\n").append(testResultItem.getStderr().trim());
}
processedUnitTests++;
if (processedUnitTests.equals(failedUnitTests)) {
testResult.append(Constants.LINE_SEPARATOR);
}
}
}
}
return testResult.toString();
}
示例5: evaluate
import org.jenkinsci.plugins.tokenmacro.MacroEvaluationException; //导入依赖的package包/类
@Override
public String evaluate(AbstractBuild<?, ?> build, TaskListener listener, String macroName) throws MacroEvaluationException, IOException, InterruptedException {
EnforcePublisher enforcePublisher = (EnforcePublisher) build.getProject().getPublishersList().get(EnforcePublisher.DESCRIPTOR);
PieChartData pieChartData = enforcePublisher.getPieChartData(build, listener);
if (null == pieChartData) {
return "";
}
StringBuilder coverageStatus = new StringBuilder();
if (pieChartData.dataExists()) {
coverageStatus.append("Coverage Status: ");
coverageStatus.append(pieChartData.getFileCoverageStatus());
}
return coverageStatus.toString();
}
示例6: evaluate
import org.jenkinsci.plugins.tokenmacro.MacroEvaluationException; //导入依赖的package包/类
@Override
public String evaluate(AbstractBuild<?, ?> context, TaskListener listener, String macroName) throws MacroEvaluationException, IOException, InterruptedException {
if (value == null || regex == null) {
return value == null ? "" : value;
}
Matcher matcher = Pattern.compile(regex).matcher(value);
return matcher.find() ? matcher.group() : value;
}
示例7: expand
import org.jenkinsci.plugins.tokenmacro.MacroEvaluationException; //导入依赖的package包/类
private static String expand(AbstractBuild<?, ?> build, BuildListener listener, String template) {
try {
return TokenMacro.expandAll(build, listener, template, false, null);
} catch (MacroEvaluationException | IOException | InterruptedException mee) {
throw new RuntimeException(mee);
}
}
示例8: expandAllMacros
import org.jenkinsci.plugins.tokenmacro.MacroEvaluationException; //导入依赖的package包/类
public static String expandAllMacros(AbstractBuild<?, ?> context, TaskListener listener,
String stringPerhapsWithMacro) throws
MacroEvaluationException, IOException, InterruptedException {
if (StringUtils.isBlank(stringPerhapsWithMacro)) {
return stringPerhapsWithMacro;
}
int index = stringPerhapsWithMacro.indexOf("${");
if (index == -1) {
return stringPerhapsWithMacro;
}
return TokenMacro.expandAll(context, listener, stringPerhapsWithMacro);
}
示例9: DeploymentInfo
import org.jenkinsci.plugins.tokenmacro.MacroEvaluationException; //导入依赖的package包/类
/**
* Constructor for reading the manifest.yml file.
* Takes an appInfo Map that is created from a ManifestReader.
*/
public DeploymentInfo(AbstractBuild build, TaskListener listener, PrintStream logger, Map<String, Object> appInfo,
String jenkinsBuildName, String defaultDomain, String manifestPath)
throws IOException, ManifestParsingException, InterruptedException, MacroEvaluationException {
readManifestFile(logger, appInfo, jenkinsBuildName, defaultDomain, manifestPath);
expandTokenMacros(build, listener);
}
示例10: expandTokenMacros
import org.jenkinsci.plugins.tokenmacro.MacroEvaluationException; //导入依赖的package包/类
private void expandTokenMacros(AbstractBuild build, TaskListener listener)
throws InterruptedException, MacroEvaluationException, IOException {
this.appName = TokenMacro.expandAll(build, listener, this.appName);
this.hostname = TokenMacro.expandAll(build, listener, this.hostname);
this.appPath = TokenMacro.expandAll(build, listener, this.appPath);
this.buildpack = TokenMacro.expandAll(build, listener, this.buildpack);
this.command = TokenMacro.expandAll(build, listener, this.command);
this.domain = TokenMacro.expandAll(build, listener, this.domain);
Map<String, String> expandedEnvVars = new HashMap<String, String>();
for (String envVarName : this.envVars.keySet()) {
try {
String expandedEnvVarName = TokenMacro.expandAll(build, listener, envVarName);
String expandedEnvVarValue = TokenMacro.expandAll(build, listener, this.envVars.get(envVarName));
expandedEnvVars.put(expandedEnvVarName, expandedEnvVarValue);
} catch (MacroEvaluationException e) {
// If a token exists but isn't recognized, then it's probably an environment variable
// meant for the CF target, so leave it alone.
expandedEnvVars.put(envVarName, this.envVars.get(envVarName));
}
}
this.envVars = expandedEnvVars;
List<String> expandedServicesNames = new ArrayList<String>();
for (String serviceName : this.servicesNames) {
String expandedServiceName = TokenMacro.expandAll(build, listener, serviceName);
expandedServicesNames.add(expandedServiceName);
}
this.servicesNames = expandedServicesNames;
}
示例11: evaluate
import org.jenkinsci.plugins.tokenmacro.MacroEvaluationException; //导入依赖的package包/类
@Override
public String evaluate(AbstractBuild<?, ?> abstractBuild, TaskListener taskListener, String s) throws MacroEvaluationException, IOException, InterruptedException {
Node node = abstractBuild.getBuiltOn();
if( node instanceof DockerTransientNode) {
return ((DockerTransientNode) node).getContainerId();
}
return null;
}
示例12: perform
import org.jenkinsci.plugins.tokenmacro.MacroEvaluationException; //导入依赖的package包/类
@Override
public void perform(hudson.model.Run<?, ?> run, FilePath workspace, Launcher launcher, TaskListener listener) throws InterruptedException, IOException {
List<String> expandedTags;
expandedTags = expandTags(run, workspace, launcher, listener);
String expandedDockerFileDirectory = dockerFileDirectory;
try {
expandedDockerFileDirectory = TokenMacro.expandAll(run, workspace, listener, this.dockerFileDirectory);
} catch (MacroEvaluationException e) {
listener.getLogger().println("Couldn't macro expand docker file directory " + dockerFileDirectory);
}
new Run(run, launcher, listener, new FilePath(workspace, expandedDockerFileDirectory), expandedTags, getCloud(launcher)).run();
}
示例13: expandTags
import org.jenkinsci.plugins.tokenmacro.MacroEvaluationException; //导入依赖的package包/类
private List<String> expandTags(hudson.model.Run<?, ?> build, FilePath workspace, Launcher launcher, TaskListener listener) {
List<String> eTags = new ArrayList<>(tags.size());
for (String tag : tags) {
try {
eTags.add(TokenMacro.expandAll(build, workspace, listener, tag));
} catch (MacroEvaluationException | IOException | InterruptedException e) {
listener.getLogger().println("Couldn't macro expand tag " + tag);
}
}
return eTags;
}
示例14: evaluateMacro
import org.jenkinsci.plugins.tokenmacro.MacroEvaluationException; //导入依赖的package包/类
private String evaluateMacro(Run<?, ?> build, FilePath workspace, TaskListener listener, String value) throws InterruptedException, IOException {
try {
return TokenMacro.expandAll(build, workspace, listener, value);
} catch (MacroEvaluationException e) {
log(listener, String.format("Could not evaluate macro '%s': %s", value, e.getMessage()));
}
return value;
}
示例15: evaluate
import org.jenkinsci.plugins.tokenmacro.MacroEvaluationException; //导入依赖的package包/类
@Override
public String evaluate(AbstractBuild<?, ?> context, TaskListener listener, String macroName)
throws MacroEvaluationException, IOException, InterruptedException {
Map<String, String> env = context.getEnvironment(listener);
if (env.containsKey(NAME)) {
if (stripSnapshot) {
String version = env.get(NAME);
return version.replace("-SNAPSHOT", "");
} else {
return env.get(NAME);
}
}
return "";
}