[Anthill-pro] Building dependencies cascading properties

Frederic Jean frederic.jean at ubisoft.com
Wed Apr 9 08:50:43 CDT 2008


Hi

Just a reply to say that indeed that would be a good feature. Make it work like when you want to run a workflow from a step and give us the ability to propagate workflow properties instead of having and evaluate script in our workflow that propagate them
(I can live with it as is right now but it would be way smoother that way with dependencies).

Thanks
Frederic

-----Message d'origine-----
De : anthill-pro-bounces at lists.urbancode.com [mailto:anthill-pro-bounces at lists.urbancode.com] De la part de emerson cargnin
Envoyé : 7 avril 2008 12:36
À : AnthillPro user and support list.
Objet : Re: [Anthill-pro] Building dependencies cascading properties

Hi

I temporarily (until we get this great feature ;) ) changed the
dependency to  not force a build. In this case I would manually run
the build for the same tag, and then that will be picked up by the
dependent. Not perfect solution, but at least it works.

thanks
emerson

On 07/04/2008, emerson cargnin <echofloripa.yell at gmail.com> wrote:
> Hey
>
> Thanks for the suggestion, but as you said, my case is a pull build.
> If I use the property lookup, how could I make it work in both cases
> when it is executed on its own or called from the dependent?
>
> thanks
> emerson
>
> On 07/04/2008, Alexandre Borgia <alexandre.borgia at ubisoft.com> wrote:
> > Hi Emerson,
> >
> >        I had the same problem a while ago and as far as I know I don't think there are any built-in ways to cascade properties.  That would be a great feature!
> >
> >        We ended up having a small Beanshell script executed at the start of our workflows that propagates some properties from the dependent workflows (if any) to the current one.  Our workflows are triggered through "pushes".  From what I read you seem to "pull" a build instead so I'm not sure the script will work as-is, but I hope it gives you some ideas.
> >
> >        Also note that this script doesn't care if the builds are coming from the same request or not - properties will always get overridden by the dependencies' values (even if they have been built, say, 3 weeks ago).  You might want to add a check within the for-loop that verifies if the workspaceDate or some other value is the same for both requests/build-lives, else you won't be able to trigger new builds from part of the dependency-tree using different values.
> >
> >
> > import com.urbancode.anthill3.domain.buildlife.*;
> > import com.urbancode.codestation2.domain.buildlife.*;
> > import com.urbancode.anthill3.domain.buildrequest.*;
> >
> >
> > setProperty( BuildRequest request, String propName ) {
> >  if ( request.getProperty(propName) != null ) {
> >        PropertyLookup.set( propName, request.getProperty(propName) );
> >  }
> > }
> >
> >
> > BuildLife currentLife = BuildLifeLookup.getCurrent();
> > CodestationCompatableBuildLife[] lives = currentLife.getDependencyBuildLifeArray();
> >
> >
> > for ( int i = 0; i < lives.length; i++ ) {
> >  BuildLife life = (BuildLife) lives[i];
> >  BuildRequest request = BuildRequestFactory.getInstance().restoreForBuildLife( life );
> >
> >    // list all the properties you want to cascade here:
> >    setProperty( request, "BuildType" );
> >    setProperty( request, "Clean" );
> >    setProperty( request, "Changelist" );
> >    setProperty( request, "Submitter" );
> >    // etc ...
> > }
> >
> >
> >        Note that a simpler way if you have few properties might be just to do the property lookup on a as-needed basis in your dependent workflow ... if you are certain this workflow will always be triggered through a dependency and that this dependency always has some property defined, you could do something like:
> >
> > ${bsh:BuildRequestFactory.getInstance().restoreForBuildLife(BuildLifeLookup.getCurrent().getDependencyBuildLifeArray()[0]).getProperty('someProperty')}
> >
> > (this one-liner is probably missing "import" directives ... and there might be a more compact way to do it!)
> >
> >
> > Hope this helps!
> >  - Alexandre Borgia
> >
> >
> >
> > -----Message d'origine-----
> > De : anthill-pro-bounces at lists.urbancode.com [mailto:anthill-pro-bounces at lists.urbancode.com] De la part de emerson cargnin
> > Envoyé : 7 avril 2008 10:43
> > À : AnthillPro user and support list.
> > Objet : [Anthill-pro] Building dependencies cascading properties
> >
> > Hi
> >
> > I have my CI build workflow to build a dependency before hand (to
> > fetch common resources). For the main workflow (trunk) this works
> > alright. But when I'm building from a tag, it needs to have the
> > properties I use for the project workflow to be cascaded to the
> > resources dependency project. I found that the properties are not
> > cascaded by default and also there is no option to allow this.
> >
> > Any idea on how doing this?
> >
> > thanks
> > emerson
> > _______________________________________________
> > Anthill-pro mailing list
> > Anthill-pro at lists.urbancode.com
> > http://lists.urbancode.com/mailman/listinfo/anthill-pro
> > _______________________________________________
> > Anthill-pro mailing list
> > Anthill-pro at lists.urbancode.com
> > http://lists.urbancode.com/mailman/listinfo/anthill-pro
> >
>
_______________________________________________
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