Java Code Examples for hudson.model.Run#getNumber()
The following examples show how to use
hudson.model.Run#getNumber() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AnalysisResult.java From warnings-ng-plugin with MIT License | 6 votes |
/** * Creates a new instance of {@link AnalysisResult}. * * @param owner * the current build as owner of this action * @param id * ID of the results * @param report * the issues of this result * @param blames * author and commit information for all issues * @param totals * repository statistics for all issues * @param qualityGateStatus * the quality gate status * @param sizePerOrigin * the number of issues per origin */ public AnalysisResult(final Run<?, ?> owner, final String id, final DeltaReport report, final Blames blames, final RepositoryStatistics totals, final QualityGateStatus qualityGateStatus, final Map<String, Integer> sizePerOrigin) { this(owner, id, report, blames, totals, qualityGateStatus, sizePerOrigin, true); if (report.isEmpty()) { noIssuesSinceBuild = owner.getNumber(); } else { noIssuesSinceBuild = NO_BUILD; } if (this.qualityGateStatus == QualityGateStatus.PASSED) { successfulSinceBuild = owner.getNumber(); } else { successfulSinceBuild = NO_BUILD; } }
Example 2
Source File: InfluxDbNotifier.java From github-autostatus-plugin with MIT License | 6 votes |
private void notifyCoverage(String jobName, @Nullable CodeCoverage coverageInfo, Run<?, ?> run) { if (coverageInfo != null) { String buildUrl = run.getUrl(); int buildNumber = run.getNumber(); Cause cause = run.getCause(Cause.class); String buildCause = cause == null ? BuildNotifierConstants.DEFAULT_STRING : cause.getShortDescription(); String data = config.getSchema().formatCoverage(jobName, repoOwner, repoName, branchName, coverageInfo.getClasses(), coverageInfo.getConditionals(), coverageInfo.getFiles(), coverageInfo.getLines(), coverageInfo.getMethods(), coverageInfo.getPackages(), coverageInfo.getInstructions(), buildUrl, buildNumber, buildCause); postData(data); } }
Example 3
Source File: InfluxDbNotifier.java From github-autostatus-plugin with MIT License | 6 votes |
private void notifyTestResults(String jobName, @Nullable TestResults testResults, Run<?, ?> run) { if (testResults != null) { String buildUrl = run.getUrl(); int buildNumber = run.getNumber(); Cause cause = run.getCause(Cause.class); String buildCause = cause == null ? BuildNotifierConstants.DEFAULT_STRING : cause.getShortDescription(); String data = config.getSchema().formatTests(jobName, repoOwner, repoName, branchName, testResults.getPassedTestCaseCount(), testResults.getSkippedTestCaseCount(), testResults.getFailedTestCaseCount(), buildUrl, buildNumber, buildCause); postData(data); for (TestSuite testSuite : testResults.getTestSuites()) { notifyTestSuite(jobName, testSuite, run); } } }
Example 4
Source File: InfluxDbNotifier.java From github-autostatus-plugin with MIT License | 6 votes |
private String notifyTestCase(String jobName, String suiteName, TestCase testCase, Run<?, ?> run) { String buildUrl = run.getUrl(); int buildNumber = run.getNumber(); Cause cause = run.getCause(Cause.class); String buildCause = cause == null ? BuildNotifierConstants.DEFAULT_STRING : cause.getShortDescription(); String data = config.getSchema().formatTestCase(jobName, repoOwner, repoName, branchName, suiteName, testCase.getName(), testCase.getPassedCount(), testCase.getSkippedCount(), testCase.getFailedCount(), buildUrl, buildNumber, buildCause); return data; }
Example 5
Source File: HttpNotifier.java From github-autostatus-plugin with MIT License | 6 votes |
private BuildStatus constructBuildStatus(BuildStage.State buildState, Map<String, Object> parameters) { Run<?, ?> run = (Run<?, ?>) parameters.get(BuildNotifierConstants.BUILD_OBJECT); String jobName = (String) parameters.getOrDefault(BuildNotifierConstants.JOB_NAME, BuildNotifierConstants.DEFAULT_STRING); long blockedDuration = BuildNotifierConstants.getLong(parameters, BuildNotifierConstants.BLOCKED_DURATION); String buildUrl = run.getUrl(); int buildNumber = run.getNumber(); long buildDuration = BuildNotifierConstants.getLong(parameters, BuildNotifierConstants.JOB_DURATION) - blockedDuration; Cause cause = run.getCause(Cause.class); String buildCause = cause == null ? BuildNotifierConstants.DEFAULT_STRING : cause.getShortDescription(); BuildStatus result = new org.jenkinsci.plugins.githubautostatus.model.BuildStatus(); result.setRepoOwner(repoOwner); result.setRepoName(repoName); result.setJobName(jobName); result.setBranch(branchName); result.setBuildUrl(buildUrl); result.setBuildNumber(buildNumber); result.setTrigger(buildCause); result.setBlocked(blockedDuration > 0); result.setBlockedTime(blockedDuration); result.setDuration(buildDuration); result.setPassed(buildState == BuildStage.State.CompletedSuccess); result.setResult(buildState); result.setTimestamp(Clock.system(TimeZone.getTimeZone("UTC").toZoneId()).millis() / 1000); return result; }
Example 6
Source File: AnalysisResult.java From warnings-ng-plugin with MIT License | 5 votes |
/** * Creates a new instance of {@link AnalysisResult}. * * @param owner * the current build as owner of this action * @param id * ID of the results * @param report * the issues of this result * @param blames * author and commit information for all issues * @param totals * repository statistics for all issues * @param qualityGateStatus * the quality gate status * @param sizePerOrigin * the number of issues per origin * @param previousResult * the analysis result of the previous run */ @SuppressWarnings("checkstyle:ParameterNumber") public AnalysisResult(final Run<?, ?> owner, final String id, final DeltaReport report, final Blames blames, final RepositoryStatistics totals, final QualityGateStatus qualityGateStatus, final Map<String, Integer> sizePerOrigin, final AnalysisResult previousResult) { this(owner, id, report, blames, totals, qualityGateStatus, sizePerOrigin, true); if (report.isEmpty()) { if (previousResult.noIssuesSinceBuild == NO_BUILD) { noIssuesSinceBuild = owner.getNumber(); } else { noIssuesSinceBuild = previousResult.noIssuesSinceBuild; } } else { noIssuesSinceBuild = NO_BUILD; } if (this.qualityGateStatus == QualityGateStatus.PASSED) { if (previousResult.qualityGateStatus == QualityGateStatus.PASSED) { successfulSinceBuild = previousResult.successfulSinceBuild; } else { successfulSinceBuild = owner.getNumber(); } } else { successfulSinceBuild = NO_BUILD; } }
Example 7
Source File: InfluxDbNotifier.java From github-autostatus-plugin with MIT License | 5 votes |
/** * Sends the final build status to InfluxDB. * * @param buildState the new state * @param parameters build parameters */ @Override public void notifyFinalBuildStatus(BuildStage.State buildState, Map<String, Object> parameters) { Run<?, ?> run = (Run<?, ?>) parameters.get(BuildNotifierConstants.BUILD_OBJECT); String jobName = (String) parameters.getOrDefault(BuildNotifierConstants.JOB_NAME, BuildNotifierConstants.DEFAULT_STRING); int passed = buildState == BuildStage.State.CompletedSuccess ? 1 : 0; long blockedDuration = BuildNotifierConstants.getLong(parameters, BuildNotifierConstants.BLOCKED_DURATION); int blocked = blockedDuration > 0 ? 1 : 0; String buildUrl = run.getUrl(); int buildNumber = run.getNumber(); Cause cause = run.getCause(Cause.class); String buildCause = cause == null ? BuildNotifierConstants.DEFAULT_STRING : cause.getShortDescription(); String data = config.getSchema().formatJob(jobName, repoOwner, repoName, branchName, buildState.toString(), blocked, BuildNotifierConstants.getLong(parameters, BuildNotifierConstants.JOB_DURATION) - blockedDuration, blockedDuration, passed, buildUrl, buildNumber, buildCause); postData(data); if (!this.config.getIgnoreSendingTestResultsToInflux()) { notifyTestResults(jobName, (TestResults) parameters.get(BuildNotifierConstants.TEST_CASE_INFO), run); } if (!this.config.getIgnoreSendingTestCoverageToInflux()) { notifyCoverage(jobName, (CodeCoverage) parameters.get(BuildNotifierConstants.COVERAGE_INFO), run); } }
Example 8
Source File: InfluxDbNotifier.java From github-autostatus-plugin with MIT License | 5 votes |
private void notifyTestSuite(String jobName, TestSuite testSuite, Run<?, ?> run) { String suiteName = testSuite.getName(); String buildUrl = run.getUrl(); int buildNumber = run.getNumber(); Cause cause = run.getCause(Cause.class); String buildCause = cause == null ? BuildNotifierConstants.DEFAULT_STRING : cause.getShortDescription(); List<String> testSuiteQuery = new ArrayList<>(); String data = config.getSchema().formatTestSuite(jobName, repoOwner, repoName, branchName, suiteName, testSuite.getDuration(), testSuite.getPassedTestCaseCount(), testSuite.getSkippedTestCaseCount(), testSuite.getFailedTestCaseCount(), buildUrl, buildNumber, buildCause); testSuiteQuery.add(data); for (TestCase testCase : testSuite.getTestCases()) { testSuiteQuery.add(notifyTestCase(jobName, suiteName, testCase, run)); } postData(String.join("\\n", testSuiteQuery)); }
Example 9
Source File: JenkinsBuild.java From warnings-ng-plugin with MIT License | 2 votes |
/** * Creates a new build. * * @param build * the Jenkins build */ public JenkinsBuild(final Run<?, ?> build) { super(build.getNumber(), build.getDisplayName(), (int) (build.getTimeInMillis() / 1000)); }
Example 10
Source File: StaticAnalysisLabelProvider.java From warnings-ng-plugin with MIT License | 2 votes |
/** * Creates a {@link DefaultAgeBuilder} for the specified run and url. * * @param owner * the run to get the age from * @param url * the url to the results * * @return the age builder */ protected DefaultAgeBuilder getAgeBuilder(final Run<?, ?> owner, final String url) { return new DefaultAgeBuilder(owner.getNumber(), url); }