jetbrains.buildServer.agent.BuildFinishedStatus Java Examples
The following examples show how to use
jetbrains.buildServer.agent.BuildFinishedStatus.
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: TryFinallyBuildProcessTest.java From TeamCity.Virtual with Apache License 2.0 | 6 votes |
@Test public void should_not_fail_on_finally_error() { TryFinallyBuildProcessImpl bp = create(); bp.addFinishProcess(new RecordingBuildProcess("finally-1", BuildFinishedStatus.FINISHED_SUCCESS) { { setFinishException(new RunBuildException("ppp")); } }); bp.addFinishProcess(new RecordingBuildProcess("finally-2", BuildFinishedStatus.FINISHED_SUCCESS)); //TODO: error status is not propagated here. //TODO: The only changes is we report error on that from the runner assertRunSuccessfully(bp.asBuildProcess(), BuildFinishedStatus.FINISHED_SUCCESS); assertLog("start-finally-1", "waitFor-finally-1", "error-ppp", "start-finally-2", "waitFor-finally-2"); }
Example #2
Source File: CompositeBuildProcessTest.java From TeamCity.Virtual with Apache License 2.0 | 6 votes |
@Test public void test_interruptCalledForFirst() { final CompositeBuildProcessImpl i = new CompositeBuildProcessImpl(); final List<String> log = new ArrayList<String>(); i.pushBuildProcess(new RecordingBuildProcess("1", BuildFinishedStatus.FINISHED_SUCCESS) { @Override public void start() throws RunBuildException { super.start(); i.interrupt(); } }); i.pushBuildProcess(new RecordingBuildProcess("f", BuildFinishedStatus.FINISHED_SUCCESS)); assertRunSuccessfully(i, BuildFinishedStatus.INTERRUPTED); assertLog("start-1", "interrupt-1", "waitFor-1"); }
Example #3
Source File: CompositeBuildProcessTest.java From TeamCity.Virtual with Apache License 2.0 | 6 votes |
@Test public void test_interruptCalledForFirst_WaitFor() { final CompositeBuildProcessImpl i = new CompositeBuildProcessImpl(); i.pushBuildProcess(new RecordingBuildProcess("1", BuildFinishedStatus.FINISHED_SUCCESS) { @NotNull @Override public BuildFinishedStatus waitFor() throws RunBuildException { i.interrupt(); return super.waitFor(); } }); i.pushBuildProcess(new RecordingBuildProcess("f", BuildFinishedStatus.FINISHED_SUCCESS)); assertRunSuccessfully(i, BuildFinishedStatus.INTERRUPTED); assertLog("start-1", "interrupt-1", "waitFor-1"); }
Example #4
Source File: CompositeBuildProcessTest.java From TeamCity.Virtual with Apache License 2.0 | 6 votes |
@Test public void test_interruptCalledForTwo() { final CompositeBuildProcessImpl i = new CompositeBuildProcessImpl(); i.pushBuildProcess(new RecordingBuildProcess("0", BuildFinishedStatus.FINISHED_SUCCESS)); i.pushBuildProcess(new RecordingBuildProcess("1", BuildFinishedStatus.FINISHED_SUCCESS) { @Override public void start() throws RunBuildException { super.start(); i.interrupt(); } }); i.pushBuildProcess(new RecordingBuildProcess("f", BuildFinishedStatus.FINISHED_SUCCESS)); assertRunSuccessfully(i, BuildFinishedStatus.INTERRUPTED); assertLog("start-0", "waitFor-0", "start-1", "interrupt-1", "waitFor-1"); }
Example #5
Source File: CompositeBuildProcessTest.java From TeamCity.Virtual with Apache License 2.0 | 6 votes |
@Test public void test_interruptCalledForTwo_WaitFor() { final CompositeBuildProcessImpl i = new CompositeBuildProcessImpl(); i.pushBuildProcess(new RecordingBuildProcess("0", BuildFinishedStatus.FINISHED_SUCCESS)); i.pushBuildProcess(new RecordingBuildProcess("1", BuildFinishedStatus.FINISHED_SUCCESS) { @NotNull @Override public BuildFinishedStatus waitFor() throws RunBuildException { i.interrupt(); return super.waitFor(); } }); i.pushBuildProcess(new RecordingBuildProcess("f", BuildFinishedStatus.FINISHED_SUCCESS)); assertRunSuccessfully(i, BuildFinishedStatus.INTERRUPTED); assertLog("start-0", "waitFor-0", "start-1", "interrupt-1", "waitFor-1"); }
Example #6
Source File: DelegatingBuildProcessTest.java From TeamCity.Virtual with Apache License 2.0 | 6 votes |
@Test public void test_interrupted_in_process_start() { final AtomicReference<BuildProcess> bp = new AtomicReference<BuildProcess>(); DelegatingBuildProcess aaa = new DelegatingBuildProcess(new LoggingActionBase(){ @Override protected RecordingBuildProcess createSub() { return new RecordingBuildProcess("i", BuildFinishedStatus.FINISHED_SUCCESS){ @Override public void start() throws RunBuildException { super.start(); bp.get().interrupt(); } }; } }); bp.set(aaa); assertRunSuccessfully(aaa, INTERRUPTED); assertLog("start-impl","start-i","interrupt-i","waitFor-i","finish-impl"); Assert.assertTrue(aaa.isFinished()); Assert.assertTrue(aaa.isInterrupted()); }
Example #7
Source File: DelegatingBuildProcessTest.java From TeamCity.Virtual with Apache License 2.0 | 6 votes |
@Test public void test_interrupted_in_process_finish() { final AtomicReference<BuildProcess> bp = new AtomicReference<BuildProcess>(); DelegatingBuildProcess aaa = new DelegatingBuildProcess(new LoggingActionBase(){ @Override protected RecordingBuildProcess createSub() { return new RecordingBuildProcess("i", BuildFinishedStatus.FINISHED_SUCCESS){ @NotNull @Override public BuildFinishedStatus waitFor() throws RunBuildException { bp.get().interrupt(); return super.waitFor(); } }; } }); bp.set(aaa); assertRunSuccessfully(aaa, INTERRUPTED); assertLog("start-impl","start-i","interrupt-i","waitFor-i","finish-impl"); Assert.assertTrue(aaa.isFinished()); Assert.assertTrue(aaa.isInterrupted()); }
Example #8
Source File: CompositeBuildProcessImpl.java From TeamCity.Virtual with Apache License 2.0 | 6 votes |
@NotNull protected BuildFinishedStatus waitForImpl() throws RunBuildException { if (isInterrupted()) return BuildFinishedStatus.INTERRUPTED; for (BuildProcess proc = myProcessList.poll(); proc != null; proc = myProcessList.poll()) { myCurrentProcess.set(proc); try { proc.start(); final BuildFinishedStatus status = proc.waitFor(); if (status != BuildFinishedStatus.INTERRUPTED && status != BuildFinishedStatus.FINISHED_SUCCESS) return status; } finally { myCurrentProcess.set(null); } if (isInterrupted()) return BuildFinishedStatus.INTERRUPTED; } if (isInterrupted()) return BuildFinishedStatus.INTERRUPTED; return BuildFinishedStatus.FINISHED_SUCCESS; }
Example #9
Source File: DelegatingBuildProcessTest.java From TeamCity.Virtual with Apache License 2.0 | 6 votes |
@Test public void test_interrupted_in_process_finishImpl() { final AtomicReference<BuildProcess> bp = new AtomicReference<BuildProcess>(); DelegatingBuildProcess aaa = new DelegatingBuildProcess(new LoggingAction(BuildFinishedStatus.FINISHED_SUCCESS){ @Override public void finishedImpl() { bp.get().interrupt(); super.finishedImpl(); } }); bp.set(aaa); assertRunSuccessfully(aaa, INTERRUPTED); assertLog("start-impl","start-i","waitFor-i","finish-impl"); Assert.assertTrue(aaa.isFinished()); Assert.assertTrue(aaa.isInterrupted()); }
Example #10
Source File: AnsibleReportArtifatcsProvider.java From tc-ansible-runner with MIT License | 6 votes |
public void beforeBuildFinish(@NotNull final AgentRunningBuild build, @NotNull final BuildFinishedStatus buildStatus) { String tmpDirPath = build.getSharedConfigParameters().get(AnsibleRunnerConstants.ARTIFACTS_TMP_DIR_KEY); if (tmpDirPath == null) { return; } File tmpDir = new File(tmpDirPath); if (tmpDir.exists() && tmpDir.isDirectory()) { File[] rawFiles = tmpDir.listFiles(); if (rawFiles == null || rawFiles.length == 0) { build.getBuildLogger().warning("Build defines ansible-run tmp directory but it doesn't contain any files"); } else { generateReport(build, rawFiles); } } else { build.getBuildLogger().warning("Build defines ansible-run tmp directory but it doesn't exist"); } }
Example #11
Source File: SSHExecProcessAdapter.java From teamcity-deployer-plugin with Apache License 2.0 | 6 votes |
@Override public BuildFinishedStatus runProcess() { JSch.setLogger(new JSchBuildLogger(myLogger)); Session session = null; try { session = myProvider.getSession(); return executeCommand(session, myPty, myCommands); } catch (JSchException e) { logBuildProblem(myLogger, e.getMessage()); LOG.warnAndDebugDetails("Error executing SSH command", e); return BuildFinishedStatus.FINISHED_FAILED; } finally { if (session != null) { session.disconnect(); } } }
Example #12
Source File: DelegatingBuildProcessTest.java From TeamCity.Virtual with Apache License 2.0 | 5 votes |
@Test(dataProvider = "buildFinishStatuses") public void test_with_sub_action(@NotNull BuildFinishedStatus status) { DelegatingBuildProcess aaa = new DelegatingBuildProcess(new LoggingAction(status)); assertRunSuccessfully(aaa, status); assertLog("start-impl", "start-i", "waitFor-i", "finish-impl"); Assert.assertTrue(aaa.isFinished()); }
Example #13
Source File: BuildProcessTestCase.java From TeamCity.Virtual with Apache License 2.0 | 5 votes |
@DataProvider(name = "buildFinishStatuses") public Object[][] buildStatuses() { List<Object[]> list = new ArrayList<Object[]>(); for (BuildFinishedStatus val : BuildFinishedStatus.values()) { list.add(new Object[]{val}); } return list.toArray(new Object[list.size()][]); }
Example #14
Source File: BuildProcessTestCase.java From TeamCity.Virtual with Apache License 2.0 | 5 votes |
protected void assertRunSuccessfully(@NotNull BuildProcess proc, @Nullable BuildFinishedStatus result) { BuildFinishedStatus status = null; try { proc.start(); status = proc.waitFor(); } catch (RunBuildException e) { Assert.fail("Failed with exception " + e); } Assert.assertNotNull(status); if (result != null) { Assert.assertEquals(status, result); } }
Example #15
Source File: TryFinallyBuildProcessTest.java From TeamCity.Virtual with Apache License 2.0 | 5 votes |
@Test public void should_call_finally_normal() { TryFinallyBuildProcessImpl bp = create(); bp.addTryProcess(new RecordingBuildProcess("try-1", BuildFinishedStatus.FINISHED_SUCCESS)); bp.addFinishProcess(new RecordingBuildProcess("finally-1", BuildFinishedStatus.FINISHED_SUCCESS)); assertRunSuccessfully(bp.asBuildProcess(), BuildFinishedStatus.FINISHED_SUCCESS); assertLog("start-try-1", "waitFor-try-1", "start-finally-1", "waitFor-finally-1"); }
Example #16
Source File: CompositeBuildProcessTest.java From TeamCity.Virtual with Apache License 2.0 | 5 votes |
@Test public void test_stopOnStartException() throws RunBuildException { CompositeBuildProcessImpl i = new CompositeBuildProcessImpl(); i.pushBuildProcess(new RecordingBuildProcess("1", BuildFinishedStatus.FINISHED_SUCCESS)); i.pushBuildProcess(new RecordingBuildProcess("2", BuildFinishedStatus.FINISHED_SUCCESS) {{ setStartException(new RunBuildException("aaa")); }}); i.pushBuildProcess(new RecordingBuildProcess("3", BuildFinishedStatus.FINISHED_SUCCESS)); assertRunException(i, "aaa"); assertLog("start-1", "waitFor-1", "start-2"); }
Example #17
Source File: CompositeBuildProcessTest.java From TeamCity.Virtual with Apache License 2.0 | 5 votes |
@Test public void test_emptyInterrupted() { CompositeBuildProcessImpl i = new CompositeBuildProcessImpl(); i.interrupt(); Assert.assertFalse(i.isFinished()); Assert.assertTrue(i.isInterrupted()); assertRunSuccessfully(i, BuildFinishedStatus.INTERRUPTED); Assert.assertTrue(i.isInterrupted()); Assert.assertTrue(i.isFinished()); }
Example #18
Source File: CompositeBuildProcessTest.java From TeamCity.Virtual with Apache License 2.0 | 5 votes |
@Test public void test_stopOnWaitForException() throws RunBuildException { CompositeBuildProcessImpl i = new CompositeBuildProcessImpl(); i.pushBuildProcess(new RecordingBuildProcess("1", BuildFinishedStatus.FINISHED_SUCCESS)); i.pushBuildProcess(new RecordingBuildProcess("2", BuildFinishedStatus.FINISHED_SUCCESS) {{ setFinishException(new RunBuildException("aaa")); }}); i.pushBuildProcess(new RecordingBuildProcess("3", BuildFinishedStatus.FINISHED_SUCCESS)); assertRunException(i, "aaa"); assertLog("start-1", "waitFor-1", "start-2", "waitFor-2"); }
Example #19
Source File: CompositeBuildProcessTest.java From TeamCity.Virtual with Apache License 2.0 | 5 votes |
@Test public void test_stopOnFirstError2() throws RunBuildException { CompositeBuildProcessImpl i = new CompositeBuildProcessImpl(); i.pushBuildProcess(new RecordingBuildProcess("1", BuildFinishedStatus.FINISHED_SUCCESS)); i.pushBuildProcess(new RecordingBuildProcess("2", BuildFinishedStatus.FINISHED_FAILED)); i.pushBuildProcess(new RecordingBuildProcess("3", BuildFinishedStatus.FINISHED_SUCCESS)); assertRunSuccessfully(i, BuildFinishedStatus.FINISHED_FAILED); assertLog("start-1", "waitFor-1", "start-2", "waitFor-2"); }
Example #20
Source File: InterruptibleUploadProcess.java From teamcity-deployer-plugin with Apache License 2.0 | 5 votes |
public InterruptibleUploadProcess(@NotNull final FTPClient client, @NotNull final BuildProgressLogger logger, @NotNull final List<ArtifactsCollection> artifacts, final boolean isAutoType, @NotNull final String path, @NotNull AtomicReference<BuildFinishedStatus> isFinishedSuccessfully) { this.myClient = client; this.myLogger = logger; this.myArtifacts = artifacts; this.myIsAutoType = isAutoType; this.myPath = path; myFinishStatus = isFinishedSuccessfully; }
Example #21
Source File: DeployTestUtils.java From teamcity-deployer-plugin with Apache License 2.0 | 5 votes |
public static void runProcess(final BuildProcess process, final int timeout) throws RunBuildException { process.start(); new WaitFor(timeout) { @Override protected boolean condition() { return process.isFinished(); } }; assertThat(process.isFinished()).describedAs("Failed to finish test in time").isTrue(); assertThat(process.waitFor()).isEqualTo(BuildFinishedStatus.FINISHED_SUCCESS); }
Example #22
Source File: HarbormasterBuildStatus.java From TeamCity-Phabricator-Plugin with MIT License | 5 votes |
public HarbormasterBuildStatus( final AppConfig appConfig, final BuildFinishedStatus buildFinishedStatus ){ this.appConfig = appConfig; this.buildFinishedStatus = buildFinishedStatus; this.gson = new Gson(); }
Example #23
Source File: HarbormasterBuildStatus.java From TeamCity-Phabricator-Plugin with MIT License | 5 votes |
private String parseTeamCityBuildStatus(BuildFinishedStatus buildFinishedStatus){ switch (buildFinishedStatus){ case FINISHED_SUCCESS: return "pass"; case FINISHED_FAILED: case FINISHED_WITH_PROBLEMS: case INTERRUPTED: return "fail"; default: return null; } }
Example #24
Source File: TryFinallyBuildProcessImpl.java From TeamCity.Virtual with Apache License 2.0 | 5 votes |
@Override public void addFinishProcess(@NotNull final BuildProcess proc) { myFinallyProcess.pushBuildProcess(new BuildProcessBase() { @Override public void start() throws RunBuildException { super.start(); catchIt("Finally process failed", new Action() { @Override public void execute() throws RunBuildException { proc.start(); } }); } @NotNull @Override protected BuildFinishedStatus waitForImpl() throws RunBuildException { catchIt("Finally process failed", new Action() { @Override public void execute() throws RunBuildException { proc.waitFor(); } }); return BuildFinishedStatus.FINISHED_SUCCESS; } }); }
Example #25
Source File: BuildProcessBase.java From TeamCity.Virtual with Apache License 2.0 | 5 votes |
@NotNull public final BuildFinishedStatus waitFor() throws RunBuildException { try { if (isInterrupted()) return BuildFinishedStatus.INTERRUPTED; BuildFinishedStatus status = waitForImpl(); if (isInterrupted()) return BuildFinishedStatus.INTERRUPTED; return status; } finally { myIsFinished.set(true); } }
Example #26
Source File: DelegatingBuildProcess.java From TeamCity.Virtual with Apache License 2.0 | 5 votes |
@NotNull @Override protected final BuildFinishedStatus waitForImpl() throws RunBuildException { try { final BuildProcess process = myAction.startImpl(); myReference.set(process); if (isInterrupted()) return BuildFinishedStatus.INTERRUPTED; process.start(); return process.waitFor(); } finally { myReference.set(null); myAction.finishedImpl(); } }
Example #27
Source File: CompositeBuildProcessTest.java From TeamCity.Virtual with Apache License 2.0 | 5 votes |
@Test(dataProvider = "buildFinishStatuses") public void test_one_build_process(BuildFinishedStatus result) throws RunBuildException { CompositeBuildProcessImpl i = new CompositeBuildProcessImpl(); i.pushBuildProcess(new RecordingBuildProcess("1", result)); assertRunSuccessfully(i, result == BuildFinishedStatus.INTERRUPTED ? BuildFinishedStatus.FINISHED_SUCCESS : result); assertLog("start-1", "waitFor-1"); }
Example #28
Source File: CompositeBuildProcessTest.java From TeamCity.Virtual with Apache License 2.0 | 5 votes |
@Test public void test_stopOnFirstError() throws RunBuildException { CompositeBuildProcessImpl i = new CompositeBuildProcessImpl(); i.pushBuildProcess(new RecordingBuildProcess("1", BuildFinishedStatus.FINISHED_FAILED)); i.pushBuildProcess(new RecordingBuildProcess("2", BuildFinishedStatus.FINISHED_SUCCESS)); assertRunSuccessfully(i, BuildFinishedStatus.FINISHED_FAILED); assertLog("start-1", "waitFor-1"); }
Example #29
Source File: SyncBuildProcessAdapter.java From teamcity-deployer-plugin with Apache License 2.0 | 5 votes |
@NotNull @Override public BuildFinishedStatus waitFor() throws RunBuildException { while (!isInterrupted() && !hasFinished) { try { Thread.sleep(1000); } catch (InterruptedException e) { throw new RunBuildException(e); } } return hasFinished ? statusCode : BuildFinishedStatus.INTERRUPTED; }
Example #30
Source File: BuildProcessBase.java From TeamCity.Virtual with Apache License 2.0 | 4 votes |
@NotNull protected abstract BuildFinishedStatus waitForImpl() throws RunBuildException;