continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject svn commit: r751678 - in /continuum/trunk: continuum-api/src/main/java/org/apache/continuum/release/distributed/manager/ continuum-buildagent/continuum-buildagent-api/src/main/java/org/apache/continuum/buildagent/ continuum-buildagent/continuum-buildag...
Date Mon, 09 Mar 2009 13:42:43 GMT
Author: ctan
Date: Mon Mar  9 13:42:42 2009
New Revision: 751678

URL: http://svn.apache.org/viewvc?rev=751678&view=rev
Log:
[CONTINUUM-2043] added releases list page and release rollback from build agent
 

Added:
    continuum/trunk/continuum-webapp/src/main/java/org/apache/continuum/web/action/DistributedReleasesAction.java
  (with props)
    continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/releases.jsp   (with props)
Modified:
    continuum/trunk/continuum-api/src/main/java/org/apache/continuum/release/distributed/manager/DistributedReleaseManager.java
    continuum/trunk/continuum-buildagent/continuum-buildagent-api/src/main/java/org/apache/continuum/buildagent/ContinuumBuildAgentService.java
    continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/ContinuumBuildAgentServiceImpl.java
    continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/manager/BuildAgentReleaseManager.java
    continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/manager/DefaultBuildAgentReleaseManager.java
    continuum/trunk/continuum-core/src/main/java/org/apache/continuum/release/distributed/DistributedReleaseUtil.java
    continuum/trunk/continuum-core/src/main/java/org/apache/continuum/release/distributed/manager/DefaultDistributedReleaseManager.java
    continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-api/src/main/java/org/apache/continuum/distributed/transport/slave/SlaveBuildAgentTransportService.java
    continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-client/src/main/java/org/apache/continuum/distributed/transport/slave/SlaveBuildAgentTransportClient.java
    continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-server/src/main/java/org/apache/continuum/distributed/transport/slave/SlaveBuildAgentTransportServer.java
    continuum/trunk/continuum-release/src/main/mdo/prepared-releases.mdo
    continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleasePerformAction.java
    continuum/trunk/continuum-webapp/src/main/mdo/view-models.mdo
    continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties
    continuum/trunk/continuum-webapp/src/main/resources/struts.xml
    continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/navigations/Menu.jsp

Modified: continuum/trunk/continuum-api/src/main/java/org/apache/continuum/release/distributed/manager/DistributedReleaseManager.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-api/src/main/java/org/apache/continuum/release/distributed/manager/DistributedReleaseManager.java?rev=751678&r1=751677&r2=751678&view=diff
==============================================================================
--- continuum/trunk/continuum-api/src/main/java/org/apache/continuum/release/distributed/manager/DistributedReleaseManager.java
(original)
+++ continuum/trunk/continuum-api/src/main/java/org/apache/continuum/release/distributed/manager/DistributedReleaseManager.java
Mon Mar  9 13:42:42 2009
@@ -52,7 +52,7 @@
     String getPreparedReleaseName( String releaseId )
         throws ContinuumReleaseException;
 
-    void releasePerform( String releaseId, String goals, String arguments, boolean useReleaseProfile,
LocalRepository repository )
+    void releasePerform( int projectId, String releaseId, String goals, String arguments,
boolean useReleaseProfile, LocalRepository repository )
         throws ContinuumReleaseException;
 
     void releasePerformFromScm( int projectId, String goals, String arguments, boolean useReleaseProfile,
LocalRepository repository, 
@@ -64,4 +64,7 @@
 
     String releaseCleanup( String releaseId )
         throws ContinuumReleaseException;
+
+    List<Map> getAllReleasesInProgress()
+        throws ContinuumReleaseException;
 }
\ No newline at end of file

Modified: continuum/trunk/continuum-buildagent/continuum-buildagent-api/src/main/java/org/apache/continuum/buildagent/ContinuumBuildAgentService.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-buildagent/continuum-buildagent-api/src/main/java/org/apache/continuum/buildagent/ContinuumBuildAgentService.java?rev=751678&r1=751677&r2=751678&view=diff
==============================================================================
--- continuum/trunk/continuum-buildagent/continuum-buildagent-api/src/main/java/org/apache/continuum/buildagent/ContinuumBuildAgentService.java
(original)
+++ continuum/trunk/continuum-buildagent/continuum-buildagent-api/src/main/java/org/apache/continuum/buildagent/ContinuumBuildAgentService.java
Mon Mar  9 13:42:42 2009
@@ -69,10 +69,13 @@
     void releasePerform( String releaseId, String goals, String arguments, boolean useReleaseProfile,
Map repository )
         throws ContinuumBuildAgentException;
 
