Issue
When you use a manual task in your pipelines, it is often necessary to get information on the user or users who approved the task.
Environment
-
CloudBees CD/RO 2024.12 and older versions
Resolution
There are multiple potential approaches that you could take to cover this use case. One of them would be to create a task of type "Command" that would get that information for you.
Command shell: ec-perl
use strict; use ElectricCommander; my $cmdr = ElectricCommander->new(); # Returns an xPath object containing the runtime details. my $xpath = $cmdr->getPipelineRuntimeDetails({flowRuntimeId => "$[/javascript myPipelineRuntime.flowRuntimeId]"}); # We search for the corresponding attribute to get the value. my $approver = $xpath->find("//approvedByUsers/approvedBy"); print "$approver"
This is a simple approach to cover the use case at hand.