Solution
This code executes a procedure that is contained in a Schedule. First it retrieves the Parameters from the Schedule, adds them to a parameter list, and then passes the list in the call to runProcedure.
# # Execute a Procedure based on the Schedule to detect changes # # Params: # projectName # scheduleName # # Returns: # The name of the procedure that it executed # sub ExecuteOneSchedule { my ($projectName, $scheduleName) = @_; my @parameterList; # Retrieve the Entire Schedule my $xPath = InvokeCommander("SuppressLog", "getSchedule", $projectName, $scheduleName); # Add each Actual Parameter to a list of hashes my $nodeset = $xPath->find('//actualParameter'); foreach my $node ($nodeset->get_nodelist) { my $actualParameterName = $xPath->findvalue('actualParameterName', $node); my $actualParameterValue = $xPath->findvalue('value', $node); push (@parameterList, {"actualParameterName" => $actualParameterName, "value" => $actualParameterValue}); } # Run the procedure my $procedureName = $xPath->findvalue('//procedureName'); $xPath = InvokeCommander("SuppressLog", "runProcedure", $projectName, $procedureName, {"scheduleName" => $scheduleName, "actualParameter" => \@parameterList}); return $procedureName; }
This article is part of our Knowledge Base and is provided for guidance-based purposes only. The solutions or workarounds described here are not officially supported by CloudBees and may not be applicable in all environments. Use at your own discretion, and test changes in a safe environment before applying them to production systems.