本文整理汇总了Java中hudson.model.Result.SUCCESS属性的典型用法代码示例。如果您正苦于以下问题:Java Result.SUCCESS属性的具体用法?Java Result.SUCCESS怎么用?Java Result.SUCCESS使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类hudson.model.Result
的用法示例。
在下文中一共展示了Result.SUCCESS属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: perform
@Override
public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener)
throws InterruptedException, IOException {
GithubInitializerAction initializerAction;
CommitStatus commitStatusApi;
PrintStream logger;
logger = listener.getLogger();
initializerAction = build.getAction(GithubInitializerAction.class);
if (initializerAction == null) {
logger.println("Pull Requests could not be found. Failed to update commit status in Github");
return true;
}
commitStatusApi = new CommitStatus(initializerAction.getOrgName(), logger,
initializerAction.isTestingMode(), initializerAction.getOauthAccessToken());
if (build.getResult() == Result.SUCCESS) {
commitStatusApi.updateAll(initializerAction.getPullRequests(),
State.SUCCESS, build.getUrl());
} else {
commitStatusApi.updateAll(initializerAction.getPullRequests(),
State.FAILURE, build.getUrl(), initializerAction.getFailureReason());
}
return true;
}
示例2: addPoolValue
public void addPoolValue(Result buildResult, String poolValue) {
allValues.add(poolValue);
if (buildResult == Result.NOT_BUILT) {
valuesFromRunningBuilds.add(poolValue);
valuesFromFunctionalBuilds.remove(poolValue);
valuesFromFailedBuilds.remove(poolValue);
} else if (buildResult == Result.SUCCESS || buildResult == Result.UNSTABLE) {
if (!valuesFromFailedBuilds.contains(poolValue) && !valuesFromRunningBuilds.contains(poolValue)) {
valuesFromFunctionalBuilds.add(poolValue);
}
} else {
if (!valuesFromFunctionalBuilds.contains(poolValue) && !valuesFromRunningBuilds.contains(poolValue)) {
valuesFromFailedBuilds.add(poolValue);
}
}
}
示例3: processBuildResult
void processBuildResult(boolean commentOnSuccess, boolean commentWithConsoleLinkOnFailure, boolean runHarbormaster) {
if (result == Result.SUCCESS) {
if (comment.length() == 0 && (commentOnSuccess || !runHarbormaster)) {
comment.append("Build is green");
}
} else if (result == Result.UNSTABLE) {
comment.append("Build is unstable");
} else if (result == Result.FAILURE) {
if (!runHarbormaster || commentWithConsoleLinkOnFailure) {
comment.append("Build has FAILED");
}
} else if (result == Result.ABORTED) {
comment.append("Build was aborted");
} else {
logger.info(UBERALLS_TAG, "Unknown build status " + result.toString());
}
}
示例4: testProcessWithoutCoverageCheckSettings
@Test
public void testProcessWithoutCoverageCheckSettings() {
CommentBuilder commenter = new CommentBuilder(
logger,
Result.SUCCESS,
TestUtils.getCoverageResult(100.0f, 100.0f, 100.0f, 100.0f, 50.0f), // 50% drop
FAKE_BUILD_URL,
false,
null // coverageCheckSettings
);
boolean passCoverage = commenter.processParentCoverage(TestUtils.getDefaultCodeCoverageMetrics(),
TestUtils.TEST_SHA, FAKE_BRANCH_NAME);
String comment = commenter.getComment();
// Should not fail if we don't have coverageCheckSettings.
assertTrue(passCoverage);
assertThat(comment, containsString("decreased (-50.000%)"));
assertFalse(comment.contains("Build failed because coverage is lower"));
}
示例5: perform
@Override
public void perform(Run<?, ?> run, FilePath workspace, Launcher launcher,
TaskListener listener) throws InterruptedException, IOException {
// return early if label not required
if (onlyOnSuccess && run.getResult() != Result.SUCCESS) {
return;
}
try {
// Expand label name and description
EnvVars env = run.getEnvironment(listener);
Expand expand = new Expand(env);
String name = expand.format(rawLabelName, false);
String description = expand.format(rawLabelDesc, false);
// Get TagAction and check for promoted builds
TagAction tagAction = getTagAction(env, run);
// Label with TagAction
tagAction.labelBuild(listener, name, description, workspace);
} catch (Exception e) {
final String err = "P4: Could not label: " + e;
log(err);
throw new AbortException(err);
}
}
示例6: generateCustomizedMessage
private String generateCustomizedMessage(AbstractBuild<?, ?> build) {
GhprcTrigger trigger = Ghprc.extractTrigger(build);
if (trigger == null) {
return "";
}
JobConfiguration jobConfiguration = JobConfiguration.builder()
.printStackTrace(trigger.isDisplayBuildErrorsOnDownstreamBuilds()).build();
GhprcBuildManager buildManager = GhprcBuildManagerFactoryUtil.getBuildManager(build, jobConfiguration);
StringBuilder sb = new StringBuilder();
sb.append(buildManager.calculateBuildUrl(publishedURL));
if (build.getResult() != Result.SUCCESS) {
sb.append(buildManager.getTestResults());
}
return sb.toString();
}
示例7: getTitle
public static String getTitle(Result result, String jobName) {
String base = "[" + jobName + "] ";
if (result == Result.SUCCESS) {
return base + "Successfully built";
} else if (result == Result.FAILURE) {
return base + "Failed to build";
}
return "The build completed with some errors, but it wasn't marked as failed";
}
示例8: toAttachmentType
public static AttachmentType toAttachmentType(Result result) {
if (result == Result.SUCCESS) {
return AttachmentType.GOOD;
} else if (result == Result.FAILURE) {
return AttachmentType.DANGER;
}
return AttachmentType.WARNING;
}
示例9: perform
@Override
public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) {
Result result = build.getResult();
if (Result.SUCCESS != result) {
listener.getLogger().println("Previous steps failed the build.\nResult is: " + result);
return false;
}
boolean buildPassed;
try {
JobConfigData checkedJobConfigData = jobConfigurationService.checkProjectKeyIfVariable(jobConfigData, build, listener);
buildPassed = buildDecision.getStatus(globalConfigDataForSonarInstance, checkedJobConfigData, listener);
if ("".equals(jobConfigData.getSonarInstanceName())) {
listener.getLogger().println(JobExecutionService.DEFAULT_CONFIGURATION_WARNING);
}
listener.getLogger().println("PostBuild-Step: Quality Gates plugin build passed: " + String.valueOf(buildPassed).toUpperCase());
return buildPassed;
} catch (QGException e) {
e.printStackTrace(listener.getLogger());
}
return false;
}
示例10: convertToTfsBuildResult
private BuildResult convertToTfsBuildResult(Result jenkinsResult) {
if (jenkinsResult == Result.SUCCESS) {
return BuildResult.SUCCEEDED;
}
if (jenkinsBuild.getResult() == Result.ABORTED) {
return BuildResult.CANCELED;
}
// Assume FAILURE (and other cases that aren't successful)
return BuildResult.FAILED;
}
示例11: convertToTfsTaskResult
private TaskResult convertToTfsTaskResult(Result jenkinsResult) {
if (jenkinsResult == Result.SUCCESS) {
return TaskResult.SUCCEEDED;
}
if (jenkinsBuild.getResult() == Result.ABORTED) {
return TaskResult.CANCELED;
}
// Assume FAILURE (and other cases that aren't successful)
return TaskResult.FAILED;
}
示例12: completed
public void completed(AbstractBuild r) {
AbstractProject<?, ?> project = r.getProject();
if(project == null) return;
Result result = r.getResult();
AbstractBuild<?, ?> previousBuild = project.getLastBuild();
if(previousBuild == null) return;
do {
previousBuild = previousBuild.getPreviousCompletedBuild();
} while (previousBuild != null && previousBuild.getResult() == Result.ABORTED);
Result previousResult = (previousBuild != null) ? previousBuild.getResult() : Result.SUCCESS;
if ((result == Result.ABORTED && notifier.getNotifyAborted())
|| (result == Result.FAILURE //notify only on single failed build
&& previousResult != Result.FAILURE
&& notifier.getNotifyFailure())
|| (result == Result.FAILURE //notify only on repeated failures
&& previousResult == Result.FAILURE
&& notifier.getNotifyRepeatedFailure())
|| (result == Result.NOT_BUILT && notifier.getNotifyNotBuilt())
|| (result == Result.SUCCESS
&& (previousResult == Result.FAILURE || previousResult == Result.UNSTABLE)
&& notifier.getNotifyBackToNormal())
|| (result == Result.SUCCESS && notifier.getNotifySuccess())
|| (result == Result.UNSTABLE && notifier.getNotifyUnstable())) {
getTelegram(r).publish(getBuildStatusMessage(r, notifier.includeTestSummary(),
notifier.getIncludeFailedTests(),notifier.includeCustomMessage()), getBuildColor(r));
}
}
示例13: getBuildColor
static String getBuildColor(AbstractBuild r) {
Result result = r.getResult();
if (result == Result.SUCCESS) {
return "good";
} else if (result == Result.FAILURE) {
return "danger";
} else {
return "warning";
}
}
示例14: perform
@SuppressWarnings("NullableProblems")
@Override
public void perform(final Run build, final FilePath workspace, final Launcher launcher,
final TaskListener listener) throws InterruptedException, IOException {
if (build.getResult() != Result.SUCCESS) return;
final PrintStream buildLog = listener.getLogger();
final String gitUrl = Utils.getGitUrl(build, listener);
final float masterCoverage = ServiceRegistry.getCoverageRepository().get(workspace);
buildLog.println("Master coverage " + Percent.toWholeString(masterCoverage));
Configuration.setMasterCoverage(gitUrl, masterCoverage);
}
示例15: perform
@SuppressWarnings("NullableProblems")
@Override
public void perform(
final Run build, final FilePath workspace, final Launcher launcher,
final TaskListener listener) throws InterruptedException, IOException {
if (build.getResult() != Result.SUCCESS) return;
final PrintStream buildLog = listener.getLogger();
final String gitUrl = Utils.getGitUrl(build, listener);
final Integer prId = Utils.gitPrId(build, listener);
if (prId == null) {
throw new UnsupportedOperationException(
"Can't find " + Utils.GIT_PR_ID_ENV_PROPERTY + " please use " +
"https://wiki.jenkins-ci.org/display/JENKINS/GitHub+pull+request+builder+plugin" +
"to trigger build!");
}
final float masterCoverage = ServiceRegistry.getMasterCoverageRepository().get(gitUrl);
final float coverage = ServiceRegistry.getCoverageRepository().get(workspace);
final Message message = new Message(coverage, masterCoverage);
buildLog.println(message.forConsole());
final String buildUrl = Utils.getBuildUrl(build, listener);
String jenkinsUrl = ServiceRegistry.getSettingsRepository().getJenkinsUrl();
if (jenkinsUrl == null) jenkinsUrl = Utils.getJenkinsUrlFromBuildUrl(buildUrl);
try {
ServiceRegistry.getPullRequestRepository().comment(gitUrl, prId, message.forComment(buildUrl, jenkinsUrl));
} catch (IOException ex) {
listener.error("Couldn't add comment to pull request #" + prId + "!", ex);
}
}