[英]How to use glob pattern in workingDirectory in azure yaml pipeline task?
In one of the task in onebranch Azure pipelines, I am installing one package say abc.在 onebranch Azure 管道中的一项任务中,我正在安装一个 package say abc。 After installation the folder gets created named abc.some_version (like abc.1.0.1).
安装后会创建名为 abc.some_version 的文件夹(如 abc.1.0.1)。 But the installation of the package installs the latest package. So the folder name may get changed.
但是安装 package 会安装最新的 package。因此文件夹名称可能会更改。 In next task I want to go to the folder inside above installed package /packages/abc.1.0.1/build to execute some command
abc.exe do_something
.在下一个任务中,我想 go 到上面安装的文件夹 package /packages/abc.1.0.1/build 来执行一些命令
abc.exe do_something
。
- script: |
nuget install abc
displayName: Install abc
workingDirectory: $(Build.SourcesDirectory)\src
- script: |
abc.exe do_something -o "$(Build.SourcesDirectory)\src"
displayName: Create
workingDirectory: $(Build.SourcesDirectory)\src\packages\abc.1.0.1\build
I want to use glob pattern in workingDirectory parameter of script like $(Build.SourcesDirectory\src\packages\abc.*\build我想在脚本的 workingDirectory 参数中使用 glob 模式,例如 $(Build.SourcesDirectory\src\packages\abc.*\build
So for future if any new package version comes, I dont have to change the yaml file again.因此,如果将来有任何新的 package 版本出现,我不必再次更改 yaml 文件。 After using the '*' in the workingDirectory path, I found that azure pipeline is taking * as a part of path itself.
在 workingDirectory 路径中使用“*”后,我发现 azure 管道将 * 作为路径本身的一部分。
Is there any way I can match the pattern inside workingDirectory or is there any other way to do this?有什么方法可以匹配 workingDirectory 中的模式,或者有其他方法可以做到这一点吗?
Glob pattern is not supported when defining in在中定义时不支持全局模式
workingDirectory: $(Build.SourcesDirectory)\src\packages\abc.1.0.1\build
工作目录:$(Build.SourcesDirectory)\src\packages\abc.1.0.1\build
You must hard code in the above scenario.您必须在上述情况下进行硬编码。
Glob pattern will work well in command line task Try command line to "cd" to the path. Glob 模式在命令行任务中运行良好尝试命令行“cd”到路径。
cd C:\test\*\1
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.