简体   繁体   English

Azure-Pipelines 构建 - 参考构建中的文件

[英]Azure-Pipelines Build - refer to files in build

I'm trying to build my python based artifact in Azure DevOps.我正在尝试在 Azure DevOps 中构建基于 python 的工件。 I'm working on windows agent.我正在研究 windows 代理。 Here is structure of my code:这是我的代码的结构:

+-- Dir1
+----Version1
+------Build
+--------build.yaml
+------Script
+--------test_file.py
+--------file.py
+------Docs

During my build pipeline I try to run command like below:在我的构建管道中,我尝试运行如下命令:

python $(System.DefaultWorkingDirectory)\Dir1\Version1\Script\test_**

I receive error:我收到错误:

python: can't open file 'd:\a\1\s\Dir1\Version1\Script\test_**': [Errno 22] Invalid argument

When I refer to file directly it's working.当我直接引用文件时,它正在工作。 Does anyone have idea why these asterisk's / wildcards are not working correctly?有谁知道为什么这些星号/通配符不能正常工作?

Azure-Pipelines Build - refer to files in build Azure-Pipelines 构建 - 参考构建中的文件

That because windows' command interpreter does not expand wildcards as UNIX shells do before passing them to the executed program or script .这是因为Windows 的命令解释器不会像 UNIX shell 在将通配符传递给执行的程序或脚本之前那样扩展通配符

To resolve this issue, you could use the glob module, which provides a platform-independent way of doing wildcard matching.要解决此问题,您可以使用glob模块,它提供了一种与平台无关的通配符匹配方式。

Check this thread and the document for some more details.检查此线程文档以获取更多详细信息。

BTW, if you are using windows 10, you can use the wildcards with Bash task.顺便说一句,如果您使用的是 windows 10,则可以将通配符与 Bash 任务一起使用。

Hope this helps.希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM