azure-devopscontinuous-integrationazure-pipelines-build-task

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?


Solution

  • Got it, it was a simple syntax error

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

    I'd used {} instead of ().