public List<BuildResult> getBuildResultsInSuccessForProject( int projectId, long fromDate ) { List<BuildResult> buildResults = getBuildResultsForProject( projectId, fromDate ); List<BuildResult> results = new ArrayList<BuildResult>(); if ( buildResults != null ) { for ( BuildResult res : buildResults ) { if ( res.getState() == ContinuumProjectState.OK ) { results.add( res ); } } } return results; }
private String getState( Project project, BuildResult build ) { int state = project.getState(); if ( build != null ) { state = build.getState(); } if ( state == ContinuumProjectState.OK ) { return "SUCCESSFUL"; } else if ( state == ContinuumProjectState.FAILED ) { return "FAILURE"; } else if ( state == ContinuumProjectState.ERROR ) { return "ERROR"; } else { log.warn( "Unknown build state " + state + " for project " + project.getId() ); return "ERROR: Unknown build state " + state; } }
private void goalsCompleted( Project project, BuildResult build ) { if ( build.getError() == null ) { out( project, build, "Goals completed. state: " + build.getState() ); } else { out( project, build, "Goals completed." ); } }
private void buildComplete( Project project, BuildResult build ) { if ( build.getError() == null ) { out( project, build, "Build complete. state: " + build.getState() ); } else { out( project, build, "Build complete." ); } }
private void buildComplete( Project project, BuildResult build ) { if ( build.getError() == null ) { out( project, build, "Build complete. state: " + build.getState() ); } else { out( project, build, "Build complete." ); } }
private void goalsCompleted( Project project, BuildResult build ) { if ( build.getError() == null ) { out( project, build, "Goals completed. state: " + build.getState() ); } else { out( project, build, "Goals completed." ); } }
result.put( ContinuumBuildAgentUtil.KEY_TRIGGER, buildContext.getTrigger() ); result.put( ContinuumBuildAgentUtil.KEY_USERNAME, buildContext.getUsername() ); result.put( ContinuumBuildAgentUtil.KEY_BUILD_STATE, buildResult.getState() ); result.put( ContinuumBuildAgentUtil.KEY_START_TIME, Long.toString( buildResult.getStartTime() ) ); result.put( ContinuumBuildAgentUtil.KEY_END_TIME, Long.toString( buildResult.getEndTime() ) );
private String getState( Project project, BuildResult build ) { int state = project.getState(); if ( build != null ) { state = build.getState(); } if ( state == ContinuumProjectState.OK ) { return "SUCCESSFUL"; } else if ( state == ContinuumProjectState.FAILED ) { return "FAILURE"; } else if ( state == ContinuumProjectState.ERROR ) { return "ERROR"; } else { getLogger().warn( "Unknown build state " + state + " for project " + project.getId() ); return "ERROR: Unknown build state " + state; } }
state = build.getState();
/** * Check to see if there was a error while checking out/updating the project * * @throws TaskExecutionException */ private boolean checkScmResult( BuildContext context ) throws TaskExecutionException { ScmResult scmResult = context.getScmResult(); if ( scmResult == null || !scmResult.isSuccess() ) { // scmResult must be converted before storing it because jpox modifies values of all fields to null String error = convertScmResultToError( scmResult ); BuildResult build = makeAndStoreBuildResult( context, error ); try { Project project = context.getProject(); project.setState( build.getState() ); store.updateProject( project ); return false; } catch ( ContinuumStoreException e ) { throw new TaskExecutionException( "Error storing project", e ); } } context.getActionContext().put( AbstractContinuumAction.KEY_UPDATE_SCM_RESULT, scmResult ); return true; }
project.setState( buildResult.getState() );
private String generateMessage( Project project, BuildResult build ) throws ContinuumException { int state = project.getState(); if ( build != null ) { state = build.getState(); } String message; if ( state == ContinuumProjectState.OK ) { message = "BUILD SUCCESSFUL: " + project.getName(); } else if ( state == ContinuumProjectState.FAILED ) { message = "BUILD FAILURE: " + project.getName(); } else if ( state == ContinuumProjectState.ERROR ) { message = "BUILD ERROR: " + project.getName(); } else { getLogger().warn( "Unknown build state " + state + " for project " + project.getId() ); message = "ERROR: Unknown build state " + state + " for " + project.getName() + " project"; } return message + " " + getReportUrl( project, build, configurationService ); }
private String generateMessage( Project project, BuildResult build ) throws ContinuumException { int state = project.getState(); if ( build != null ) { state = build.getState(); } String message; if ( state == ContinuumProjectState.OK ) { message = "BUILD SUCCESSFUL: " + project.getName(); } else if ( state == ContinuumProjectState.FAILED ) { message = "BUILD FAILURE: " + project.getName(); } else if ( state == ContinuumProjectState.ERROR ) { message = "BUILD ERROR: " + project.getName(); } else { getLogger().warn( "Unknown build state " + state + " for project " + project.getId() ); message = "ERROR: Unknown build state " + state + " for " + project.getName() + " project"; } return message + " " + getReportUrl( project, build, configurationService ); }
private String generateMessage( Project project, BuildResult build ) throws ContinuumException { int state = project.getState(); if ( build != null ) { state = build.getState(); } String message; if ( state == ContinuumProjectState.OK ) { message = "BUILD SUCCESSFUL: " + project.getName(); } else if ( state == ContinuumProjectState.FAILED ) { message = "BUILD FAILURE: " + project.getName(); } else if ( state == ContinuumProjectState.ERROR ) { message = "BUILD ERROR: " + project.getName(); } else { getLogger().warn( "Unknown build state " + state + " for project " + project.getId() ); message = "ERROR: Unknown build state " + state + " for " + project.getName() + " project"; } return message + " " + getReportUrl( project, build, configurationService ); }
public void addBuildResult( Project project, BuildResult build ) throws ContinuumStoreException, ContinuumObjectNotFoundException { PersistenceManager pm = getPersistenceManager(); Transaction tx = pm.currentTransaction(); try { tx.begin(); pm.getFetchPlan().addGroup( PROJECT_WITH_BUILDS_FETCH_GROUP ); Object objectId = pm.newObjectIdInstance( Project.class, new Integer( project.getId() ) ); project = (Project) pm.getObjectById( objectId ); build = (BuildResult) makePersistent( pm, build, false ); // TODO: these are in the wrong spot - set them on success (though // currently some depend on latest build being the one in progress) project.setLatestBuildId( build.getId() ); project.setState( build.getState() ); project.addBuildResult( build ); tx.commit(); } finally { rollback( tx ); } }
public void updateBuildResult( BuildResult build ) throws ContinuumStoreException { PersistenceManager pm = getPersistenceManager(); Transaction tx = pm.currentTransaction(); Project project = build.getProject(); try { tx.begin(); if ( !JDOHelper.isDetached( build ) ) { throw new ContinuumStoreException( "Not detached: " + build ); } pm.makePersistent( build ); if ( !JDOHelper.isDetached( project ) ) { throw new ContinuumStoreException( "Not detached: " + project ); } project.setState( build.getState() ); //TODO: Use projectDao pm.makePersistent( project ); tx.commit(); } finally { rollback( tx ); } }
public void updateBuildResult( BuildResult build ) throws ContinuumStoreException { PersistenceManager pm = getPersistenceManager(); Transaction tx = pm.currentTransaction(); Project project = build.getProject(); try { tx.begin(); if ( !JDOHelper.isDetached( build ) ) { throw new ContinuumStoreException( "Not detached: " + build ); } pm.makePersistent( build ); if ( !JDOHelper.isDetached( project ) ) { throw new ContinuumStoreException( "Not detached: " + project ); } project.setState( build.getState() ); pm.makePersistent( project ); tx.commit(); } finally { rollback( tx ); } }
public void addBuildResult( Project project, BuildResult build ) throws ContinuumStoreException { PersistenceManager pm = getPersistenceManager(); Transaction tx = pm.currentTransaction(); try { tx.begin(); pm.getFetchPlan().addGroup( PROJECT_WITH_BUILDS_FETCH_GROUP ); Object objectId = pm.newObjectIdInstance( Project.class, project.getId() ); project = (Project) pm.getObjectById( objectId ); build = (BuildResult) makePersistent( pm, build, false ); // TODO: these are in the wrong spot - set them on success (though // currently some depend on latest build being the one in progress) project.setLatestBuildId( build.getId() ); project.setState( build.getState() ); project.addBuildResult( build ); tx.commit(); } finally { rollback( tx ); } }
context.getProject().setState( build.getState() );
context.getProject().setState( build.getState() );