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

Lanser, Peter Peter.Lanser at 3beg.at
Thu Mar 20 01:38:06 CST 2008


Hi,

works perfectly. Thanks!

Regards,
Peter

-----Ursprüngliche Nachricht-----
Von: anthill-pro-bounces at lists.urbancode.com [mailto:anthill-pro-bounces at lists.urbancode.com] Im Auftrag von Ryan Smith
Gesendet: Mittwoch, 19. März 2008 20:52
An: AnthillPro user and support list.
Betreff: Re: [Anthill-pro] Resolving an artifact set depending on the current environment


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
>

--
===========================================================
Ryan Smith.                     2044 Euclid Ave., Suite 600
Developer                   Cleveland, Ohio 44115
Urbancode, Inc.
                                email:  rws at urbancode.com
web:     www.urbancode.com      phone:  216-858-9000
web:     www.anthillpro.com     fax:    216-858-9602
===========================================================
_______________________________________________
Anthill-pro mailing list
Anthill-pro at lists.urbancode.com
http://lists.urbancode.com/mailman/listinfo/anthill-pro


More information about the Anthill-pro mailing list