Can you point me to the correct direction in accomplishing this?
Can you point me to the correct direction in accomplishing this?
var referencedSteps = [];
var masterStep = configuration.findStep("master");
referencedSteps.add(masterStep);
fillReferencedSteps(masterStep, referencedSteps);
function fillReferencedSteps(step, referencedSteps) {
if (step instanceof CompositeStep) {
CompositeStep compositeStep = (CompositeStep) step;
for (String each: compositeStep.getChildStepNames()) {
step = configuration.findStep(each);
if (step != null && !referencedSteps.contains(step)) {
referencedSteps.add(step);
fillReferencedSteps(step, referencedSteps);
}
}
}
In case anyone else ends up looking for this here is the code
groovy:
import com.pmease.quickbuild.stepsupport.CompositeStep;
def buildConfigPath = "root/path/to/your/config";
def buildConfiguration = system.getConfiguration( buildConfigPath );
def referencedSteps = [];
def masterStep = buildConfiguration.findStep("master");
referencedSteps.add(masterStep);
fillReferencedSteps(masterStep, referencedSteps);
def fillReferencedSteps(step, referencedSteps)
{
if (step instanceof CompositeStep)
{
CompositeStep compositeStep = (CompositeStep) step;
for (String each: compositeStep.getChildStepNames())
{
step = configuration.findStep(each);
if (step != null && !referencedSteps.contains(step))
{
referencedSteps.add(step);
fillReferencedSteps(step, referencedSteps);
}
}
}
}
// if you want to remove the master step from the list steps
// referencedSteps.remove(0);
for (i in referencedSteps)
{
logger.info( i.getName() );
}
I have the following configurations: root/child-1/child-2/child-3
and in each, except for the last configuration, I created a step.
In Configuration "Child-1" i add the step from root and the step created in Child-1 to the workflow
In Configuration "Child-2" i added the step, created in this configuration, to the workflow.
in the last configuration "child-3" the workflow looks like:
master
step-root
step-1
step-2
Based on the script above and here in the forum I wanted to create a list of the used steps of a configuration.
If I execute the script for the configuration root/child-1/child-2/child-3 only the step-root is listed.
16:09:43,897 WARN - Steps: master
16:09:43,897 WARN - Steps: step-root
Why are not all steps of the configuration shown?
Georg
sounds like master step of root/child-1/child-2/child-3 is overwritten or inherited incorrectly somewhere in your chain.
Looks like you are executing the script from a different configuration other than "root/child-1/child-2/child-3". The example script is updated to work in this case:
https://support.pmease.com/PMEase/QuickBuild-Scripts-Plugins/topics/3328/groovy-script-to-get-names-of-all-steps-in-a-configuration?0