更改Azure Pipelines中的当前工作目录 [英] Change current working directory in Azure Pipelines
问题描述
我正在Azure管道中为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:\a\1\s
).
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:\a\1\s
).
有没有办法克服上述限制?
Is there a way to overcome the described limitation?
推荐答案
找到解决方案花了很多时间,但是很显然,有一种 方法可以为特定脚本指定工作目录- https://docs.microsoft.com/zh-CN/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屋!