In the tasks of an Azure DevOps pipeline Release, can I reference Environment variables from the registered deployment target in my release tasks where I would normally use a pipeline variable? The target machine is the computer on which the service agent is registered.
For example, I currently have a Pipeline variable:
deploymentFolder [ c:\inetpub\wwwroot\site1 ]
that I reference throughout the release tasks as $(deploymentFolder)
and all targets receive deployment to that disk location, however now I want to grab the environment variable defined on the target named MyDeploymentFolder
(PS $Env:MyDeploymentFolder, or CMD %MyDeploymentFolder%) throughout my tasks instead.
A concrete example is the Delete files task in which I specify:
Source Folder: "$(deploymentFolder)"
however I want to use the target's environment variable MyDeploymentFolder
here, instead.
What I'm ultimately trying to achieve is differ the deployment location per target, and I want the target to define that location for itself.
In the realm of variables,
- if the pipeline var can somehow usurp the value of the environment var per target, that would work too and leave my current pipeline tasks intact.
- if each target could have its down "target variables" assigned in Azure that could be referenced in the tasks, then that might work too, however this doesn't seem to exist.
Am I barking up the wrong tree, and should I instead be cloning the pipeline for each target that needs this type of variance, or is there a mechanism I haven't found in context of a release to achieve this per-target variance?