1

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

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

1 Comment

First option worked, guess i didn't realize. Thank you!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.