Bhavani Ravi
Bhavani Ravi

Reputation: 2291

How to set path in azure-pipeline using prependpath

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

enter image description here

Upvotes: 6

Views: 7547

Answers (1)

GuruCharan94
GuruCharan94

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

Related Questions