private void endBuild( BuildContext buildContext )
throws TaskExecutionException
{
// return build result to master
BuildResult buildResult = buildContext.getBuildResult();
Map<String, Object> result = new HashMap<String, Object>();
result.put( ContinuumBuildAgentUtil.KEY_PROJECT_ID, buildContext.getProjectId() );
result.put( ContinuumBuildAgentUtil.KEY_BUILD_DEFINITION_ID, buildContext.getBuildDefinitionId() );
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() ) );
result.put( ContinuumBuildAgentUtil.KEY_BUILD_EXIT_CODE, buildResult.getExitCode() );
if ( buildContext.getLatestUpdateDate() != null )
{
result.put( ContinuumBuildAgentUtil.KEY_LATEST_UPDATE_DATE, buildContext.getLatestUpdateDate() );
}
String buildOutput = getBuildOutputText( buildContext.getProjectId() );
if ( buildOutput == null )
{
result.put( ContinuumBuildAgentUtil.KEY_BUILD_OUTPUT, "" );
}
else
{
result.put( ContinuumBuildAgentUtil.KEY_BUILD_OUTPUT, buildOutput );
}
if ( buildResult.getError() != null )
{
result.put( ContinuumBuildAgentUtil.KEY_BUILD_ERROR, buildResult.getError() );
}
else
{
result.put( ContinuumBuildAgentUtil.KEY_BUILD_ERROR, "" );
}