With Azure Pipelines And Poetry, Is There Any Way To Avoid Sourcing ~/.poetry/env In Every Script?
I currently use the script below to build my package and publish it to a private Azure Artifacts feed. In every script, I have to run the line source $HOME/.poetry/env or it cannot
Solution 1:
source $HOME/.poetry/env
only applies for current shell. You need to set Poetry's bin directory ($HOME/.poetry/bin) in the system PATH
of the agent.
Please add echo "##vso[task.setvariable variable=PATH]${PATH}:$HOME/.poetry/bin"
in your first script task to set path $HOME/.poetry/bin
to system PATH variable. Then you wont need to add source $HOME/.poetry/env
in the following script tasks any more. Please check below example.
echo "##vso[task.setvariable...."
will only take effect in the following tasks.
So you still need to use "source $HOME/.poetry/env" in the first script task.
Please check Set variables in scripts for more information.
- script: |
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python
#below script will only take effect in the following tasks. #So you still need to use "source $HOME/.poetry/env" in the first script task.echo"##vso[task.setvariable variable=PATH]${PATH}:$HOME/.poetry/bin"source$HOME/.poetry/env
poetry install
displayName: 'Install package and tools'
- script: |
poetry --version
condition: always()
Post a Comment for "With Azure Pipelines And Poetry, Is There Any Way To Avoid Sourcing ~/.poetry/env In Every Script?"