当前位置: 首页>>代码示例>>Java>>正文


Java Result.SUCCESS属性代码示例

本文整理汇总了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;
}
 
开发者ID:maidsafe-archive,项目名称:CI-Jenkins-Plugin,代码行数:24,代码来源:GithubCommitStatusUpdate.java

示例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);
        }
    }
}
 
开发者ID:damienbiggs,项目名称:parameter-pool-plugin,代码行数:16,代码来源:BuildPoolValues.java

示例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());
    }
}
 
开发者ID:uber,项目名称:phabricator-jenkins-plugin,代码行数:17,代码来源:CommentBuilder.java

示例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"));
}
 
开发者ID:uber,项目名称:phabricator-jenkins-plugin,代码行数:20,代码来源:CommentBuilderTest.java

示例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);
	}
}
 
开发者ID:p4paul,项目名称:p4workflow,代码行数:26,代码来源:TagNotifierStep.java

示例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();
}
 
开发者ID:bratchenko,项目名称:jenkins-github-pull-request-comments,代码行数:20,代码来源:GhprcPublishJenkinsUrl.java

示例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";
}
 
开发者ID:xmartlabs,项目名称:BuildSlackNotifier,代码行数:9,代码来源:ResultHelper.java

示例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;
}
 
开发者ID:xmartlabs,项目名称:BuildSlackNotifier,代码行数:8,代码来源:ResultHelper.java

示例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;
}
 
开发者ID:jenkinsci,项目名称:sonar-quality-gates-plugin,代码行数:30,代码来源:QGPublisher.java

示例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;
}
 
开发者ID:Microsoft,项目名称:vsts-jenkins-build-integration-sample,代码行数:12,代码来源:TfsBuildFacadeImpl.java

示例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;
}
 
开发者ID:Microsoft,项目名称:vsts-jenkins-build-integration-sample,代码行数:12,代码来源:TfsBuildFacadeImpl.java

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

    }
}
 
开发者ID:FluffyFairyGames,项目名称:jenkins-telegram-plugin,代码行数:28,代码来源:ActiveNotifier.java

示例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";
    }
}
 
开发者ID:FluffyFairyGames,项目名称:jenkins-telegram-plugin,代码行数:10,代码来源:ActiveNotifier.java

示例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);
}
 
开发者ID:terma,项目名称:github-pr-coverage-status,代码行数:13,代码来源:MasterCoverageAction.java

示例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);
    }
}
 
开发者ID:terma,项目名称:github-pr-coverage-status,代码行数:36,代码来源:CompareCoverageAction.java


注:本文中的hudson.model.Result.SUCCESS属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。