本文整理汇总了Java中hudson.model.Result.FAILURE属性的典型用法代码示例。如果您正苦于以下问题:Java Result.FAILURE属性的具体用法?Java Result.FAILURE怎么用?Java Result.FAILURE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类hudson.model.Result
的用法示例。
在下文中一共展示了Result.FAILURE属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onFailure
@Override public void onFailure(StepContext context, Throwable t) {
try {
TaskListener listener = context.get(TaskListener.class);
Result r = Result.FAILURE;
if (t instanceof AbortException) {
listener.error(t.getMessage());
} else if (t instanceof FlowInterruptedException) {
FlowInterruptedException fie = (FlowInterruptedException) t;
fie.handle(context.get(Run.class), listener);
r = fie.getResult();
} else {
listener.getLogger().println(Functions.printThrowable(t).trim()); // TODO 2.43+ use Functions.printStackTrace
}
context.get(Run.class).setResult(r);
context.onSuccess(null);
} catch (Exception x) {
context.onFailure(x);
}
}
示例2: 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());
}
}
示例3: perform
@Override
public boolean perform(AbstractBuild build, Launcher launcher, final BuildListener listener) throws InterruptedException, IOException {
if (build.getResult() != null && build.getResult() == Result.FAILURE) {
return false;
}
listener.getLogger().println("TestFairy Advanced Uploader (Android)... v " + Utils.getVersion(getClass()) + ", run on " + getHostName());
try {
EnvVars vars = build.getEnvironment(listener);
String changeLog = Utils.extractChangeLog(vars, build.getChangeSet(), listener.getLogger());
AndroidBuildEnvironment environment = getDescriptor().getEnvironment(launcher);
try {
launcher.getChannel().call(new AndroidRemoteRecorder(listener, this, vars, environment, changeLog));
} catch (Throwable ue) {
throw new TestFairyException(ue.getMessage(), ue);
}
return true;
} catch (TestFairyException e) {
listener.error(e.getMessage() + "\n");
e.printStackTrace(listener.getLogger());
return false;
}
}
示例4: perform
@Override
public boolean perform(AbstractBuild build, Launcher launcher, final BuildListener listener) throws IOException, InterruptedException {
if (build.getResult() != null && build.getResult() == Result.FAILURE) {
return false;
}
listener.getLogger().println("TestFairy iOS/Android Uploader... v " + Utils.getVersion(getClass()) + ", run on " + getHostName());
try {
EnvVars vars = build.getEnvironment(listener);
String changeLog = Utils.extractChangeLog(vars, build.getChangeSet(), listener.getLogger());
try {
launcher.getChannel().call(new IosRemoteRecorder(listener, this, vars, changeLog));
} catch (Throwable ue) {
throw new TestFairyException(ue.getMessage(), ue);
}
return true;
} catch (TestFairyException e) {
listener.error(e.getMessage() + "\n");
e.printStackTrace(listener.getLogger());
return false;
}
}
示例5: 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";
}
示例6: 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;
}
示例7: 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));
}
}
示例8: 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";
}
}
示例9: toJenkinsResult
public static Result toJenkinsResult(Object shellResult) {
if (shellResult instanceof String && !shellResult.equals("")) {
return Result.FAILURE;
} else if (shellResult instanceof Boolean) {
return (Boolean) shellResult ? Result.SUCCESS : Result.FAILURE;
} else {
return Result.SUCCESS;
}
}
示例10: postCheckout
@Override
public void postCheckout(@Nonnull Run<?, ?> build,
@Nonnull Launcher launcher, @Nonnull FilePath workspace,
@Nonnull TaskListener listener) throws IOException,
InterruptedException {
if (build.getResult() == Result.FAILURE) {
EnvVars env = build.getEnvironment(listener);
String msg = String.format(
MessageConstants.SCM_IMAGESTREAM_NOT_FOUND,
getImageStreamName(env), getTag(env));
throw new AbortException(msg);
}
}
示例11: completed
public void completed(AbstractBuild r) {
AbstractProject<?, ?> project = r.getProject();
Result result = r.getResult();
AbstractBuild<?, ?> previousBuild = project.getLastBuild();
if (previousBuild != null) {
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())) {
String expandedCustomMessage = getExpandedCustomMessage(r);
getMattermost(r).publish(getBuildStatusMessage(r, notifier.includeTestSummary(),
notifier.includeCustomAttachmentMessage()), expandedCustomMessage, getBuildColor(r));
if (notifier.getCommitInfoChoice().showAnything()) {
getMattermost(r).publish(getCommitList(r), expandedCustomMessage, getBuildColor(r));
}
}
}
示例12: 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";
}
}
示例13: newPyJenkinsInterpreter
public static PythonInterpreter newPyJenkinsInterpreter(BuildContext context, BuildConfig config) {
PythonInterpreter python = newInterpreter();
python.exec("import pyjenkins");
PyModule pyjenkins = (PyModule) python.get("pyjenkins");
context.listener.getLogger().println("Initializing pyjenkins module");
PyObject ret = pyjenkins.invoke("init", new PyObject[]{ context, config });
if (!ret.equals( new PyBoolean(true))) {
context.listener.fatalError("pyjenkins init did not return true: " + ret);
throw new BuildResultException(Result.FAILURE);
}
return python;
}
示例14: from
public static States from(@Nonnull Result result) {
if (result == Result.SUCCESS) {
return success;
}
if (result == Result.FAILURE) {
return error;
}
if (result == Result.UNSTABLE) {
return failure;
}
return error;
}
示例15: setup
@Before
public void setup() {
failure = new RunStub(0, Result.FAILURE, 500L);
repair = new RunStub(5000L, Result.SUCCESS, 1000L);
}