-    void releasePerformFromScm( String goals, String arguments, boolean useReleaseProfile,
Map repository, String scmUrl, String scmUsername, 
-                                String scmPassword, String scmTag, String scmTagBase, Map<String,
String> environments )
+    String releasePerformFromScm( String goals, String arguments, boolean useReleaseProfile,
Map repository, String scmUrl, String scmUsername, 
+                                  String scmPassword, String scmTag, String scmTagBase, Map<String,
String> environments )
         throws ContinuumBuildAgentException;
 
     String releaseCleanup( String releaseId )
         throws ContinuumBuildAgentException;
+
+    void releaseRollback( String releaseId, int projectId )
+        throws ContinuumBuildAgentException;
 }

Modified: continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/ContinuumBuildAgentServiceImpl.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/ContinuumBuildAgentServiceImpl.java?rev=751678&r1=751677&r2=751678&view=diff
==============================================================================
--- continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/ContinuumBuildAgentServiceImpl.java
(original)
+++ continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/ContinuumBuildAgentServiceImpl.java
Mon Mar  9 13:42:42 2009
@@ -522,15 +522,15 @@
         }
     }
 
-    public void releasePerformFromScm( String goals, String arguments, boolean useReleaseProfile,
Map repository, String scmUrl, 
-                                       String scmUsername, String scmPassword, String scmTag,
String scmTagBase, 
-                                       Map<String, String> environments )
+    public String releasePerformFromScm( String goals, String arguments, boolean useReleaseProfile,
Map repository, String scmUrl, 
+                                         String scmUsername, String scmPassword, String scmTag,
String scmTagBase, 
+                                         Map<String, String> environments )
         throws ContinuumBuildAgentException
     {
         try
         {
-            buildAgentReleaseManager.releasePerformFromScm( goals, arguments, useReleaseProfile,
repository, scmUrl, scmUsername, 
-                                                            scmPassword, scmTag, scmTagBase,
environments );
+            return buildAgentReleaseManager.releasePerformFromScm( goals, arguments, useReleaseProfile,
repository, scmUrl, 
+                                                                   scmUsername, scmPassword,
scmTag, scmTagBase, environments );
         }
         catch ( ContinuumReleaseException e )
         {
@@ -544,6 +544,19 @@
         return buildAgentReleaseManager.releaseCleanup( releaseId );
     }
 
+    public void releaseRollback( String releaseId, int projectId )
+        throws ContinuumBuildAgentException
+    {
+        try
+        {
+            buildAgentReleaseManager.releaseRollback( releaseId, projectId );
+        }
+        catch ( ContinuumReleaseException e )
+        {
+            throw new ContinuumBuildAgentException( "Unable to rollback release " + releaseId,
e );
+        }
+    }
+
     private void processProject( String workingDirectory, String pomFilename, boolean autoVersionSubmodules,
List<Map<String, String>> projects )
         throws Exception
     {

Modified: continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/manager/BuildAgentReleaseManager.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/manager/BuildAgentReleaseManager.java?rev=751678&r1=751677&r2=751678&view=diff
==============================================================================
--- continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/manager/BuildAgentReleaseManager.java
(original)
+++ continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/manager/BuildAgentReleaseManager.java
Mon Mar  9 13:42:42 2009
@@ -42,9 +42,12 @@
     void releasePerform( String releaseId, String goals, String arguments, boolean useReleaseProfile,
Map repository )
         throws ContinuumReleaseException;
 
-    void releasePerformFromScm( String goals, String arguments, boolean useReleaseProfile,
Map repository, String scmUrl, String scmUsername, 
+    String releasePerformFromScm( String goals, String arguments, boolean useReleaseProfile,
Map repository, String scmUrl, String scmUsername, 
                                 String scmPassword, String scmTag, String scmTagBase, Map<String,
String> environments )
         throws ContinuumReleaseException;
 
     String releaseCleanup( String releaseId );
+
+    void releaseRollback( String releaseId, int projectId )
+        throws ContinuumReleaseException;
 }

Modified: continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/manager/DefaultBuildAgentReleaseManager.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/manager/DefaultBuildAgentReleaseManager.java?rev=751678&r1=751677&r2=751678&view=diff
==============================================================================
--- continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/manager/DefaultBuildAgentReleaseManager.java
(original)
+++ continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/manager/DefaultBuildAgentReleaseManager.java
Mon Mar  9 13:42:42 2009
@@ -173,8 +173,8 @@
         releaseManager.perform( releaseId, performDirectory, goals, arguments, useReleaseProfile,
listener, repo );
     }
 
-    public void releasePerformFromScm( String goals, String arguments, boolean useReleaseProfile,
Map repository, String scmUrl, String scmUsername, 
-                                String scmPassword, String scmTag, String scmTagBase, Map<String,
String> environments )
+    public String releasePerformFromScm( String goals, String arguments, boolean useReleaseProfile,
Map repository, String scmUrl, 
+                                         String scmUsername, String scmPassword, String scmTag,
String scmTagBase, Map<String, String> environments )
         throws ContinuumReleaseException
     {
         ContinuumReleaseDescriptor descriptor = new ContinuumReleaseDescriptor();
@@ -196,6 +196,8 @@
         releaseManager.getPreparedReleases().put( releaseId, descriptor );
 
         releasePerform( releaseId, goals, arguments, useReleaseProfile, repository );
+
+        return releaseId;
     }
 
     public String releaseCleanup( String releaseId )
@@ -215,6 +217,29 @@
         }
     }
 
