當前位置: 首頁>>代碼示例>>Java>>正文


Java Result.FAILURE屬性代碼示例

本文整理匯總了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);
    }
}
 
開發者ID:10000TB,項目名稱:Jenkins-Plugin-Examples,代碼行數:19,代碼來源:CatchErrorStep.java

示例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());
    }
}
 
開發者ID:uber,項目名稱:phabricator-jenkins-plugin,代碼行數:17,代碼來源:CommentBuilder.java

示例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;
	}
}
 
開發者ID:testfairy,項目名稱:testfairy-jenkins-plugin,代碼行數:26,代碼來源:TestFairyAndroidRecorder.java

示例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;
	}
}
 
開發者ID:testfairy,項目名稱:testfairy-jenkins-plugin,代碼行數:25,代碼來源:TestFairyIosRecorder.java

示例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";
}
 
開發者ID:xmartlabs,項目名稱:BuildSlackNotifier,代碼行數:9,代碼來源:ResultHelper.java

示例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;
}
 
開發者ID:xmartlabs,項目名稱:BuildSlackNotifier,代碼行數:8,代碼來源:ResultHelper.java

示例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));

    }
}
 
開發者ID:FluffyFairyGames,項目名稱:jenkins-telegram-plugin,代碼行數:28,代碼來源:ActiveNotifier.java

示例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";
    }
}
 
開發者ID:FluffyFairyGames,項目名稱:jenkins-telegram-plugin,代碼行數:10,代碼來源:ActiveNotifier.java

示例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;
    }
}
 
開發者ID:jenkinsci,項目名稱:ontrack-plugin,代碼行數:9,代碼來源:OntrackDSLResult.java

示例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);
    }
}
 
開發者ID:openshift,項目名稱:jenkins-plugin,代碼行數:13,代碼來源:OpenShiftImageStreams.java

示例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));
		}
	}
}
 
開發者ID:jovandeginste,項目名稱:jenkins-mattermost-plugin,代碼行數:31,代碼來源:ActiveNotifier.java

示例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";
	}
}
 
開發者ID:jovandeginste,項目名稱:jenkins-mattermost-plugin,代碼行數:10,代碼來源:ActiveNotifier.java

示例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;
}
 
開發者ID:tanium,項目名稱:pyjenkins,代碼行數:14,代碼來源:PythonFactory.java

示例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;
}
 
開發者ID:jenkinsci,項目名稱:dockerhub-notification-plugin,代碼行數:12,代碼來源:DockerHubCallbackPayload.java

示例15: setup

@Before
public void setup() {
    failure = new RunStub(0, Result.FAILURE, 500L);
    repair = new RunStub(5000L, Result.SUCCESS, 1000L);
}
 
開發者ID:oliveiragabriel07,項目名稱:redtime,代碼行數:5,代碼來源:RedIntervalTest.java


注:本文中的hudson.model.Result.FAILURE屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。