Java Code Examples for hudson.model.Run#isBuilding()
The following examples show how to use
hudson.model.Run#isBuilding() .
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: AnchoreProjectAction.java From anchore-container-scanner-plugin with Apache License 2.0 | 6 votes |
/** * @return the most current AnchoreAction of the associated job */ public AnchoreAction getLastAnchoreAction() { final Run<?,?> tb = this.job.getLastSuccessfulBuild(); Run<?,?> b = this.job.getLastBuild(); while (b != null) { AnchoreAction a = b.getAction(AnchoreAction.class); if (a != null && (!b.isBuilding())) { return a; } if (b == tb) { // no Anchore result available return null; } b = b.getPreviousBuild(); } return null; }
Example 2
Source File: TestResultProjectAction.java From junit-plugin with MIT License | 6 votes |
public AbstractTestResultAction getLastTestResultAction() { final Run<?,?> tb = job.getLastSuccessfulBuild(); Run<?,?> b = job.getLastBuild(); while(b!=null) { AbstractTestResultAction a = b.getAction(AbstractTestResultAction.class); if(a!=null && (!b.isBuilding())) return a; if(b==tb) // if even the last successful build didn't produce the test result, // that means we just don't have any tests configured. return null; b = b.getPreviousBuild(); } return null; }
Example 3
Source File: RocketChatNotifier.java From rocket-chat-notifier with Apache License 2.0 | 5 votes |
public void notify(Run<?, ?> run, TaskListener listener) { if(getDescriptor().getNotifyBuilds()) { String resultMessage = run.isBuilding() ? "STARTED" : run.getResult().toString(); String message = format("%s, %s, %s, %s", run.getParent().getDisplayName(), run.getDisplayName(), resultMessage, run.getBuildStatusSummary().message); chat(message, listener); } if(getDescriptor().getNotifyViews()) { viewTracker.trackViews(run); } else { viewTracker.disable(); } }
Example 4
Source File: ViewTracker.java From rocket-chat-notifier with Apache License 2.0 | 5 votes |
public void trackViews(Run<?, ?> run) { Collection<View> affectedViews = getViewsAffectedBy(run); if (run.isBuilding()) { ensureInitialState(affectedViews); } else { fireDifference(affectedViews); } }
Example 5
Source File: History.java From junit-plugin with MIT License | 5 votes |
public List<TestResult> getList(int start, int end) { List<TestResult> list = new ArrayList<TestResult>(); end = Math.min(end, testObject.getRun().getParent().getBuilds().size()); for (Run<?,?> b: testObject.getRun().getParent().getBuilds().subList(start, end)) { if (b.isBuilding()) continue; TestResult o = testObject.getResultInRun(b); if (o != null) { list.add(o); } } return list; }
Example 6
Source File: BuildStatusAction.java From gitlab-plugin with GNU General Public License v2.0 | 5 votes |
private BuildStatus getStatus(Run<?, ?> build) { if (build == null) { return BuildStatus.NOT_FOUND; } else if (build.isBuilding()) { return BuildStatus.RUNNING; } else if (build.getResult() == Result.ABORTED) { return BuildStatus.CANCELED; } else if (build.getResult() == Result.SUCCESS) { return BuildStatus.SUCCESS; } else if (build.getResult() == Result.UNSTABLE) { return BuildStatus.UNSTABLE; } else { return BuildStatus.FAILED; } }
Example 7
Source File: BuildingPredicate.java From jenkins-build-monitor-plugin with MIT License | 5 votes |
@Override public boolean apply(@Nullable Run<?, ?> run) { if (run == null) { throw new RuntimeException("Run was null"); } return run.isBuilding(); }
Example 8
Source File: AbstractPipelineImpl.java From blueocean-plugin with MIT License | 4 votes |
public boolean apply(Run r) { return r != null && r.isBuilding(); }
Example 9
Source File: HistoryAggregatedFlakyTestResultActionTest.java From flaky-test-handler-plugin with Apache License 2.0 | 4 votes |
@Test public void testAggregate() throws Exception { FreeStyleProject project = jenkins.createFreeStyleProject("project"); List<FlakyTestResultAction> flakyTestResultActions = setUpFlakyTestResultAction(); List<FlakyTestResultAction> flakyTestResultActionList = new ArrayList<FlakyTestResultAction>( flakyTestResultActions); // First non-deflake build Run firstBuild = project .scheduleBuild2(0, flakyTestResultActionList.get(0)).get(); while (firstBuild.isBuilding()) { Thread.sleep(100); } // Second deflake build Run secondBuild = project .scheduleBuild2(0, flakyTestResultActionList.get(1), new CauseAction(new DeflakeCause(firstBuild))).get(); while (secondBuild.isBuilding()) { Thread.sleep(100); } // Third deflake build with HistoryAggregatedFlakyTestResultAction Run thirdBuild = project .scheduleBuild2(0, flakyTestResultActionList.get(2), new HistoryAggregatedFlakyTestResultAction(project)).get(); while (thirdBuild.isBuilding()) { Thread.sleep(100); } HistoryAggregatedFlakyTestResultAction action = thirdBuild .getAction(HistoryAggregatedFlakyTestResultAction.class); action.aggregate(); Map<String, SingleTestFlakyStats> aggregatedFlakyStatsMap = action.getAggregatedFlakyStats(); // Make sure revisions are inserted in the order of their appearance Map<String, SingleTestFlakyStats> revisionMap = action.getAggregatedTestFlakyStatsWithRevision() .get(TEST_ONE); assertArrayEquals("Incorrect revision history", new String[]{REVISION_ONE, REVISION_TWO}, revisionMap.keySet().toArray(new String[revisionMap.size()])); assertEquals("wrong number of entries for flaky stats", 4, aggregatedFlakyStatsMap.size()); SingleTestFlakyStats testOneStats = aggregatedFlakyStatsMap.get(TEST_ONE); SingleTestFlakyStats testTwoStats = aggregatedFlakyStatsMap.get(TEST_TWO); SingleTestFlakyStats testThreeStats = aggregatedFlakyStatsMap.get(TEST_THREE); SingleTestFlakyStats testFourStats = aggregatedFlakyStatsMap.get(TEST_FOUR); assertEquals("wrong number passes", 1, testOneStats.getPass()); assertEquals("wrong number fails", 0, testOneStats.getFail()); assertEquals("wrong number flakes", 1, testOneStats.getFlake()); assertEquals("wrong number passes", 1, testTwoStats.getPass()); assertEquals("wrong number fails", 0, testTwoStats.getFail()); assertEquals("wrong number flakes", 1, testTwoStats.getFlake()); assertEquals("wrong number passes", 0, testThreeStats.getPass()); assertEquals("wrong number fails", 1, testThreeStats.getFail()); assertEquals("wrong number flakes", 1, testThreeStats.getFlake()); assertEquals("wrong number passes", 1, testFourStats.getPass()); assertEquals("wrong number fails", 0, testFourStats.getFail()); assertEquals("wrong number flakes", 1, testFourStats.getFlake()); }
Example 10
Source File: BuildInfo.java From DotCi with MIT License | 4 votes |
public BuildInfo(Run run) { this.timestamp = run.getTimestamp(); this.url = "/" + run.getUrl(); this.name = run.getFullDisplayName(); this.result = run.isBuilding() ? "Building" : run.getResult().toString(); }
Example 11
Source File: ProcessedBuild.java From DotCi with MIT License | 4 votes |
private long getBuildDuration(final Run build) { return build.isBuilding() ? System.currentTimeMillis() - build.getStartTimeInMillis() : build.getDuration(); }
Example 12
Source File: ProcessedBuild.java From DotCi with MIT License | 4 votes |
private boolean isBuildInProgress(final Run run) { return run == null || run.isBuilding(); }