Phil
Phil

Reputation: 1973

Azure Devops environment variable not resolving in task

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

Upvotes: 1

Views: 1716

Answers (1)

Miroslav Ježík
Miroslav Ježík

Reputation: 146

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

https://learn.microsoft.com/en-us/azure/devops/pipelines/process/variables?view=azure-devops&tabs=yaml%2Cbatch#macro-syntax-variables.

Upvotes: 2

Related Questions