Reputation: 2291
I am trying to set path in an Azure-pipeline using prepend path
echo '##vso[task.prependpath]$(HOME)/miniconda3/bin'
echo "New path 1... $PATH"
##vso[task.prependpath]($HOME)/miniconda3/bin
echo "New path 3... $PATH"
##vso[task.prependpath]($env.HOME)/miniconda3/bin
echo "New path 3... $PATH"
##vso[task.prependpath]$(env.HOME)/miniconda3/bin
echo "New path 4... $PATH"
##vso[task.prependpath]$(env.home)/miniconda3/bin
echo "New path 5... $PATH"
##vso[task.prependpath]$(home)/miniconda3/bin
echo "New path 6... $PATH"
None of this sets the path, but when doing export PATH=$HOME/miniconda3/bin:$PATH
the path is set.
How to set PATH
variable with HOME
in azure-pipeline
Upvotes: 6
Views: 7547
Reputation: 922
From the task.prepend docs
The specified directory is prepended to the PATH. The updated environment variable will be reflected in subsequent tasks.
Referencing $PATH from subsequent tasks does the trick.
Build Step 1
echo '##vso[task.prependpath]$(HOME)/miniconda3/bin'
Build Step 2
echo "$PATH"'
## This prints /home/vsts/miniconda3/bin:/usr/share/rust/...and on it goes...
Upvotes: 14