Package org.apache.continuum.buildagent.buildcontext

Examples of org.apache.continuum.buildagent.buildcontext.BuildContext


        }
    }

    public void removeBuildContext( int projectId )
    {
        BuildContext buildContext = getBuildContext( projectId );

        if ( buildContext != null )
        {
            buildContexts.remove( buildContext );
        }
View Full Code Here


        int projectId = buildProjectTask.getProjectId();

        try
        {
            log.info( "Initializing build (projectId={})", projectId );
            BuildContext context = buildContextManager.getBuildContext( projectId );
            initializeBuildContext( context );

            if ( !checkScmResult( context ) )
            {
                return;
            }

            log.info( "Checking if project '{}' should build", context.getProjectName() );
            if ( !shouldBuild( context ) )
            {
                return;
            }

            log.info( "Starting build of {}", context.getProjectName() );
            startBuild( context );

            try
            {
                try
                {
                    performAction( "update-project-from-agent-working-directory", context );
                }
                catch ( TaskExecutionException e )
                {
                    updateBuildResult( context, ContinuumBuildAgentUtil.throwableToString( e ) );

                    //just log the error but don't stop the build from progressing in order not to suppress any build result messages there
                    log.error( "Error executing action update-project-from-agent-working-directory '", e );
                }

                performAction( "execute-agent-builder", context );

                log.info( "Updating build result of project '{}'", context.getProjectName() );
                updateBuildResult( context, null );
            }
            finally
            {
                log.info( "End build of project '{}'", context.getProjectName() );
                endBuild( context );
            }
        }
        catch ( TaskExecutionException e )
        {
View Full Code Here

    private PrepareBuildProjectsTask createPrepareBuildProjectsTask( List<BuildContext> buildContexts )
        throws ContinuumBuildAgentException
    {
        if ( buildContexts != null && buildContexts.size() > 0 )
        {
            BuildContext context = buildContexts.get( 0 );
            return new PrepareBuildProjectsTask( buildContexts, context.getTrigger(), context.getProjectGroupId(),
                                                 context.getScmRootAddress(), context.getScmRootId() );
        }
        else
        {
            log.info( "Nothing to build" );
            return null;
View Full Code Here

            throw new ContinuumBuildAgentException( e.getMessage(), e );
        }

        if ( projectId == currentBuildId )
        {
            BuildContext buildContext = buildContextManager.getBuildContext( projectId );

            result.put( ContinuumBuildAgentUtil.KEY_PROJECT_ID, buildContext.getProjectId() );
            result.put( ContinuumBuildAgentUtil.KEY_BUILD_DEFINITION_ID, buildContext.getBuildDefinitionId() );
            result.put( ContinuumBuildAgentUtil.KEY_TRIGGER, buildContext.getTrigger() );

            BuildResult buildResult = buildContext.getBuildResult();

            if ( buildResult != null )
            {
                if ( buildResult.getStartTime() <= 0 )
                {
                    result.put( ContinuumBuildAgentUtil.KEY_START_TIME,
                                Long.toString( buildContext.getBuildStartTime() ) );
                }
                else
                {
                    result.put( ContinuumBuildAgentUtil.KEY_START_TIME, Long.toString( buildResult.getStartTime() ) );
                }

                if ( buildResult.getError() == null )
                {
                    result.put( ContinuumBuildAgentUtil.KEY_BUILD_ERROR, "" );
                }
                else
                {
                    result.put( ContinuumBuildAgentUtil.KEY_BUILD_ERROR, buildResult.getError() );
                }

                result.put( ContinuumBuildAgentUtil.KEY_BUILD_STATE, buildResult.getState() );
                result.put( ContinuumBuildAgentUtil.KEY_END_TIME, Long.toString( buildResult.getEndTime() ) );
                result.put( ContinuumBuildAgentUtil.KEY_BUILD_EXIT_CODE, buildResult.getExitCode() );
            }
            else
            {
                result.put( ContinuumBuildAgentUtil.KEY_START_TIME, Long.toString( buildContext.getBuildStartTime() ) );
                result.put( ContinuumBuildAgentUtil.KEY_END_TIME, Long.toString( 0 ) );
                result.put( ContinuumBuildAgentUtil.KEY_BUILD_STATE, ContinuumProjectState.BUILDING );
                result.put( ContinuumBuildAgentUtil.KEY_BUILD_ERROR, "" );
                result.put( ContinuumBuildAgentUtil.KEY_BUILD_EXIT_CODE, 0 );
            }
View Full Code Here

    {
        List<BuildContext> buildContext = new ArrayList<BuildContext>();

        for ( Map<String, Object> map : projectsBuildContext )
        {
            BuildContext context = new BuildContext();
            context.setProjectId( ContinuumBuildAgentUtil.getProjectId( map ) );
            context.setProjectVersion( ContinuumBuildAgentUtil.getProjectVersion( map ) );
            context.setBuildDefinitionId( ContinuumBuildAgentUtil.getBuildDefinitionId( map ) );
            context.setBuildFile( ContinuumBuildAgentUtil.getBuildFile( map ) );
            context.setExecutorId( ContinuumBuildAgentUtil.getExecutorId( map ) );
            context.setGoals( ContinuumBuildAgentUtil.getGoals( map ) );
            context.setArguments( ContinuumBuildAgentUtil.getArguments( map ) );
            context.setScmUrl( ContinuumBuildAgentUtil.getScmUrl( map ) );
            context.setScmUsername( ContinuumBuildAgentUtil.getScmUsername( map ) );
            context.setScmPassword( ContinuumBuildAgentUtil.getScmPassword( map ) );
            context.setBuildFresh( ContinuumBuildAgentUtil.isBuildFresh( map ) );
            context.setProjectGroupId( ContinuumBuildAgentUtil.getProjectGroupId( map ) );
            context.setProjectGroupName( ContinuumBuildAgentUtil.getProjectGroupName( map ) );
            context.setScmRootAddress( ContinuumBuildAgentUtil.getScmRootAddress( map ) );
            context.setScmRootId( ContinuumBuildAgentUtil.getScmRootId( map ) );
            context.setProjectName( ContinuumBuildAgentUtil.getProjectName( map ) );
            context.setProjectState( ContinuumBuildAgentUtil.getProjectState( map ) );
            context.setTrigger( ContinuumBuildAgentUtil.getTrigger( map ) );
            context.setLocalRepository( ContinuumBuildAgentUtil.getLocalRepository( map ) );
            context.setBuildNumber( ContinuumBuildAgentUtil.getBuildNumber( map ) );
            context.setOldScmResult( getScmResult( ContinuumBuildAgentUtil.getOldScmChanges( map ) ) );
            context.setLatestUpdateDate( ContinuumBuildAgentUtil.getLatestUpdateDate( map ) );
            context.setBuildAgentUrl( ContinuumBuildAgentUtil.getBuildAgentUrl( map ) );
            context.setMaxExecutionTime( ContinuumBuildAgentUtil.getMaxExecutionTime( map ) );
            context.setBuildDefinitionLabel( ContinuumBuildAgentUtil.getBuildDefinitionLabel( map ) );
            context.setScmTag( ContinuumBuildAgentUtil.getScmTag( map ) );

            buildContext.add( context );
        }

        buildContextManager.addBuildContexts( buildContext );
View Full Code Here

    {
        Map result = new HashMap();

        if ( projectId == getProjectCurrentlyBuilding() )
        {
            BuildContext buildContext = buildContextManager.getBuildContext( projectId );
           
            result.put( ContinuumBuildAgentUtil.KEY_PROJECT_ID, new Integer( buildContext.getProjectId() ) );
            result.put( ContinuumBuildAgentUtil.KEY_BUILD_DEFINITION_ID, new Integer( buildContext.getBuildDefinitionId() ) );
            result.put( ContinuumBuildAgentUtil.KEY_TRIGGER, new Integer( buildContext.getTrigger() ) );

            BuildResult buildResult = buildContext.getBuildResult();

            if ( buildResult != null )
            {
                if ( buildResult.getStartTime() <= 0 )
                {
                    result.put( ContinuumBuildAgentUtil.KEY_START_TIME, new Long( buildContext.getBuildStartTime() ).toString() );
                }
                else
                {
                    result.put( ContinuumBuildAgentUtil.KEY_START_TIME, new Long( buildResult.getStartTime() ).toString() );
                }

                if ( buildResult.getError() == null )
                {
                    result.put( ContinuumBuildAgentUtil.KEY_BUILD_ERROR, "" );
                }
                else
                {
                    result.put( ContinuumBuildAgentUtil.KEY_BUILD_ERROR, buildResult.getError() );
                }

                result.put( ContinuumBuildAgentUtil.KEY_BUILD_STATE, new Integer( buildResult.getState() ) );
                result.put( ContinuumBuildAgentUtil.KEY_END_TIME, new Long( buildResult.getEndTime() ).toString() );
                result.put( ContinuumBuildAgentUtil.KEY_BUILD_EXIT_CODE, buildResult.getExitCode() );
            }
            else
            {
                result.put( ContinuumBuildAgentUtil.KEY_START_TIME, new Long( buildContext.getBuildStartTime() ).toString() );
                result.put( ContinuumBuildAgentUtil.KEY_END_TIME, new Long( 0 ).toString() );
                result.put( ContinuumBuildAgentUtil.KEY_BUILD_STATE, new Integer( ContinuumProjectState.BUILDING ) );
                result.put( ContinuumBuildAgentUtil.KEY_BUILD_ERROR, "" );
                result.put( ContinuumBuildAgentUtil.KEY_BUILD_EXIT_CODE, new Integer( 0 ) );
            }
View Full Code Here

    {
        List<BuildContext> buildContext = new ArrayList<BuildContext>();
       
        for ( Map map : projectsBuildContext )
        {
            BuildContext context = new BuildContext();
            context.setProjectId( ContinuumBuildAgentUtil.getProjectId( map ) );
            context.setProjectVersion( ContinuumBuildAgentUtil.getProjectVersion( map ) );
            context.setBuildDefinitionId( ContinuumBuildAgentUtil.getBuildDefinitionId( map ) );
            context.setBuildFile( ContinuumBuildAgentUtil.getBuildFile( map ) );
            context.setExecutorId( ContinuumBuildAgentUtil.getExecutorId( map ) );
            context.setGoals( ContinuumBuildAgentUtil.getGoals( map ) );
            context.setArguments( ContinuumBuildAgentUtil.getArguments( map ) );
            context.setScmUrl( ContinuumBuildAgentUtil.getScmUrl( map ) );
            context.setScmUsername( ContinuumBuildAgentUtil.getScmUsername( map ) );
            context.setScmPassword( ContinuumBuildAgentUtil.getScmPassword( map ) );
            context.setBuildFresh( ContinuumBuildAgentUtil.isBuildFresh( map ) );
            context.setProjectGroupId( ContinuumBuildAgentUtil.getProjectGroupId( map ) );
            context.setProjectGroupName( ContinuumBuildAgentUtil.getProjectGroupName( map ) );
            context.setScmRootAddress( ContinuumBuildAgentUtil.getScmRootAddress( map ) );
            context.setProjectName( ContinuumBuildAgentUtil.getProjectName( map ) );
            context.setProjectState( ContinuumBuildAgentUtil.getProjectState( map ) );
            context.setTrigger( ContinuumBuildAgentUtil.getTrigger( map ) );
            context.setLocalRepository( ContinuumBuildAgentUtil.getLocalRepository( map ) );
            context.setBuildNumber( ContinuumBuildAgentUtil.getBuildNumber( map ) );
            context.setOldScmResult( getScmResult( ContinuumBuildAgentUtil.getOldScmChanges( map ) ) );
            context.setLatestUpdateDate( ContinuumBuildAgentUtil.getLatestUpdateDate( map ) );
            context.setBuildAgentUrl( ContinuumBuildAgentUtil.getBuildAgentUrl( map ) );
            context.setMaxExecutionTime( ContinuumBuildAgentUtil.getMaxExecutionTime( map ) );

            buildContext.add( context );
        }

        buildContextManager.setBuildContextList( buildContext );
View Full Code Here

    private PrepareBuildProjectsTask createPrepareBuildProjectsTask( List<BuildContext> buildContexts )
        throws ContinuumBuildAgentException
    {
        if ( buildContexts != null && buildContexts.size() > 0 )
        {
            BuildContext context = (BuildContext) buildContexts.get( 0 );
            PrepareBuildProjectsTask task = new PrepareBuildProjectsTask( buildContexts,
                                                                          context.getTrigger(),
                                                                          context.getProjectGroupId(),
                                                                          context.getScmRootAddress() );
            return task;
        }
        else
        {
            log.info( "Nothing to build" );
View Full Code Here

        BuildProjectTask buildProjectTask = (BuildProjectTask) task;

        int projectId = buildProjectTask.getProjectId();

        log.info( "Initializing build" );
        BuildContext context = buildContextManager.getBuildContext( projectId );
        initializeBuildContext( context );

        if ( !checkScmResult( context ) )
        {
            log.info( "Error updating from SCM, not building" );
            return;
        }

        log.info( "Checking if project '" + context.getProjectName() + "' should build" );
        if ( !shouldBuild( context ) )
        {
            return;
        }

        log.info( "Starting build of " + context.getProjectName() );
        startBuild( context );

        try
        {
            Map actionContext = context.getActionContext();

            try
            {
                performAction( "update-project-from-agent-working-directory", context );
            }
View Full Code Here

        throws TaskExecutionException
    {
        Map map = new HashMap();
        map.put( ContinuumBuildAgentUtil.KEY_BUILD_CONTEXTS, buildContexts );

        BuildContext context = new BuildContext();
        context.setActionContext( map );

        performAction( "create-agent-build-project-task", context );
    }
View Full Code Here

TOP

Related Classes of org.apache.continuum.buildagent.buildcontext.BuildContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.