Change current working directory in Azure Pipeline

2020-03-09 02:15发布

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.

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?

1条回答
爷的心禁止访问
2楼-- · 2020-03-09 03:02

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
查看更多
登录 后发表回答