continuum-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marica Tan <marica....@gmail.com>
Subject Re: svn commit: r904294 - in /continuum/branches/continuum-1.3.x: continuum-core/src/main/java/org/apache/continuum/release/distributed/manager/ continuum-release/ continuum-release/src/main/mdo/ continuum-webapp/src/main/java/org/apache/maven/contin
Date Thu, 28 Jan 2010 23:10:41 GMT
Oops yes.

Sorry i'll revert it.

Thanks Brett :)

On Fri, Jan 29, 2010 at 7:07 AM, Brett Porter <brett@apache.org> wrote:

> did you mean for this to land on 1.3.x? The version in the MDO seems to be
> 1.4.0.
>
> - Brett
>
> On 29/01/2010, at 10:04 AM, ctan@apache.org wrote:
>
> > Author: ctan
> > Date: Thu Jan 28 23:04:26 2010
> > New Revision: 904294
> >
> > URL: http://svn.apache.org/viewvc?rev=904294&view=rev
> > Log:
> > [CONTINUUM-2450] removed if-else which is the cause why the
> prepared-releases.xml is not populated during the first release of any
> project on a fresh installation of continuum. also made sure that the
> prepared-releases.xml is updated every release
> >
> > Modified:
> >
>  continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/continuum/release/distributed/manager/DefaultDistributedReleaseManager.java
> >    continuum/branches/continuum-1.3.x/continuum-release/pom.xml
> >
>  continuum/branches/continuum-1.3.x/continuum-release/src/main/mdo/prepared-releases.mdo
> >
>  continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseInProgressAction.java
> >
> > Modified:
> continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/continuum/release/distributed/manager/DefaultDistributedReleaseManager.java
> > URL:
> http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/continuum/release/distributed/manager/DefaultDistributedReleaseManager.java?rev=904294&r1=904293&r2=904294&view=diff
> >
> ==============================================================================
> > ---
> continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/continuum/release/distributed/manager/DefaultDistributedReleaseManager.java
> (original)
> > +++
> continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/continuum/release/distributed/manager/DefaultDistributedReleaseManager.java
> Thu Jan 28 23:04:26 2010
> > @@ -155,6 +155,7 @@
> >         try
> >         {
> >             SlaveBuildAgentTransportClient client = new
> SlaveBuildAgentTransportClient( new URL( buildAgentUrl ) );
> > +
> >             String releaseId =
> >                 client.releasePrepare( createProjectMap( project ),
> createPropertiesMap( releaseProperties ),
> >                                        releaseVersion,
> developmentVersion, environments );
> > @@ -298,6 +299,18 @@
> >                                 boolean useReleaseProfile,
> LocalRepository repository )
> >         throws ContinuumReleaseException,
> BuildAgentConfigurationException
> >     {
> > +        List<PreparedRelease> releases = getPreparedReleases();
> > +
> > +        for ( PreparedRelease release: releases )
> > +        {
> > +            if ( release.getReleaseId().equals( releaseId ) )
> > +            {
> > +                release.setReleaseType( "perform" );
> > +                savePreparedReleases( releases );
> > +                break;
> > +            }
> > +        }
> > +
> >         String buildAgentUrl = getBuildAgentUrl( releaseId );
> >
> >         if ( !checkBuildAgent( buildAgentUrl ) )
> > @@ -440,6 +453,8 @@
> >             String result = client.releaseCleanup( releaseId );
> >
> >             removeFromReleaseInProgress( releaseId );
> > +            removeFromPreparedReleases( releaseId );
> > +
> >             return result;
> >         }
> >         catch ( MalformedURLException e )
> > @@ -634,17 +649,11 @@
> >     private void addReleasePrepare( String releaseId, String
> buildAgentUrl, String releaseName )
> >         throws ContinuumReleaseException
> >     {
> > -        File file = getPreparedReleasesFile();
> > -
> > -        if ( !file.exists() )
> > -        {
> > -            file.getParentFile().mkdirs();
> > -        }
> > -
> >         PreparedRelease release = new PreparedRelease();
> >         release.setReleaseId( releaseId );
> >         release.setBuildAgentUrl( buildAgentUrl );
> >         release.setReleaseName( releaseName );
> > +        release.setReleaseType( "prepare" );
> >
> >         List<PreparedRelease> preparedReleases = getPreparedReleases();
> >
> > @@ -652,41 +661,25 @@
> >         {
> >             preparedReleases = new ArrayList<PreparedRelease>();
> >         }
> > -        else
> > -        {
> > -            boolean found = false;
> >
> > -            for ( PreparedRelease preparedRelease : preparedReleases )
> > -            {
> > -                if ( preparedRelease.getReleaseId().equals(
> release.getReleaseId() ) &&
> > -                    preparedRelease.getReleaseName().equals(
> release.getReleaseName() ) )
> > -                {
> > -                    preparedRelease.setBuildAgentUrl(
> release.getBuildAgentUrl() );
> > -                    found = true;
> > -                }
> > -            }
> > +        boolean found = false;
> >
> > -            if ( !found )
> > +        for ( PreparedRelease preparedRelease : preparedReleases )
> > +        {
> > +            if ( preparedRelease.getReleaseId().equals(
> release.getReleaseId() ) &&
> > +                 preparedRelease.getReleaseName().equals(
> release.getReleaseName() ) )
> >             {
> > -                preparedReleases.add( release );
> > +                preparedRelease.setBuildAgentUrl(
> release.getBuildAgentUrl() );
> > +                found = true;
> >             }
> >         }
> >
> > -        PreparedReleaseModel model = new PreparedReleaseModel();
> > -        model.setPreparedReleases( preparedReleases );
> > -
> > -        try
> > -        {
> > -            ContinuumPrepareReleasesModelXpp3Writer writer = new
> ContinuumPrepareReleasesModelXpp3Writer();
> > -            FileWriter fileWriter = new FileWriter( file );
> > -            writer.write( fileWriter, model );
> > -            fileWriter.flush();
> > -            fileWriter.close();
> > -        }
> > -        catch ( IOException e )
> > +        if ( !found )
> >         {
> > -            throw new ContinuumReleaseException( "Failed to write
> prepared releases in file", e );
> > +            preparedReleases.add( release );
> >         }
> > +
> > +        savePreparedReleases( preparedReleases );
> >     }
> >
> >     private void addReleaseInProgress( String releaseId, String
> releaseType, int projectId )
> > @@ -748,4 +741,61 @@
> >         log.info( "Build agent: " + buildAgentUrl + "is either disabled
> or removed" );
> >         return false;
> >     }
> > +
> > +    private void removeFromPreparedReleases( String releaseId )
> > +        throws ContinuumReleaseException
> > +    {
> > +        List<PreparedRelease> releases = getPreparedReleases();
> > +
> > +        for ( PreparedRelease release : releases )
> > +        {
> > +            if ( release.getReleaseId().equals( releaseId ) )
> > +            {
> > +                if ( release.getReleaseType().equals( "perform" ) )
> > +                {
> > +                    releases.remove( release );
> > +                    savePreparedReleases( releases );
> > +                    break;
> > +                }
> > +            }
> > +        }
> > +    }
> > +
> > +    private void savePreparedReleases( List<PreparedRelease>
> preparedReleases)
> > +        throws ContinuumReleaseException
> > +    {
> > +        File file = getPreparedReleasesFile();
> > +
> > +        if ( !file.exists() )
> > +        {
> > +            file.getParentFile().mkdirs();
> > +        }
> > +
> > +        PreparedReleaseModel model = new PreparedReleaseModel();
> > +        model.setPreparedReleases( preparedReleases );
> > +
> > +        try
> > +        {
> > +            ContinuumPrepareReleasesModelXpp3Writer writer = new
> ContinuumPrepareReleasesModelXpp3Writer();
> > +            FileWriter fileWriter = new FileWriter( file );
> > +            writer.write( fileWriter, model );
> > +            fileWriter.flush();
> > +            fileWriter.close();
> > +        }
> > +        catch ( IOException e )
> > +        {
> > +            throw new ContinuumReleaseException( "Failed to write
> prepared releases in file", e );
> > +        }
> > +    }
> > +
> > +    // for testing
> > +    public void setBuildResultDao( BuildResultDao buildResultDao )
> > +    {
> > +        this.buildResultDao = buildResultDao;
> > +    }
> > +
> > +    public void setConfigurationService( ConfigurationService
> configurationService )
> > +    {
> > +        this.configurationService = configurationService;
> > +    }
> > }
> > \ No newline at end of file
> >
> > Modified: continuum/branches/continuum-1.3.x/continuum-release/pom.xml
> > URL:
> http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-release/pom.xml?rev=904294&r1=904293&r2=904294&view=diff
> >
> ==============================================================================
> > --- continuum/branches/continuum-1.3.x/continuum-release/pom.xml
> (original)
> > +++ continuum/branches/continuum-1.3.x/continuum-release/pom.xml Thu Jan
> 28 23:04:26 2010
> > @@ -121,7 +121,7 @@
> >           <models>
> >             <model>src/main/mdo/prepared-releases.mdo</model>
> >           </models>
> > -          <version>1.0.0</version>
> > +          <version>1.4.0</version>
> >           <useJava5>true</useJava5>
> >         </configuration>
> >         <executions>
> >
> > Modified:
> continuum/branches/continuum-1.3.x/continuum-release/src/main/mdo/prepared-releases.mdo
> > URL:
> http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-release/src/main/mdo/prepared-releases.mdo?rev=904294&r1=904293&r2=904294&view=diff
> >
> ==============================================================================
> > ---
> continuum/branches/continuum-1.3.x/continuum-release/src/main/mdo/prepared-releases.mdo
> (original)
> > +++
> continuum/branches/continuum-1.3.x/continuum-release/src/main/mdo/prepared-releases.mdo
> Thu Jan 28 23:04:26 2010
> > @@ -29,11 +29,11 @@
> >   <classes>
> >     <class rootElement="true" xml.tagName="prepared-releases">
> >       <name>PreparedReleaseModel</name>
> > -      <version>1.0.0</version>
> > +      <version>1.0.0+</version>
> >       <fields>
> >         <field>
> >           <name>preparedReleases</name>
> > -          <version>1.0.0</version>
> > +          <version>1.0.0+</version>
> >           <description></description>
> >           <required>true</required>
> >           <association>
> > @@ -45,29 +45,36 @@
> >     </class>
> >     <class>
> >       <name>PreparedRelease</name>
> > -      <version>1.0.0</version>
> > +      <version>1.0.0+</version>
> >       <fields>
> >         <field>
> >           <name>releaseId</name>
> > -          <version>1.0.0</version>
> > +          <version>1.0.0+</version>
> >           <required>true</required>
> >           <description>release id</description>
> >           <type>String</type>
> >         </field>
> >         <field>
> >           <name>releaseName</name>
> > -          <version>1.0.0</version>
> > +          <version>1.0.0+</version>
> >           <required>true</required>
> >           <description>prepared release name</description>
> >           <type>String</type>
> >         </field>
> >         <field>
> >           <name>buildAgentUrl</name>
> > -          <version>1.0.0</version>
> > +          <version>1.0.0+</version>
> >           <required>true</required>
> >           <description>build agent url</description>
> >           <type>String</type>
> >         </field>
> > +        <field>
> > +          <name>releaseType</name>
> > +          <version>1.4.0+</version>
> > +          <required>true</required>
> > +          <description>type of release. possible values are "prepare" or
> "perform"</description>
> > +          <type>String</type>
> > +        </field>
> >       </fields>
> >     </class>
> >   </classes>
> >
> > Modified:
> continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseInProgressAction.java
> > URL:
> http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseInProgressAction.java?rev=904294&r1=904293&r2=904294&view=diff
> >
> ==============================================================================
> > ---
> continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseInProgressAction.java
> (original)
> > +++
> continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseInProgressAction.java
> Thu Jan 28 23:04:26 2010
> > @@ -94,7 +94,7 @@
> >                 List<String> args = new ArrayList<String>();
> >                 args.add( e.getMessage() );
> >
> > -                addActionError( getText( "releaseInProgress.error", args
> ) );
> > +                addActionError( getText(
> "distributedBuild.releaseInProgress.error", args ) );
> >                 return ERROR;
> >             }
> >
> >
> >
>
> --
> Brett Porter
> brett@apache.org
> http://brettporter.wordpress.com/
>
>
>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message