I have a pipeline with 2 jobs.
- CheckoutAndDeploy (standard agent job)
- WaitDeployStatus (agentless)
In WaitDeployStatus (1) I am trying to use an agentless job with Invoke Rest API. In this step, I need to post on an URL, the URL requires OAuth authentication
I can get the OAuth token from the previous job (CheckoutAndDeploy) and set isOutput=true to make the var available for other jobs (like described in the documentation) but I am unable to use it in job 2.
I already tried:
$(SOMEREF.ACCESS_TOKEN)"
$[ dependencies.Get_Access_Token.outputs['SOMEREF.ACCESS_TOKEN'] ]"
$[ dependencies.Get_Access_Token.CheckoutAndDeploy.outputs['SOMEREF.ACCESS_TOKEN'] ]"
$[ stageDependencies.CheckoutAndDeploy.outputs['SOMEREF.ACCESS_TOKEN'] ]"
To set the variable is a bash task with this code:
TOKEN_RESQUEST=$(command_to_get_the_token)
echo "##vso[task.setvariable variable=ACCESS_TOKEN;isOutput=true]$TOKEN_REQUEST"
Then I use SOMEREF as a reference name to access the variable.
