Home > Software engineering >  Azure Devops environment variable not resolving in task
Azure Devops environment variable not resolving in task

Time:12-22

In an Azure Devops Build pipeline, I'm setting an environment variable in Powershell, like below: Setting the variable

And i know the variable works in another powershell task, because of this test: viewing the variable

But I'm not able to actually use this in another, non-powershell task. See this docker build/push task where i'm trying to add a tag. I get an error saying that it can't find that variable. Is my notation wrong somehow? I've tried multiple different variations on the screen shot below, but none have worked. docker invalid variable

CodePudding user response:

The notation $env:LOCALTAG is powershell specific. I think you should use the macro syntax $(LOCALTAG) (without $env)

https://docs.microsoft.com/en-us/azure/devops/pipelines/process/variables?view=azure-devops&tabs=yaml,batch#macro-syntax-variables.

  • Related