Using Azure Devops 2019 Server (On-Premises)
So I want my agentless job, User Intevention task named "Install" to run only when IsServiceInstalled
variable is 0. I'm able to use this variable only within same job (agent), but not within other (agentless).
No matter what I do, I get an exception stating something like:
Exception Message: Unrecognized value: 'dependencies'. Located at position 21 within expression: and(succeeded(), eq(<whatever i try to put here>, 0))
Code that sets variable:
#Sets IsServiceInstalled to determine if service must be installed or updated
Get-Service "$(RabbitMQServiceName)" -ErrorAction SilentlyContinue
if ($?) {
echo "##vso[task.setvariable variable=IsServiceInstalled;isOutput=true]1"
} else {
echo "##vso[task.setvariable variable=IsServiceInstalled;isOutput=true]0"
}
system.debug=true
and found out [SYSTEM_JOBNAME] --> [__default]
- so I tried setting using and(succeeded(), eq(dependencies.__default.Outputs['IsServiceInstalledTask.IsServiceInstalled'], 0))
- yeah, I get exception Unrecognized value: 'dependencies'
- and no surprise as I never specified a dependency and I don't see where can I specify it within UI.Stage_cb7edb91b40b4747845ae3564bf62723_2_9.Phase_1.__default...
, Phase_1.__default...
or __default...
No matter what I try, I get the same Unrecognized value exception.
The great thing about writing a question is that I'v found the answer in official documentation: NOT SUPPORTED in classic pipeline.
Let me quote:
Use output variables from tasks
Some tasks define output variables, which you can consume in downstream steps, jobs, and stages. In YAML, you can access variables across jobs and stages by using dependencies..
Use outputs in the same job
In the Output variables section, give the producing task a reference name. Then, in a downstream step, you can use the form $(.) to refer to output variables.
Use outputs in a different job
You must use YAML to consume output
From Use output variables from tasks and click on Classic Tab