+    public void releaseRollback( String releaseId, int projectId )
+        throws ContinuumReleaseException
+    {
+        ContinuumReleaseManagerListener listener = new DefaultReleaseManagerListener();
+
+        releaseManager.rollback( releaseId, buildAgentConfigurationService.getWorkingDirectory(
projectId ).getPath(), listener );
+
+        //recurse until rollback is finished
+        while ( listener.getState() != ContinuumReleaseManagerListener.FINISHED )
+        {
+            try
+            {
+                Thread.sleep( 1000 );
+            }
+            catch ( InterruptedException e )
+            {
+                //do nothing
+            }
+        }
+
+        releaseManager.getPreparedReleases().remove( releaseId );
+    }
+
     private Project getProject( Map context )
     {
         Project project = new Project();

Modified: continuum/trunk/continuum-core/src/main/java/org/apache/continuum/release/distributed/DistributedReleaseUtil.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/main/java/org/apache/continuum/release/distributed/DistributedReleaseUtil.java?rev=751678&r1=751677&r2=751678&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/main/java/org/apache/continuum/release/distributed/DistributedReleaseUtil.java
(original)
+++ continuum/trunk/continuum-core/src/main/java/org/apache/continuum/release/distributed/DistributedReleaseUtil.java
Mon Mar  9 13:42:42 2009
@@ -95,6 +95,10 @@
 
     public static final String KEY_LOCAL_REPOSITORY_LAYOUT = "repo-layout";
 
+    public static final String KEY_RELEASE_GOAL = "release-goal";
+
+    public static final String KEY_BUILD_AGENT_URL = "build-agent-url";
+
     public static String getScmTag( Map context, String defaultValue )
     {
         return getString( context, KEY_SCM_TAG, defaultValue );
@@ -185,6 +189,26 @@
         return getString( context, KEY_GOALS, defaultValue );
     }
 
+    public static String getReleaseId( Map context )
+    {
+        return getString( context, KEY_RELEASE_ID );
+    }
+
+    public static String getReleaseGoal( Map context )
+    {
+        return getString( context, KEY_RELEASE_GOAL );
+    }
+
+    public static String getBuildAgentUrl( Map context )
+    {
+        return getString( context, KEY_BUILD_AGENT_URL );
+    }
+
+    public static int getProjectId( Map context )
+    {
+        return getInteger( context, KEY_PROJECT_ID );
+    }
+
     // ----------------------------------------------------------------------
     //
     // ----------------------------------------------------------------------

Modified: continuum/trunk/continuum-core/src/main/java/org/apache/continuum/release/distributed/manager/DefaultDistributedReleaseManager.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/main/java/org/apache/continuum/release/distributed/manager/DefaultDistributedReleaseManager.java?rev=751678&r1=751677&r2=751678&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/main/java/org/apache/continuum/release/distributed/manager/DefaultDistributedReleaseManager.java
(original)
+++ continuum/trunk/continuum-core/src/main/java/org/apache/continuum/release/distributed/manager/DefaultDistributedReleaseManager.java
Mon Mar  9 13:42:42 2009
@@ -69,7 +69,9 @@
      * @plexus.requirement
      */
     InstallationService installationService;
-    
+
+    private Map<String, Map> releasesInProgress;
+
     public Map getReleasePluginParameters( int projectId, String pomFilename )
         throws ContinuumReleaseException
     {
@@ -137,7 +139,9 @@
             String releaseId = client.releasePrepare( createProjectMap( project ), createPropertiesMap(
releaseProperties ),
                                                       releaseVersion, developmentVersion,
environments );
 
-            addReleasePrepare( releaseId, buildAgentUrl );
+            addReleasePrepare( releaseId, buildAgentUrl, releaseVersion.get( releaseId )
);
+
+            addReleaseInProgress( releaseId, "prepare", project.getId() );
 
             return releaseId;
         }
@@ -270,7 +274,8 @@
         }
     }
 
