Score:0

Can the Release pipeline reference the target's environment vars in places where pipeline vars are commonly used, to vary values per target?

us flag

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?

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.