Unable to Override PATH or NVM_DIR Environment Variables with Ubuntu 20.04 Machine Images

Overview

Ubuntu 20.04 images set $BASH_ENV in a way that they can not be overridden via the environment parameter.

For example, the following code will not change the $PATH

steps:
  - run:
      environment:
        PATH: /usr/local/bin
jobs:
  build:
    environment:
        PATH: /usr/local/bin

 

Solution

To work around this issue, customers can add an export step at the top of the run step where the environment variable is used

- run: |
    export PATH=/usr/local/bin
    # additional commands

 

Additional Resources:

Was this article helpful?
1 out of 4 found this helpful

Comments

0 comments

Article is closed for comments.