Welcome to the Inedo Forums! Check out the Forums Guide for help getting started.

If you are experiencing any issues with the forum software, please visit the Contact Form on our website and let us know!

+1 for BM-3239



  • I just wanted to make a post to express my interest in BM-3239, that would allow users to dynamically specify a plan or module to invoke, and see if there is any additional interest from the community. I think with this operation we could get some really powerful flexibility in our workflows. This operation would let us create "wrappers" for our call statements that could do some pretty cool stuff. For example we could more easily aggregate the runtime of specific steps.

    module InvokePlanTimerWrapper<$PlanName, %PlanArguments>
    {
        set $StartTime = $PSEval(Get-Date);
    
        Invoke-Plan $PlanName
        (
            Name: $PlanName,
            Arguments: %PlanArguments
        );
    
        set $EndTime = $PSEval(Get-Date);
    
        set $script = >>
            `$start = [datetime]"$StartTime"
            `$end = [datetime]"$EndTime"
            (New-TimeSpan -Start `$start -End `$end).seconds
        >>;
       
        set $Diff = $PSEval($script);
    
        Log-Information Plan $PlanName took $Diff seconds to complete.;
    }
    

    We could also create a form of retry logic that doesn't rerun steps that already succeeded.

    module InvokePlanReexecuteWrapper<$PlanName, %PlanArguments>
    {
    
        set %ExecutedSteps = %PackageVariable(ExecutedSteps);
        set @ExecutedStepsForEnvironment = @MapItem(%ExecutedSteps, $EnvironmentName);
    
        if $IsReexecution && $ListIndexOf(@ExecutedStepsForEnvironment, $PlanName) == -1
        {
            Invoke-Plan $PlanName
            (
                Name: $PlanName,
                Arguments: %PlanArguments
            );
        
            set @ExecutedStepsForEnvironment = @ListInsert(@ExecutedStepsForEnvironment, $PlanName);
            set %ExecutedSteps = %MapRemove(%ExecutedSteps, $EnvironmentName);
            set %ExecutedSteps = %MapAdd(%ExecutedSteps, $EnvironmentName, @ExecutedStepsForEnvironment);
        
            Set-ReleaseVariable(
                Variable: ExecutedSteps,
                Value: %ExecutedSteps,
                Release: $ReleaseNumber,
                Package: $PackageNumber
            );
        }
    }
    

    Product: BuildMaster
    Version: 6.0.10



  • Thanks for the usecase - that's interesting and a good point in favor of doing this.

    Unfortunately after a brief review I've found that it's a little more technically complex than we first anticipated. I still think that we will do it, but it isn't something we can just drop in the next release.


Log in to reply
 

Inedo Website HomeSupport HomeCode of ConductForums GuideDocumentation