更改 Azure Pipelines 中的当前工作目录 [英] Change current working directory in Azure Pipelines
问题描述
我正在为 Azure Pipelines 中的 Python 包开发 CI (https://github.com/scikit-image/scikit-image/blob/azure-pipelines/azure-pipelines.yml).在某些时候,我需要退出源代码目录以允许 pytest
发现此包的安装,并运行相应的测试.
I'm developing a CI for Python package in Azure Pipelines (https://github.com/scikit-image/scikit-image/blob/azure-pipelines/azure-pipelines.yml). At some point, I need to step out of the source code directory to allow pytest
to discover an installation of this package, and run the corresponding tests.
我面临的问题与 cd
、cd C:
等命令似乎没有造成任何影响有关,因此当前工作目录保持不变(在这种特定情况下,D:a1s
).
The issue I'm facing is related to the fact that cd
, cd C:
, etc commands do not seem to cause any effect, so that the current working directory remains unchanged (in this specific case, D:a1s
).
有没有办法克服所描述的限制?
Is there a way to overcome the described limitation?
推荐答案
找到解决方案花了很多时间,但是,显然,有 一种为特定脚本指定工作目录的方法 -https:///docs.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/command-line?view=vsts&tabs=yaml:
It took many hours to find the solution, but, apparently, there is a way to specify working directory for specific script - https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/command-line?view=vsts&tabs=yaml :
- script: # script path or inline
workingDirectory: #
displayName: #
failOnStderr: #
env: # mapping of environment variables to add
这篇关于更改 Azure Pipelines 中的当前工作目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!