通过 REST API 处理 Azure DevOps 管道资源
我有一个 Azure DevOps 管道,下面给出了资源部分,
resources:
repositories:
- repository: test
type: git
name: Hackfest/template
pipelines:
- pipeline: Build
source: mybuild
branch: main
# version: # Latest by default
trigger:
branches:
include:
- main
我尝试使用 REST API 调用来调用管道。其余 api 调用的主体如下所示
$body='{
"definition": { "id": "3321" },
"resources": {
"pipelines": {
"Build": {
"version": "20220304.15",
"source": "mybuild"
}
}
},
"sourceBranch": "main"
}'
使用上面的 json 字符串,我可以调用管道构建,但它不会从构建“mybuild”的版本 20220304.15 中选取工件。相反,它采用 mybuild 的最新工件版本并开始构建。
我应该如何修改上面的正文字符串以选择“mybuild”的正确版本?
I have an Azure DevOps pipeline with the resource section is given below
resources:
repositories:
- repository: test
type: git
name: Hackfest/template
pipelines:
- pipeline: Build
source: mybuild
branch: main
# version: # Latest by default
trigger:
branches:
include:
- main
I'm trying to invoke the pipeline using a rest api call. The body of the rest api call is given below
$body='{
"definition": { "id": "3321" },
"resources": {
"pipelines": {
"Build": {
"version": "20220304.15",
"source": "mybuild"
}
}
},
"sourceBranch": "main"
}'
With the above json string I'm able to invoke the pipeline build, but it is not picking the artifacts from version 20220304.15 of the build "mybuild". Rather it is taking the latest artifact version of mybuild and starting the build.
How I should modify the above body string to pick the correct version of the "mybuild"?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用 运行 - 运行管道 这对我有用:
With the Runs - Run Pipeline this is worked for me: