How to set path in azure-pipeline using prependpath

强颜欢笑 提交于 2020-01-23 03:49:05

问题


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


回答1:


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...


来源:https://stackoverflow.com/questions/57322531/how-to-set-path-in-azure-pipeline-using-prependpath

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!