[Anthill-pro] Best way to implement this?

emerson cargnin echofloripa.yell at gmail.com
Fri Jun 6 04:54:11 CDT 2008


I need to implement a workflow that will stop and restart our webserver (resin)

At this moment I have it as part of the deployment workflow, so that
it stop before the deployment and starts afterwards.

Now I need to have it also separated so that support could
start/stop/restart resin directly without deploying anything.

This should be a originating workflow as it doesn't depend on any
artifact, it just connects to the agent and restarts resin.

The thing is that as an originating workflow can't run in multiple
environments, just one.

It would be interesting to have the possibility to run a secondary
workflow without a primary one in special cases like this.

So I thought in having a step in my originating workflow that would
call a script that would get the secondary workflow, get the
environment property and set as the server group of my secondary
workflow, and then run it for the current buildlife.

I researched and i found how to get the secondary workflow and set the
environment:
-----------------------------------------------
 Workflow resinStart =
WorkflowLookup.getForProjectAndName(ProjectLookup.getCurrent(),"resinStart");
    String env = PropertyLookup.getValue("environment");
    EnvironmentGroup envGroup =
EnvironmentGroupFactory.getInstance().restoreForName("Default
Environment Group");
    ServerGroup[] serverGroups = envGroup.getServerGroupArray();
    for (int sg=0; sg<serverGroups.length; sg++) {
       if (env.equals(serverGroups[sg].getName())){
         resinStart.addServerGroup(serverGroups[sg]);
         break;
       }
    }
----------------------------------------------

But I think that what I really need is to get the current BuildLife
and execute a secondary workflow on it. I then get:

BuildLife buildLife = BuildLifeLookup.getCurrent();


I will probably have to mix the first script with the current build
life, but I can't find how. Could someone give me a hint on this?

Thank you
Emerson


More information about the Anthill-pro mailing list