{
Project project = getContinuum().getProject( projectId );
LocalRepository repository = project.getProjectGroup().getLocalRepository();
DistributedReleaseManager releaseManager = getContinuum().getDistributedReleaseManager();
Map<String, String> environments = new HashMap<String, String>();
if ( profileId != -1 )
{
Profile profile = getContinuum().getProfileService().getProfile( profileId );
environments = getEnvironments( profile );
}
try
{
releaseManager.releasePerformFromScm( projectId, goals, arguments, useReleaseProfile, repository, scmUrl,
scmUsername, scmPassword, scmTag, scmTagBase, environments );
}
catch ( BuildAgentConfigurationException e )
{
List<String> args = new ArrayList<String>();
args.add( e.getMessage() );
addActionError( getText( "distributedBuild.releasePerform.release.error", args ) );
return ERROR;
}
return SUCCESS;
}
else
{
ContinuumReleaseManager releaseManager = getContinuum().getReleaseManager();
ContinuumReleaseDescriptor descriptor = new ContinuumReleaseDescriptor();
descriptor.setScmSourceUrl( scmUrl );
descriptor.setScmUsername( scmUsername );
descriptor.setScmPassword( scmPassword );
descriptor.setScmReleaseLabel( scmTag );
descriptor.setScmTagBase( scmTagBase );
if ( profileId != -1 )
{
Profile profile = getContinuum().getProfileService().getProfile( profileId );
descriptor.setEnvironments( getEnvironments( profile ) );
}
do
{
releaseId = String.valueOf( System.currentTimeMillis() );
}
while ( releaseManager.getPreparedReleases().containsKey( releaseId ) );
releaseManager.getPreparedReleases().put( releaseId, descriptor );
return execute();
}
}