continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From batkin...@apache.org
Subject svn commit: r1662631 - in /continuum/trunk: continuum-api/src/main/java/org/apache/continuum/builder/distributed/ continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/manager/ continuum-buildagent/continuum-build...
Date Fri, 27 Feb 2015 03:46:45 GMT
Author: batkinson
Date: Fri Feb 27 03:46:44 2015
New Revision: 1662631

URL: http://svn.apache.org/r1662631
Log:
Changed build agent api to support unambiguous build start.

Modified:
    continuum/trunk/continuum-api/src/main/java/org/apache/continuum/builder/distributed/DistributedBuildService.java
    continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/manager/BuildAgentManager.java
    continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/manager/DefaultBuildAgentManager.java
    continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/taskqueue/execution/BuildProjectTaskExecutor.java
    continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/test/java/org/apache/continuum/buildagent/taskqueue/execution/BuildProjectTaskExecutorTest.java
    continuum/trunk/continuum-core/src/main/java/org/apache/continuum/builder/distributed/DefaultDistributedBuildService.java
    continuum/trunk/continuum-distributed/continuum-distributed-master/continuum-distributed-master-api/src/main/java/org/apache/continuum/distributed/transport/master/MasterBuildAgentTransportService.java
    continuum/trunk/continuum-distributed/continuum-distributed-master/continuum-distributed-master-client/src/main/java/org/apache/continuum/distributed/transport/master/MasterBuildAgentTransportClient.java
    continuum/trunk/continuum-distributed/continuum-distributed-master/continuum-distributed-master-server/src/main/java/org/apache/continuum/distributed/transport/master/MasterBuildAgentTransportServer.java

Modified: continuum/trunk/continuum-api/src/main/java/org/apache/continuum/builder/distributed/DistributedBuildService.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-api/src/main/java/org/apache/continuum/builder/distributed/DistributedBuildService.java?rev=1662631&r1=1662630&r2=1662631&view=diff
==============================================================================
--- continuum/trunk/continuum-api/src/main/java/org/apache/continuum/builder/distributed/DistributedBuildService.java
(original)
+++ continuum/trunk/continuum-api/src/main/java/org/apache/continuum/builder/distributed/DistributedBuildService.java
Fri Feb 27 03:46:44 2015
@@ -35,7 +35,7 @@ public interface DistributedBuildService
     void startPrepareBuild( Map<String, Object> context )
         throws ContinuumException;
 
-    void startProjectBuild( int projectId )
+    void startProjectBuild( int projectId, int buildDefinitionId )
         throws ContinuumException;
 
     void updateBuildResult( Map<String, Object> context )

Modified: continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/manager/BuildAgentManager.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/manager/BuildAgentManager.java?rev=1662631&r1=1662630&r2=1662631&view=diff
==============================================================================
--- continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/manager/BuildAgentManager.java
(original)
+++ continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/manager/BuildAgentManager.java
Fri Feb 27 03:46:44 2015
@@ -30,7 +30,7 @@ public interface BuildAgentManager
     void returnBuildResult( Map<String, Object> result )
         throws ContinuumException;
 
-    void startProjectBuild( int projectId )
+    void startProjectBuild( int projectId, int buildDefinition )
         throws ContinuumException;
 
     Map<String, String> getEnvironments( int buildDefinitionId, String installationType
)

Modified: continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/manager/DefaultBuildAgentManager.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/manager/DefaultBuildAgentManager.java?rev=1662631&r1=1662630&r2=1662631&view=diff
==============================================================================
--- continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/manager/DefaultBuildAgentManager.java
(original)
+++ continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/manager/DefaultBuildAgentManager.java
Fri Feb 27 03:46:44 2015
@@ -47,14 +47,14 @@ public class DefaultBuildAgentManager
     @Requirement
     private BuildContextManager buildContextManager;
 
