Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Append to PATH on Azure Devops?

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?

like image 659
SirCipher Avatar asked Feb 17 '26 10:02

SirCipher


2 Answers

There is a special logging command for this:

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

See more info here.

like image 176
Shayki Abramczyk Avatar answered Feb 19 '26 12:02

Shayki Abramczyk


Got it, it was a simple syntax error

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

I'd used {} instead of ().

like image 23
SirCipher Avatar answered Feb 19 '26 13:02

SirCipher



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!