7

I need to append to the PATH environment variable on an Azure Devops pipeline. I have tried running a script to do it but it does not work:

- script: |
echo '##vso[task.setvariable variable=PATH]${PATH}:some/path/'

This fails to set the path and also results in subsequent scripts failing with the following:

##[error]Unable to locate executable file: 'bash'. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.

What do I need to do in order to set this?

SirCipher
  • 933
  • 1
  • 7
  • 16

2 Answers2

15

There is a special logging command for this:

echo '##vso[task.prependpath]some\path'

See more info here.

Shayki Abramczyk
  • 36,824
  • 16
  • 89
  • 114
12

Got it, it was a simple syntax error

echo '##vso[task.setvariable variable=path]$(PATH):/dir/to/whatever'

I'd used {} instead of ().

SirCipher
  • 933
  • 1
  • 7
  • 16