-    public void startProjectBuild( int projectId )
+    public void startProjectBuild( int projectId, int buildDefinition )
         throws ContinuumException
     {
         try
         {
             MasterBuildAgentTransportClient client = new MasterBuildAgentTransportClient(
new URL(
                 buildAgentConfigurationService.getContinuumServerUrl() ) );
-            client.startProjectBuild( projectId, getBuildAgentUrl( projectId ) );
+            client.startProjectBuild( projectId, buildDefinition, getBuildAgentUrl( projectId
) );
         }
         catch ( MalformedURLException e )
         {

Modified: continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/taskqueue/execution/BuildProjectTaskExecutor.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/taskqueue/execution/BuildProjectTaskExecutor.java?rev=1662631&r1=1662630&r2=1662631&view=diff
==============================================================================
--- continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/taskqueue/execution/BuildProjectTaskExecutor.java
(original)
+++ continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/taskqueue/execution/BuildProjectTaskExecutor.java
Fri Feb 27 03:46:44 2015
@@ -209,7 +209,7 @@ public class BuildProjectTaskExecutor
     {
         try
         {
-            buildAgentManager.startProjectBuild( buildContext.getProjectId() );
+            buildAgentManager.startProjectBuild( buildContext.getProjectId(), buildContext.getBuildDefinitionId()
);
         }
         catch ( ContinuumException e )
         {

Modified: continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/test/java/org/apache/continuum/buildagent/taskqueue/execution/BuildProjectTaskExecutorTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/test/java/org/apache/continuum/buildagent/taskqueue/execution/BuildProjectTaskExecutorTest.java?rev=1662631&r1=1662630&r2=1662631&view=diff
==============================================================================
--- continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/test/java/org/apache/continuum/buildagent/taskqueue/execution/BuildProjectTaskExecutorTest.java
(original)
+++ continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/test/java/org/apache/continuum/buildagent/taskqueue/execution/BuildProjectTaskExecutorTest.java
Fri Feb 27 03:46:44 2015
@@ -196,7 +196,7 @@ public class BuildProjectTaskExecutorTes
     private void assertBuilt()
         throws ContinuumException
     {
-        verify( buildAgentManager ).startProjectBuild( 1 );
+        verify( buildAgentManager ).startProjectBuild( 1, 1 );
         verify( buildAgentManager ).returnBuildResult( anyMap() );
         verify( buildContextManager ).removeBuildContext( 1 );
     }

Modified: continuum/trunk/continuum-core/src/main/java/org/apache/continuum/builder/distributed/DefaultDistributedBuildService.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/main/java/org/apache/continuum/builder/distributed/DefaultDistributedBuildService.java?rev=1662631&r1=1662630&r2=1662631&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/main/java/org/apache/continuum/builder/distributed/DefaultDistributedBuildService.java
(original)
+++ continuum/trunk/continuum-core/src/main/java/org/apache/continuum/builder/distributed/DefaultDistributedBuildService.java
Fri Feb 27 03:46:44 2015
@@ -246,7 +246,7 @@ public class DefaultDistributedBuildServ
         }
     }
 
-    public void startProjectBuild( int projectId )
+    public void startProjectBuild( int projectId, int buildDefinitionId )
         throws ContinuumException
     {
         try
@@ -256,10 +256,21 @@ public class DefaultDistributedBuildServ
             project.setState( ContinuumProjectState.BUILDING );
             projectDao.updateProject( project );
 
-            // Should actually use current run summary, only the tuple (project, buildDef)
is unique
-            BuildResult result = buildResultDao.getBuildResult( project.getLatestBuildId()
);
-            result.setState( ContinuumProjectState.BUILDING );
-            buildResultDao.updateBuildResult( result );
+            try
+            {
+                int existingResultId =
+                    distributedBuildManager.getCurrentRun( projectId, buildDefinitionId ).getBuildResultId();
+                if ( existingResultId > 0 )
+                {
+                    BuildResult result = buildResultDao.getBuildResult( project.getLatestBuildId()
);
+                    result.setState( ContinuumProjectState.BUILDING );
+                    buildResultDao.updateBuildResult( result );
+                }
+            }
+            catch ( ContinuumException e )
+            {
+                log.warn( "failed to update result status to 'building': {}", e.getMessage()
);
+            }
         }
         catch ( ContinuumStoreException e )
         {

Modified: continuum/trunk/continuum-distributed/continuum-distributed-master/continuum-distributed-master-api/src/main/java/org/apache/continuum/distributed/transport/master/MasterBuildAgentTransportService.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-distributed/continuum-distributed-master/continuum-distributed-master-api/src/main/java/org/apache/continuum/distributed/transport/master/MasterBuildAgentTransportService.java?rev=1662631&r1=1662630&r2=1662631&view=diff
==============================================================================
--- continuum/trunk/continuum-distributed/continuum-distributed-master/continuum-distributed-master-api/src/main/java/org/apache/continuum/distributed/transport/master/MasterBuildAgentTransportService.java
(original)
+++ continuum/trunk/continuum-distributed/continuum-distributed-master/continuum-distributed-master-api/src/main/java/org/apache/continuum/distributed/transport/master/MasterBuildAgentTransportService.java
Fri Feb 27 03:46:44 2015
@@ -32,7 +32,7 @@ public interface MasterBuildAgentTranspo
     public Boolean returnBuildResult( Map<String, Object> buildResult, String buildAgentUrl
)
         throws Exception;
 
-    public Boolean startProjectBuild( Integer projectId, String buildAgentUrl )
+    public Boolean startProjectBuild( Integer projectId, Integer buildDefinitionId, String
buildAgentUrl )
         throws Exception;
 
     public Boolean prepareBuildFinished( Map<String, Object> prepareBuildResult, String
buildAgentUrl )

Modified: continuum/trunk/continuum-distributed/continuum-distributed-master/continuum-distributed-master-client/src/main/java/org/apache/continuum/distributed/transport/master/MasterBuildAgentTransportClient.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-distributed/continuum-distributed-master/continuum-distributed-master-client/src/main/java/org/apache/continuum/distributed/transport/master/MasterBuildAgentTransportClient.java?rev=1662631&r1=1662630&r2=1662631&view=diff
==============================================================================
--- continuum/trunk/continuum-distributed/continuum-distributed-master/continuum-distributed-master-client/src/main/java/org/apache/continuum/distributed/transport/master/MasterBuildAgentTransportClient.java
(original)
+++ continuum/trunk/continuum-distributed/continuum-distributed-master/continuum-distributed-master-client/src/main/java/org/apache/continuum/distributed/transport/master/MasterBuildAgentTransportClient.java
Fri Feb 27 03:46:44 2015
@@ -141,15 +141,15 @@ public class MasterBuildAgentTransportCl
         return result;
     }
 
-    public Boolean startProjectBuild( Integer projectId, String buildAgentUrl )
+    public Boolean startProjectBuild( Integer projectId, Integer buildDefinitionId, String
buildAgentUrl )
         throws Exception
     {
         Boolean result;
 
         try
         {
-            result = master.startProjectBuild( projectId, buildAgentUrl );
-            log.info( "Start project {} build", projectId );
+            result = master.startProjectBuild( projectId, buildDefinitionId, buildAgentUrl
);
+            log.info( "Start project {}, buildDef {} build", projectId, buildDefinitionId
);
         }
         catch ( Exception e )
         {

Modified: continuum/trunk/continuum-distributed/continuum-distributed-master/continuum-distributed-master-server/src/main/java/org/apache/continuum/distributed/transport/master/MasterBuildAgentTransportServer.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-distributed/continuum-distributed-master/continuum-distributed-master-server/src/main/java/org/apache/continuum/distributed/transport/master/MasterBuildAgentTransportServer.java?rev=1662631&r1=1662630&r2=1662631&view=diff
==============================================================================
--- continuum/trunk/continuum-distributed/continuum-distributed-master/continuum-distributed-master-server/src/main/java/org/apache/continuum/distributed/transport/master/MasterBuildAgentTransportServer.java
(original)
+++ continuum/trunk/continuum-distributed/continuum-distributed-master/continuum-distributed-master-server/src/main/java/org/apache/continuum/distributed/transport/master/MasterBuildAgentTransportServer.java
Fri Feb 27 03:46:44 2015
@@ -67,11 +67,12 @@ public class MasterBuildAgentTransportSe
         return Boolean.TRUE;
     }
 
-    public Boolean startProjectBuild( Integer projectId, String buildAgentUrl )
+    public Boolean startProjectBuild( Integer projectId, Integer buildDefinitionId, String
buildAgentUrl )
         throws Exception
     {
-        distributedBuildService.startProjectBuild( projectId );
-        log.info( "Start building project (projectId={}) in build agent {}.", projectId,
buildAgentUrl );
+        distributedBuildService.startProjectBuild( projectId, buildDefinitionId );
+        log.info( "Start building project (projectId={}, buildDefId={}) in build agent {}.",
+                  new Object[] { projectId, buildDefinitionId, buildAgentUrl } );
         return Boolean.TRUE;
     }
 
@@ -89,7 +90,7 @@ public class MasterBuildAgentTransportSe
     {
         Map<String, String> envs = distributedBuildService.getEnvironments( buildDefinitionId,
installationType );
         log.debug( "Retrieving environments buildDefinitionId={}, installationType={}",
-                   new Object[]{buildDefinitionId, installationType} );
+                   new Object[] { buildDefinitionId, installationType } );
         return envs;
     }
 



Mime
View raw message