I want to define the PATH
only once for the whole pipeline.
Is this possible?
I’ve done this, but it doesn’t work:
trigger:
- master
jobs:
- job: Application
pool:
vmImage: ubuntu-latest
steps:
- task: CmdLine@2
displayName: "Install flutter"
inputs:
workingDirectory: $(Agent.ToolsDirectory)
script: |
git clone https://github.com/flutter/flutter.git -b stable --depth 1
export PATH="$PATH:`pwd`/flutter/bin"
echo "##vso[task.setvariable variable=path;isOutput=true]$PATH"
flutter config --no-analytics
yes | flutter doctor --android-licenses
- task: CmdLine@2
displayName: "flutter get"
inputs:
script: |
flutter pub get
2
Answers
The solution is to add the
BASH_ENV: "~/.profile"
variable and put path in~/.profile
.I think this is basically a Linux issue.
See the Ubuntu official document:
https://help.ubuntu.com/community/EnvironmentVariables#System-wide_environment_variables
This is why the variable not been passed, it only lives in the first terminal.
Please check the system wide environment variables in the documents. I think you need to change something in the machine (edit some files or add some files).