简体   繁体   English

Azure DevOps:我们能否识别从变更集编号触发的构建?

[英]Azure DevOps: Can we identify Builds triggered from a changeset number?

I have certain builds set for Continuous Integration, ie, build for every check-in.我为持续集成设置了某些构建,即为每次签入构建。 I have an automated method to perform code merge and check-ins;我有一个自动化的方法来执行代码合并和签入; now I want to get the list of builds triggered for a particular changeset created.现在我想获取为创建的特定变更集触发的构建列表。 Is there any way we could get this information?我们有什么办法可以得到这些信息?

I would use the the REST API so you could check for builds that were run:我将使用 REST API 以便您可以检查运行的构建:

GET https://dev.azure.com/{organization}/{project}/_apis/build/builds

will return all builds that you could then go through and check for more details.将返回您可以通过 go 的所有构建并检查更多详细信息。 You can also have more filters in the request (for example based on the build definition).您还可以在请求中包含更多过滤器(例如基于构建定义)。

The build specifics you could then get via:然后您可以通过以下方式获得构建细节:

GET https://dev.azure.com/{organization}/{project}/_apis/build/builds/<buildid>

This will return you the infos like:这将返回您的信息,如:

"triggerInfo": {
    "ci.sourceBranch": "refs/heads/master",
    "ci.sourceSha": "0fcb5a27ca2f73561dde0a066a1ec1781128fa81",
    "ci.message": ""
},
...
"sourceBranch": "refs/heads/master",
"sourceVersion": "0fcb5a27ca2f73561dde0a066a1ec1781128fa81",

for builds queued from a git repository or对于从 git 存储库排队的构建或

{ ...
  "sourceBranch": "$/Build Test",
  "sourceVersion": "93",
... }

for TFVC repositories.用于 TFVC 存储库。 It actually also would contain a trigger info but I don't have any build around that was triggered automatically based on TFVC.它实际上也将包含触发信息,但我没有任何基于 TFVC 自动触发的构建。

The sourceVersion in git will be the commit hash, where in TFVC it's the changeset. sourceVersion中的 sourceVersion 将是提交 hash,其中在 TFVC 中它是变更集。

More details on the REST API can be found in the Microsoft Docs有关 REST API 的更多详细信息,请参阅Microsoft Docs

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

相关问题 azure devops 缺少 BUILDS - BUILDS are missing from azure devops 能否在 Azure DevOps 中触发 CD 管道之前组合多个 CI 构建? - Can you combine multiple CI builds prior to a CD pipeline being triggered in Azure DevOps? Azure Devops 构建和发布中的最大变量数 - Azure Devops max number of variables in builds and releases 有没有办法通过 API 跟踪 Azure DevOps 中触发的构建? - Is there a way via API to track triggered builds in Azure DevOps? Azure DevOps Pipelines,作业如何知道它是从计划中触发的? - Azure DevOps Pipelines, how can the job know it was triggered from a Schedule? Azure 构建列表中的 DevOps 字段值 - Azure DevOps Field Values from list of builds 从特定变更集从 TFS 迁移到 Azure DevOps 服务 - Migration from TFS to Azure DevOps Services from a certain Changeset 我们可以从 Azure Devops 管道提出并合并拉取请求吗? - Can we raise and merge a pull request from Azure Devops pipelines? 使用Azure DevOps REST Api,除列出所有内部版本外,如何通过内部版本号获取内部版本? - Using Azure DevOps REST Api how can I get the build by its build number, except by listing all the builds? 在 azure DevOps 中将构建从一个管道复制到另一管道 - Copy Builds from one pipeline to other pipeline in azure DevOps
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM