[Anthill-pro] Resolving an artifact set depending on the current environment

Mathew Joseph mjoseph at bravurasolutions.com
Wed Mar 19 14:13:21 CST 2008


I had a similar request some time back relating to resolving artifacts
based on the artifact group. As in right now, you have to resolve all
artifacts by default. If however the resolve artifacts had an option to
select which artifact group to resolve. Then this would allow the
functionality that the script below is trying to do. It would also allow
secondary workflows to only get those artifacts that they need to do
their work as opposed to the entire set.

This feature then needs to trickle down to the eclipse codestation
plugin which can then select artifact groups to be downloaded than the
entire bucket.

Is their any traction to this feature request within urbancode?

-----Original Message-----
From: Ryan Smith <rws at urbancode.com>
Reply-To: rws at urbancode.com, AnthillPro user and support list.
<anthill-pro at lists.urbancode.com>
To: AnthillPro user and support list. <anthill-pro at lists.urbancode.com>
Subject: Re: [Anthill-pro] Resolving an artifact set depending on the
current environment
Date: Wed, 19 Mar 2008 15:51:45 -0400

Peter,

The only way around that is to use a Evaluate Script step that will create a step to resolve the artifacts within it. Use the following as the script. The setName is the name of the artifact set to download. I'm using the name of the envioronment.



import com.urbancode.anthill3.domain.artifacts.*;
import com.urbancode.anthill3.runtime.scripting.helpers.*;
import com.urbancode.anthill3.step.artifacts.*;
import com.urbancode.anthill3.services.jobs.StepExecutor;

log = org.apache.log4j.Logger.getLogger("Scripted_Artifact_Resolve");

try {
    String setName = EnvironmentLookup.getCurrent().getName();
    
    ArtifactModule module = new ArtifactModule();
    module.setArtifactSet(ProjectLookup.getCurrent().getLifeCycleModel().getArtifactSetGroup().getArtifactSet(setName));
    module.setTargetDirectory("artifacts");
    
    ResolveMyArtifactsStep step = new ResolveMyArtifactsStep(module);
    step.setExecutor(StepExecutor.getCurrent());
    step.setJob(StepExecutor.getCurrent().getJob());
    step.setAgent(StepExecutor.getCurrent().getJobTrace().getAgent());
    step.perform();
}
catch (Exception e) {
    log.error(e.getMessage(), e);
    throw e;
}


  

Lanser, Peter wrote:
> Hi,
> 
> in a job configuration I'd like to have a step which resolves artifacts depending on the current environment.
> 
> Let's say the current environment is 'DEV' then I want to resolve the artifact set 'DEV Artifacts' into a specific directory.
> 
> Unfortunately the configuration for a step of type 'Resolve My Artifacts Step' cannot take a scriptlet as a parameter for the name of the artifact set.
> 
> So what's the best way to resolve an artifact set depending an the current environment?
> 
> Thanks for your help.
> 
> Regards,
> Peter
> _______________________________________________
> Anthill-pro mailing list
> Anthill-pro at lists.urbancode.com
> http://lists.urbancode.com/mailman/listinfo/anthill-pro
> 

-- 
Regards,
Mathew Joseph
Build & Release Engineer
Bravura Solutions


More information about the Anthill-pro mailing list