本文整理汇总了Java中org.kohsuke.github.GHCommitState.FAILURE属性的典型用法代码示例。如果您正苦于以下问题:Java GHCommitState.FAILURE属性的具体用法?Java GHCommitState.FAILURE怎么用?Java GHCommitState.FAILURE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.kohsuke.github.GHCommitState
的用法示例。
在下文中一共展示了GHCommitState.FAILURE属性的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: statusOf
private static GHCommitState statusOf(StageExecution stageExecution) {
if (stageExecution.isSuccessful()) {
return GHCommitState.SUCCESS;
} else if (Iterables.any(stageExecution.getBuilds(), new Predicate<BuildExecution>() {
@Override
public boolean apply(BuildExecution input) {
return input.getBuildState() == BuildState.UNKNOWN;
}
})) {
return GHCommitState.ERROR;
} else {
return GHCommitState.FAILURE;
}
}
示例2: getState
GHCommitState getState(String result) {
result = result == null ? "" : result;
GHCommitState state = GHCommitState.PENDING;
if (result.equalsIgnoreCase("Passed")) {
state = GHCommitState.SUCCESS;
} else if (result.equalsIgnoreCase("Failed")) {
state = GHCommitState.FAILURE;
} else if (result.equalsIgnoreCase("Cancelled")) {
state = GHCommitState.ERROR;
}
return state;
}
示例3: getCommitState
public static GHCommitState getCommitState(final Run<?, ?> run, final GHCommitState unstableAs) {
GHCommitState state;
Result result = run.getResult();
if (isNull(result)) {
LOG.error("{} result is null.", run);
state = GHCommitState.ERROR;
} else if (result.isBetterOrEqualTo(SUCCESS)) {
state = GHCommitState.SUCCESS;
} else if (result.isBetterOrEqualTo(UNSTABLE)) {
state = unstableAs;
} else {
state = GHCommitState.FAILURE;
}
return state;
}
示例4: doFillUnstableAsItems
@SuppressWarnings("UnusedDeclaration")
public ListBoxModel doFillUnstableAsItems() {
ListBoxModel items = new ListBoxModel();
GHCommitState[] results = new GHCommitState[] {GHCommitState.SUCCESS,GHCommitState.ERROR,GHCommitState.FAILURE};
for (GHCommitState nextResult : results) {
String text = StringUtils.capitalize(nextResult.toString().toLowerCase());
items.add(text, nextResult.toString());
if (unstableAs.toString().equals(nextResult)) {
items.get(items.size()-1).selected = true;
}
}
return items;
}
示例5: doFillResultItems
public ListBoxModel doFillResultItems(@QueryParameter String result) {
ListBoxModel items = new ListBoxModel();
GHCommitState[] results = new GHCommitState[] { GHCommitState.SUCCESS, GHCommitState.ERROR, GHCommitState.FAILURE };
for (GHCommitState nextResult : results) {
items.add(nextResult.toString(), nextResult.toString());
if (result.toString().equals(nextResult)) {
items.get(items.size() - 1).selected = true;
}
}
return items;
}
开发者ID:bratchenko,项目名称:jenkins-github-pull-request-comments,代码行数:13,代码来源:GhprcBuildResultMessage.java
示例6: onCompleted
public void onCompleted(AbstractBuild<?, ?> build, TaskListener listener) {
GhprcCause c = Ghprc.getCause(build);
if (c == null) {
return;
}
// remove the BuildData action that we may have added earlier to avoid
// having two of them, and because the one we added isn't correct
// @see GhprcTrigger
BuildData fakeOne = null;
for (BuildData data : build.getActions(BuildData.class)) {
if (data.getLastBuiltRevision() != null && !data.getLastBuiltRevision().getSha1String().equals(c.getCommit())) {
fakeOne = data;
break;
}
}
if (fakeOne != null) {
build.getActions().remove(fakeOne);
}
for (GhprcExtension ext : Ghprc.getJobExtensions(trigger, GhprcCommitStatus.class)) {
if (ext instanceof GhprcCommitStatus) {
try {
((GhprcCommitStatus) ext).onBuildComplete(build, listener, repo.getGitHubRepo());
} catch (GhprcCommitStatusException e) {
repo.commentOnFailure(build, listener, e);
}
}
}
GHCommitState state;
state = Ghprc.getState(build);
commentOnBuildResult(build, listener, c);
// close failed pull request automatically
if (state == GHCommitState.FAILURE && trigger.isAutoCloseFailedPullRequests()) {
closeFailedRequest(listener, c);
}
}
示例7: getState
public static GHCommitState getState(AbstractBuild<?, ?> build) {
GHCommitState state;
if (build.getResult() == Result.SUCCESS) {
state = GHCommitState.SUCCESS;
} else if (build.getResult() == Result.UNSTABLE) {
state = GhprcTrigger.getDscp().getUnstableAs();
} else {
state = GHCommitState.FAILURE;
}
return state;
}
示例8: onCompleted
@Override
public void onCompleted(final DynamicBuild build, final TaskListener listener) {
final String sha1 = build.getSha();
if (sha1 == null) {
return;
}
final GHRepository repository = getGithubRepository(build);
final GHCommitState state;
String msg;
final Result result = build.getResult();
if (result.isBetterOrEqualTo(SUCCESS)) {
state = GHCommitState.SUCCESS;
msg = "Success";
} else if (result.isBetterOrEqualTo(UNSTABLE)) {
state = GHCommitState.FAILURE;
msg = "Unstable";
} else {
state = GHCommitState.FAILURE;
msg = "Failed";
}
if (build.isSkipped()) {
msg += " - Skipped";
}
try {
listener.getLogger().println("setting commit status on Github for " + repository.getHtmlUrl() + "/commit/" + sha1);
repository.createCommitStatus(sha1, state, build.getFullUrl(), msg, getContext(build));
} catch (final Exception e) {
printErrorToBuildConsole(listener, e);
}
}
示例9: perform
@Override
public void perform(@Nonnull Run<?, ?> run, @Nonnull FilePath workspace, @Nonnull Launcher launcher,
@Nonnull TaskListener listener) throws InterruptedException, IOException {
PrintStream listenerLogger = listener.getLogger();
String publishedURL = getTriggerDescriptor().getJenkinsURL();
if (getStatusVerifier() != null && !getStatusVerifier().isRunAllowed(run)) {
return;
}
if (isEmpty(publishedURL)) {
return;
}
GHCommitState state = getCommitState(run, unstableAs);
GitHubPRCause c = ghPRCauseFromRun(run);
String statusMsgValue = getStatusMsg().expandAll(run, listener);
String buildUrl = publishedURL + run.getUrl();
LOGGER.info("Setting status of {} to {} with url {} and message: {}",
c.getHeadSha(), state, buildUrl, statusMsgValue);
// TODO check permissions to write human friendly message
final GitHubPRTrigger trigger = ghPRTriggerFromRun(run);
if (isNull(trigger)) {
listener.error("Can't get trigger for this run! Silently skipping. " +
"TODO implement error handler, like in publishers");
return;
}
try {
trigger.getRemoteRepository().createCommitStatus(c.getHeadSha(), state, buildUrl, statusMsgValue,
run.getParent().getFullName());
} catch (IOException ex) {
if (nonNull(buildMessage)) {
String comment = null;
LOGGER.error("Could not update commit status of the Pull Request on GitHub. ", ex);
if (state == GHCommitState.SUCCESS) {
comment = buildMessage.getSuccessMsg().expandAll(run, listener);
} else if (state == GHCommitState.FAILURE) {
comment = buildMessage.getFailureMsg().expandAll(run, listener);
}
listenerLogger.println("Adding comment...");
LOGGER.info("Adding comment, because: ", ex);
addComment(c.getNumber(), comment, run, listener);
} else {
listenerLogger.println("Could not update commit status of the Pull Request on GitHub." + ex.getMessage());
LOGGER.error("Could not update commit status of the Pull Request on GitHub.", ex);
}
handlePublisherError(run);
}
}