-    public void releasePerform( String releaseId, String goals, String arguments, boolean
useReleaseProfile, LocalRepository repository )
+    public void releasePerform( int projectId, String releaseId, String goals, String arguments,
boolean useReleaseProfile, 
+                                LocalRepository repository )
         throws ContinuumReleaseException
     {
         String buildAgentUrl = getBuildAgentUrl( releaseId );
@@ -304,6 +309,8 @@
         {
             SlaveBuildAgentTransportClient client = new SlaveBuildAgentTransportClient( new
URL( buildAgentUrl ) );
             client.releasePerform( releaseId, goals, arguments, useReleaseProfile, map );
+
+            addReleaseInProgress( releaseId, "perform", projectId );
         }
         catch ( MalformedURLException e )
         {
@@ -353,8 +360,10 @@
         try
         {
             SlaveBuildAgentTransportClient client = new SlaveBuildAgentTransportClient( new
URL( buildAgentUrl ) );
-            client.releasePerformFromScm( goals, arguments, useReleaseProfile, map, scmUrl,
scmUsername, scmPassword,
-                                          scmTag, scmTagBase, environments );
+            String releaseId = client.releasePerformFromScm( goals, arguments, useReleaseProfile,
map, scmUrl, scmUsername, scmPassword,
+                                                             scmTag, scmTagBase, environments
);
+
+            addReleaseInProgress( releaseId, "perform", projectId );
         }
         catch ( MalformedURLException e )
         {
@@ -371,7 +380,29 @@
     public void releaseRollback( String releaseId, int projectId )
         throws ContinuumReleaseException
     {
-        //TODO
+        String buildAgentUrl = getBuildAgentUrl( releaseId );
+
+        if ( StringUtils.isBlank( buildAgentUrl ) )
+        {
+            log.info( "Unable to rollback release " + releaseId + " because no build agent
found" );
+            return;
+        }
+
+        try
+        {
+            SlaveBuildAgentTransportClient client = new SlaveBuildAgentTransportClient( new
URL( buildAgentUrl ) );
+            client.releaseRollback( releaseId, projectId );
+        }
+        catch ( MalformedURLException e )
+        {
+            log.error( "Invalid build agent url " + buildAgentUrl );
+            throw new ContinuumReleaseException( "Invalid build agent url " + buildAgentUrl
);
+        }
+        catch ( Exception e )
+        {
+            log.error( "Unable to rollback release " + releaseId, e );
+            throw new ContinuumReleaseException( "Unable to rollback release " + releaseId,
e );
+        }
     }
 
     public String releaseCleanup( String releaseId )
@@ -388,7 +419,10 @@
         try
         {
             SlaveBuildAgentTransportClient client = new SlaveBuildAgentTransportClient( new
URL( buildAgentUrl ) );
-            return client.releaseCleanup( releaseId );
+            String result = client.releaseCleanup( releaseId );
+
+            removeFromReleaseInProgress( releaseId );
+            return result;
         }
         catch ( MalformedURLException e )
         {
@@ -402,6 +436,55 @@
         }
     }
 
+    public List<Map> getAllReleasesInProgress()
+        throws ContinuumReleaseException
+    {
+        List<Map> releases = new ArrayList<Map>();
+        Map<String, Map> releasesMap = new HashMap<String, Map>();
+        
+        if ( releasesInProgress != null && !releasesInProgress.isEmpty() )
+        {
+            for ( String releaseId : releasesInProgress.keySet() )
+            {
+                String buildAgentUrl = getBuildAgentUrl( releaseId );
+
+                if ( StringUtils.isNotBlank( buildAgentUrl ) )
+                {
+                    try
+                    {
+                        SlaveBuildAgentTransportClient client = new SlaveBuildAgentTransportClient(
new URL( buildAgentUrl ) );
+                        Map map = client.getListener( releaseId );
+
+                        if ( map != null && !map.isEmpty() )
+                        {
+                            Map release = releasesInProgress.get( releaseId );
+                            release.put( DistributedReleaseUtil.KEY_RELEASE_ID, releaseId
);
+                            release.put( DistributedReleaseUtil.KEY_BUILD_AGENT_URL, buildAgentUrl
);
+
+                            releases.add( release );
+
+                            releasesMap.put( releaseId, releasesInProgress.get( releaseId
) );
+                        }
+                    }
+                    catch ( MalformedURLException e )
+                    {
+                        log.error( "Invalid build agent url " + buildAgentUrl );
+                        throw new ContinuumReleaseException( "Invalid build agent url " +
buildAgentUrl );
+                    }
+                    catch ( Exception e )
+                    {
+                        log.error( "Failed to get all releases in progress ", e );
+                        throw new ContinuumReleaseException( "Failed to get all releases
in progress ", e );
+                    }
+                }
+            }
+
+            releasesInProgress = releasesMap;
+        }
+
+        return releases;
+    }
+
     private Map createProjectMap( Project project )
     {
         Map map = new HashMap();
@@ -514,7 +597,7 @@
         return null;
     }
 
-    private void addReleasePrepare( String releaseId, String buildAgentUrl )
+    private void addReleasePrepare( String releaseId, String buildAgentUrl, String releaseName
)
         throws ContinuumReleaseException
     {
         File file = getPreparedReleasesFile();
@@ -527,6 +610,7 @@
         PreparedRelease release = new PreparedRelease();
         release.setReleaseId( releaseId );
         release.setBuildAgentUrl( buildAgentUrl );
+        release.setReleaseName( releaseName );
 
         List<PreparedRelease> preparedReleases = getPreparedReleases();
 
@@ -540,7 +624,8 @@
 
             for ( PreparedRelease preparedRelease : preparedReleases )
             {
-                if ( preparedRelease.getReleaseId().equals( release.getReleaseId() ) )
+                if ( preparedRelease.getReleaseId().equals( release.getReleaseId() ) &&

+                     preparedRelease.getReleaseName().equals( release.getReleaseName() )
)
                 {
                     preparedRelease.setBuildAgentUrl( release.getBuildAgentUrl() );
                     found = true;
@@ -568,22 +653,41 @@
         }
     }
 
-    private void removePrepareRelease( String releaseId )
-        throws ContinuumReleaseException
+    private void addReleaseInProgress( String releaseId, String releaseType, int projectId
)
     {
-        List<PreparedRelease> preparedReleases = getPreparedReleases();
+        if ( releasesInProgress == null )
+        {
+            releasesInProgress = new HashMap<String, Map>();
+        }
+
+        Map map = new HashMap();
+        map.put( DistributedReleaseUtil.KEY_RELEASE_GOAL, releaseType );
+        map.put( DistributedReleaseUtil.KEY_PROJECT_ID, projectId );
+
+        releasesInProgress.put( releaseId, map );
+    }
+
+    private void removeFromReleaseInProgress( String releaseId )
+    {
+        if ( releasesInProgress != null && releasesInProgress.containsKey( releaseId
) )
+        {
+            releasesInProgress.remove( releaseId );
+        }
     }
 
     private String getBuildAgentUrl( String releaseId )
         throws ContinuumReleaseException
     {
         List<PreparedRelease> preparedReleases = getPreparedReleases();
-        
-        for ( PreparedRelease preparedRelease : preparedReleases )
+
+        if ( preparedReleases != null )
         {
-            if ( preparedRelease.getReleaseId().equals( releaseId ) )
+            for ( PreparedRelease preparedRelease : preparedReleases )
             {
-                return preparedRelease.getBuildAgentUrl();
+                if ( preparedRelease.getReleaseId().equals( releaseId ) )
+                {
+                    return preparedRelease.getBuildAgentUrl();
+                }
             }
         }
 

Modified: continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-api/src/main/java/org/apache/continuum/distributed/transport/slave/SlaveBuildAgentTransportService.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-api/src/main/java/org/apache/continuum/distributed/transport/slave/SlaveBuildAgentTransportService.java?rev=751678&r1=751677&r2=751678&view=diff
==============================================================================
--- continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-api/src/main/java/org/apache/continuum/distributed/transport/slave/SlaveBuildAgentTransportService.java
(original)
+++ continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-api/src/main/java/org/apache/continuum/distributed/transport/slave/SlaveBuildAgentTransportService.java
Mon Mar  9 13:42:42 2009
@@ -72,10 +72,13 @@
     public Boolean releasePerform( String releaseId, String goals, String arguments, boolean
useReleaseProfile, Map repository )
         throws Exception;
 
-    public Boolean releasePerformFromScm( String goals, String arguments, boolean useReleaseProfile,
Map repository, String scmUrl, 
-                                          String scmUsername, String scmPassword, String
scmTag, String scmTagBase, Map environments )
+    public String releasePerformFromScm( String goals, String arguments, boolean useReleaseProfile,
Map repository, String scmUrl, 
+                                         String scmUsername, String scmPassword, String scmTag,
String scmTagBase, Map environments )
         throws Exception;
 
     public String releaseCleanup( String releaseId )
         throws Exception;
+
+    public Boolean releaseRollback( String releaseId, int projectId )
+        throws Exception;
 }

Modified: continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-client/src/main/java/org/apache/continuum/distributed/transport/slave/SlaveBuildAgentTransportClient.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-client/src/main/java/org/apache/continuum/distributed/transport/slave/SlaveBuildAgentTransportClient.java?rev=751678&r1=751677&r2=751678&view=diff
==============================================================================
--- continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-client/src/main/java/org/apache/continuum/distributed/transport/slave/SlaveBuildAgentTransportClient.java
(original)
+++ continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-client/src/main/java/org/apache/continuum/distributed/transport/slave/SlaveBuildAgentTransportClient.java
Mon Mar  9 13:42:42 2009
@@ -370,17 +370,16 @@
         return result;
     }
 
-    public Boolean releasePerformFromScm( String goals, String arguments, boolean useReleaseProfile,
Map repository, String scmUrl,
+    public String releasePerformFromScm( String goals, String arguments, boolean useReleaseProfile,
Map repository, String scmUrl,
                                           String scmUsername, String scmPassword, String
scmTag, String scmTagBase, Map environments )
         throws Exception
     {
-        Boolean result = null;
+        String result = null;
 
         try
         {
-            slave.releasePerformFromScm( goals, arguments, useReleaseProfile, repository,
scmUrl, scmUsername, scmPassword, scmTag,
+            result = slave.releasePerformFromScm( goals, arguments, useReleaseProfile, repository,
scmUrl, scmUsername, scmPassword, scmTag,
                                          scmTagBase, environments);
-            result = Boolean.FALSE;
             log.info( "Performing release" );
         }
         catch ( Exception e )
@@ -410,4 +409,24 @@
 
         return result;
     }
+
+    public Boolean releaseRollback( String releaseId, int projectId )
+        throws Exception
+    {
+        Boolean result = Boolean.FALSE;
+
+        try
+        {
+            slave.releaseRollback( releaseId, projectId );
+            result = Boolean.TRUE;
+            log.info( "Rollback release " + releaseId );
+        }
+        catch ( Exception e )
+        {
+            log.error( "Failed to rollback release " + releaseId );
+            throw new Exception( "Failed to rollback release " + releaseId );
+        }
+
+        return result;
+    }
 }

Modified: continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-server/src/main/java/org/apache/continuum/distributed/transport/slave/SlaveBuildAgentTransportServer.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-server/src/main/java/org/apache/continuum/distributed/transport/slave/SlaveBuildAgentTransportServer.java?rev=751678&r1=751677&r2=751678&view=diff
==============================================================================
--- continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-server/src/main/java/org/apache/continuum/distributed/transport/slave/SlaveBuildAgentTransportServer.java
(original)
+++ continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-server/src/main/java/org/apache/continuum/distributed/transport/slave/SlaveBuildAgentTransportServer.java
Mon Mar  9 13:42:42 2009
@@ -290,25 +290,20 @@
         return result;
     }
 
-    public Boolean releasePerformFromScm( String goals, String arguments, boolean useReleaseProfile,
Map repository, String scmUrl,
-                                          String scmUsername, String scmPassword, String
scmTag, String scmTagBase, Map environments )
+    public String releasePerformFromScm( String goals, String arguments, boolean useReleaseProfile,
Map repository, String scmUrl,
+                                         String scmUsername, String scmPassword, String scmTag,
String scmTagBase, Map environments )
         throws Exception
     {
-        Boolean result = Boolean.FALSE;
-    
         try
         {
-            continuumBuildAgentService.releasePerformFromScm( goals, arguments, useReleaseProfile,
repository, scmUrl, scmUsername,
-                                                              scmPassword, scmTag, scmTagBase,
environments );
-            result = Boolean.TRUE;
+            return continuumBuildAgentService.releasePerformFromScm( goals, arguments, useReleaseProfile,
repository, scmUrl, scmUsername,
+                                                                     scmPassword, scmTag,
scmTagBase, environments );
         }
         catch ( ContinuumBuildAgentException e )
         {
             log.error( "Unable to perform release", e );
             throw e;
         }
-    
-        return result;
     }
 
     public String releaseCleanup( String releaseId )
@@ -324,4 +319,23 @@
             throw e;
         }
     }
+
+    public Boolean releaseRollback( String releaseId, int projectId )
+        throws Exception
+    {
+        Boolean result = Boolean.FALSE;
+
+        try
+        {
+            continuumBuildAgentService.releaseRollback( releaseId, projectId );
+            result = Boolean.TRUE;
+        }
+        catch ( ContinuumBuildAgentException e )
+        {
+            log.error( "Failed to rollback release " + releaseId, e );
+            throw e;
+        }
+
+        return result;
+    }
 }

Modified: continuum/trunk/continuum-release/src/main/mdo/prepared-releases.mdo
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-release/src/main/mdo/prepared-releases.mdo?rev=751678&r1=751677&r2=751678&view=diff
==============================================================================
--- continuum/trunk/continuum-release/src/main/mdo/prepared-releases.mdo (original)
+++ continuum/trunk/continuum-release/src/main/mdo/prepared-releases.mdo Mon Mar  9 13:42:42
2009
@@ -51,7 +51,14 @@
           <name>releaseId</name>
           <version>1.0.0</version>
           <required>true</required>
-          <description>release</description>
+          <description>release id</description>
+          <type>String</type>
+        </field>
+        <field>
+          <name>releaseName</name>
+          <version>1.0.0</version>
+          <required>true</required>
+          <description>prepared release name</description>
           <type>String</type>
         </field>
         <field>

Added: continuum/trunk/continuum-webapp/src/main/java/org/apache/continuum/web/action/DistributedReleasesAction.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/java/org/apache/continuum/web/action/DistributedReleasesAction.java?rev=751678&view=auto
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/java/org/apache/continuum/web/action/DistributedReleasesAction.java
(added)
+++ continuum/trunk/continuum-webapp/src/main/java/org/apache/continuum/web/action/DistributedReleasesAction.java
Mon Mar  9 13:42:42 2009
@@ -0,0 +1,51 @@
+package org.apache.continuum.web.action;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.continuum.release.distributed.DistributedReleaseUtil;
+import org.apache.continuum.release.distributed.manager.DistributedReleaseManager;
+import org.apache.maven.continuum.web.action.ContinuumActionSupport;
+import org.apache.maven.continuum.web.model.DistributedReleaseSummary;
+/**
+ * @plexus.component role="com.opensymphony.xwork2.Action" role-hint="distributedRelease"
+ */
+public class DistributedReleasesAction
+    extends ContinuumActionSupport
+{
+    private List<DistributedReleaseSummary> releasesSummary;
+
+    public String list()
+        throws Exception
+    {
+        DistributedReleaseManager releaseManager = getContinuum().getDistributedReleaseManager();
+
+        List<Map> releases = releaseManager.getAllReleasesInProgress();
+
+        releasesSummary = new ArrayList<DistributedReleaseSummary>();
+
+        for ( Map release : releases )
+        {
+            DistributedReleaseSummary summary = new DistributedReleaseSummary();
+            summary.setReleaseId( DistributedReleaseUtil.getReleaseId( release ) );
+            summary.setReleaseGoal( DistributedReleaseUtil.getReleaseGoal( release ) );
+            summary.setBuildAgentUrl( DistributedReleaseUtil.getBuildAgentUrl( release )
);
+            summary.setProjectId( DistributedReleaseUtil.getProjectId( release ) );
+
+            releasesSummary.add( summary );
+        }
+
+        return SUCCESS;
+    }
+
+    public List<DistributedReleaseSummary> getReleasesSummary()
+    {
+        return releasesSummary;
+    }
+
+    public void setReleasesSummary( List<DistributedReleaseSummary> releasesSummary
)
+    {
+        this.releasesSummary = releasesSummary;
+    }
+}

Propchange: continuum/trunk/continuum-webapp/src/main/java/org/apache/continuum/web/action/DistributedReleasesAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: continuum/trunk/continuum-webapp/src/main/java/org/apache/continuum/web/action/DistributedReleasesAction.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleasePerformAction.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleasePerformAction.java?rev=751678&r1=751677&r2=751678&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleasePerformAction.java
(original)
+++ continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleasePerformAction.java
Mon Mar  9 13:42:42 2009
@@ -208,7 +208,7 @@
         {
             DistributedReleaseManager releaseManager = getContinuum().getDistributedReleaseManager();
 
-            releaseManager.releasePerform( releaseId, goals, arguments, useReleaseProfile,
repository );
+            releaseManager.releasePerform( projectId, releaseId, goals, arguments, useReleaseProfile,
repository );
         }
         else
         {

Modified: continuum/trunk/continuum-webapp/src/main/mdo/view-models.mdo
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/mdo/view-models.mdo?rev=751678&r1=751677&r2=751678&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/mdo/view-models.mdo (original)
+++ continuum/trunk/continuum-webapp/src/main/mdo/view-models.mdo Mon Mar  9 13:42:42 2009
@@ -571,5 +571,35 @@
         </field>
       </fields>
     </class>
+    <class>
+      <name>DistributedReleaseSummary</name>
+      <version>1.0.0+</version>
+      <fields>
+        <field>
+          <name>releaseId</name>
+          <version>1.0.0</version>
+          <required>true</required>
+          <type>String</type>
+        </field>
+        <field>
+          <name>releaseGoal</name>
+          <version>1.0.0</version>
+          <required>true</required>
+          <type>String</type>
+        </field>
+        <field>
+          <name>buildAgentUrl</name>
+          <version>1.0.0</version>
+          <required>true</required>
+          <type>String</type>
+        </field>
+        <field>
+          <name>projectId</name>
+          <version>1.0.0</version>
+          <required>true</required>
+          <type>int</type>
+        </field>
+      </fields>
+    </class>
   </classes>
 </model>

Modified: continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties?rev=751678&r1=751677&r2=751678&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties
(original)
+++ continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties
Mon Mar  9 13:42:42 2009
@@ -79,6 +79,7 @@
 menu.administration.userGroups = User Groups
 menu.administration.roles = Roles
 menu.administration.buildDefinitionTemplates = Build Definition Templates
+menu.administration.releases = Releases
 menu.account.options = My account
 user.edit.account = Edit user info
 menu.administration.queues = Queues
@@ -1100,7 +1101,7 @@
 # Page: View Distributed Build
 # ----------------------------------------------------------------------
 distributedBuilds.page.title = Continuum - View Distributed Builds
-distributedBuilds.section.title = Distributed Builds
+distributedBuilds.section.title = View Distributed Builds
 distributedBuilds.buildQueue.section.title = Build Queue
 distributedBuild.table.projectGroupName = Project Group Name
 distributedBuild.table.scmRootAddress = Scm Root Address
@@ -1130,3 +1131,12 @@
 buildAgentGroup.available.buildAgents.used = --- Used Build Agents ---
 buildAgentGroup.buildAgents.define = Configure the used Build Agents
 buildAgentGroup.error.remove.in.use = Build agent group can't be removed, it is probably
used by a build environment.
+
+# ----------------------------------------------------------------------
+# Page: View Distributed Releases
+# ----------------------------------------------------------------------
+releases.page.title = Continuum - View Releases
+releases.section.title = View Releases
+releaseSummary.table.releaseId = Release ID
+releaseSummary.table.releaseGoal = Release Goal
+releaseSummary.table.buildAgentUrl = Build Agent URL

Modified: continuum/trunk/continuum-webapp/src/main/resources/struts.xml
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/resources/struts.xml?rev=751678&r1=751677&r2=751678&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/resources/struts.xml (original)
+++ continuum/trunk/continuum-webapp/src/main/resources/struts.xml Mon Mar  9 13:42:42 2009
@@ -577,6 +577,10 @@
         <param name="projectGroupId">${projectGroupId}</param>
       </result>
     </action>
+
+    <action name="viewReleases" class="distributedRelease" method="list">
+      <result name="success">/WEB-INF/jsp/releases.jsp</result>
+    </action>
   </package>
 
   <!--

Modified: continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/navigations/Menu.jsp
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/navigations/Menu.jsp?rev=751678&r1=751677&r2=751678&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/navigations/Menu.jsp (original)
+++ continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/navigations/Menu.jsp Mon
Mar  9 13:42:42 2009
@@ -143,7 +143,13 @@
               <s:text name="menu.administration.queues"/>
             </s:a>
           </div> 
-        </redback:ifAuthorized> 
+        </redback:ifAuthorized>
+        <div class="body">
+          <s:url id="releasesUrl" action="viewReleases" namespace="/" includeParams="none"/>
+          <s:a href="%{releasesUrl}">
+            <s:text name="menu.administration.releases"/>
+          </s:a>
+        </div> 
         <redback:ifAuthorized permission="continuum-manage-build-templates">
           <s:url id="buildDefinitionTemplatesUrl" action="buildDefinitionTemplates" namespace="/admin"
includeParams="none"/>
           <div class="body">

Added: continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/releases.jsp
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/releases.jsp?rev=751678&view=auto
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/releases.jsp (added)
+++ continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/releases.jsp Mon Mar  9 13:42:42
2009
@@ -0,0 +1,63 @@
+<%--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  --%>
+
+<%@ taglib uri="/struts-tags" prefix="s" %>
+<%@ taglib uri="http://www.extremecomponents.org" prefix="ec" %>
+<%@ taglib uri='http://java.sun.com/jsp/jstl/core' prefix='c'%>
+
+<html>
+  <s:i18n name="localization.Continuum">
+    <head>
+      <title><s:text name="releases.page.title"/></title>
+    </head>
+    <body>
+      <div id="h3">
+        <h3><s:text name="releases.section.title"/></h3>
+        <c:if test="${!empty actionErrors}">
+          <div class="errormessage">
+            <s:iterator value="actionErrors">
+              <p><s:text name="<s:property/>" /></p>
+            </s:iterator>
+          </div>
+        </c:if>
+        <s:set name="releasesSummary" value="releasesSummary" scope="request"/>
+        <ec:table items="releasesSummary"
+                  var="releaseSummary"
+                  showExports="false"
+                  showPagination="false"
+                  showStatusBar="false"
+                  sortable="false"
+                  filterable="false">
+          <ec:row>
+            <ec:column property="releaseId" title="releaseSummary.table.releaseId">
+              <s:url id="viewReleaseUrl" action="releaseInProgress">
+                <s:param name="releaseId">${pageScope.releaseSummary.releaseId}</s:param>
+                <s:param name="projectId">${pageScope.releaseSummary.projectId}</s:param>
+                <s:param name="releaseGoal">${pageScope.releaseSummary.releaseGoal}</s:param>
+              </s:url>
+              <s:a href="%{viewReleaseUrl}">${pageScope.releaseSummary.releaseId}</s:a>
+            </ec:column>
+            <ec:column property="releaseGoal" title="releaseSummary.table.releaseGoal"/>
+            <ec:column property="buildAgentUrl" title="releaseSummary.table.buildAgentUrl"/>
+          </ec:row>
+        </ec:table>
+      </div>
+    </body>
+  </s:i18n>
+</html>
\ No newline at end of file

Propchange: continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/releases.jsp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/releases.jsp
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision



Mime
View raw message