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


Java Run.getResult方法代碼示例

本文整理匯總了Java中hudson.model.Run.getResult方法的典型用法代碼示例。如果您正苦於以下問題:Java Run.getResult方法的具體用法?Java Run.getResult怎麽用?Java Run.getResult使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在hudson.model.Run的用法示例。


在下文中一共展示了Run.getResult方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: markAsUnstableWhenAtRiskThreshold

import hudson.model.Run; //導入方法依賴的package包/類
private void markAsUnstableWhenAtRiskThreshold(int threshold, CodeSceneBuildActionEntry entry, Run<?, ?> build, TaskListener listener) throws IOException {
    if (isMarkBuildAsUnstable() && entry.getHitsRiskThreshold()) {
        String link = HyperlinkNote.encodeTo(entry.getViewUrl().toExternalForm(), String.format("Delta analysis result with risk %d", entry.getRisk().getValue()));
        listener.error("%s hits the risk threshold (%d). Marking build as unstable.", link, threshold);
        Result newResult = Result.UNSTABLE;

        Result result = build.getResult();
        if (result != null) {
            build.setResult(result.combine(newResult));
        } else {
            build.setResult(newResult);
        }
    }
}
 
開發者ID:empear-analytics,項目名稱:codescene-jenkins-plugin,代碼行數:15,代碼來源:CodeSceneBuilder.java

示例2: onCompleted

import hudson.model.Run; //導入方法依賴的package包/類
@Override
public void onCompleted(Run<?, ?> build, @Nonnull TaskListener listener) {
    GitLabSCMHeadMetadataAction metadata = getMetadataAction(build);
    GitLabSCMPublishAction publishAction = build.getParent().getAction(GitLabSCMPublishAction.class);
    if (metadata != null && publishAction != null) {
        publishAction.publishResult(build, metadata);
    }

    if (build.getResult() == SUCCESS) {
        GitLabSCMAcceptMergeRequestAction acceptAction = build.getParent().getAction(GitLabSCMAcceptMergeRequestAction.class);
        if (acceptAction != null) {
            acceptAction.acceptMergeRequest(build, listener);
        }
    }
}
 
開發者ID:Argelbargel,項目名稱:gitlab-branch-source-plugin,代碼行數:16,代碼來源:GitLabSCMRunListener.java

示例3: publishResult

import hudson.model.Run; //導入方法依賴的package包/類
public void publishResult(Run<?, ?> build, GitLabSCMHeadMetadataAction metadata) {
    Result buildResult = build.getResult();
    if ((buildResult == SUCCESS) || ((buildResult == UNSTABLE) && markUnstableAsSuccess)) {
        updateRunningContexts(build, metadata, success);
    } else if (buildResult == ABORTED) {
        updateRunningContexts(build, metadata, canceled);
    } else {
        updateRunningContexts(build, metadata, failed);
    }
}
 
開發者ID:Argelbargel,項目名稱:gitlab-branch-source-plugin,代碼行數:11,代碼來源:GitLabSCMPublishAction.java

示例4: getPreviousUnsuccessfulBuild

import hudson.model.Run; //導入方法依賴的package包/類
private Run getPreviousUnsuccessfulBuild(Run build) {
    Run r = build.getPreviousBuild();
    while (r != null && r.getResult() == Result.SUCCESS)
        r = r.getPreviousBuild();
    return r;
}
 
開發者ID:oliveiragabriel07,項目名稱:redtime,代碼行數:7,代碼來源:RedtimeReportPortlet.java

示例5: sendNotifications

import hudson.model.Run; //導入方法依賴的package包/類
/**
 * Sends notifications to Bitbucket on Checkout (for the "In Progress" Status).
 */
private static void sendNotifications(Run<?, ?> build, TaskListener listener)
        throws IOException, InterruptedException {
    final SCMSource s = SCMSource.SourceByItem.findSource(build.getParent());
    if (!(s instanceof GiteaSCMSource)) {
        return;
    }
    GiteaSCMSource source = (GiteaSCMSource) s;
    if (new GiteaSCMSourceContext(null, SCMHeadObserver.none())
            .withTraits(source.getTraits())
            .notificationsDisabled()) {
        return;
    }
    String url;
    try {
        url = DisplayURLProvider.get().getRunURL(build);
    } catch (IllegalStateException e) {
        listener.getLogger().println(
                "Can not determine Jenkins root URL. Commit status notifications are disabled until a root URL is"
                        + " configured in Jenkins global configuration.");
        return;
    }
    Result result = build.getResult();
    GiteaCommitStatus status = new GiteaCommitStatus();
    status.setTargetUrl(url);
    status.setContext(build.getParent().getFullName());
    if (Result.SUCCESS.equals(result)) {
        status.setDescription("This commit looks good");
        status.setState(GiteaCommitState.SUCCESS);
    } else if (Result.UNSTABLE.equals(result)) {
        status.setDescription("This commit has test failures");
        status.setState(GiteaCommitState.FAILURE);
    } else if (Result.FAILURE.equals(result)) {
        status.setDescription("There was a failure building this commit");
        status.setState(GiteaCommitState.FAILURE);
    } else if (result != null) { // ABORTED etc.
        status.setDescription("Something is wrong with the build of this commit");
        status.setState(GiteaCommitState.ERROR);
    } else {
        status.setDescription("Build started...");
        status.setState(GiteaCommitState.PENDING);
    }

    SCMRevision revision = SCMRevisionAction.getRevision(source, build);
    String hash;
    if (revision instanceof BranchSCMRevision) {
        listener.getLogger().format("[Gitea] Notifying branch build status: %s %s%n",
                status.getState().name(), status.getDescription());
        hash = ((BranchSCMRevision) revision).getHash();
    } else if (revision instanceof PullRequestSCMRevision) {
        listener.getLogger().format("[Gitea] Notifying pull request build status: %s %s%n",
                status.getState().name(), status.getDescription());
        hash = ((PullRequestSCMRevision) revision).getOrigin().getHash();
    } else {
        // TODO tags
        return;
    }
    JobScheduledListener jsl = ExtensionList.lookup(QueueListener.class).get(JobScheduledListener.class);
    if (jsl != null) {
        // we are setting the status, so don't let the queue listener background thread change it to pending
        synchronized (jsl.resolving) {
            jsl.resolving.remove(build.getParent());
        }
    }
    try (GiteaConnection c = source.gitea().open()) {
        c.createCommitStatus(source.getRepoOwner(), source.getRepository(), hash, status);
        listener.getLogger().format("[Gitea] Notified%n");
    }
}
 
開發者ID:jenkinsci,項目名稱:gitea-plugin,代碼行數:72,代碼來源:GiteaNotifier.java


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