当我的团队成员在 GitHub 存储库中推送更改时,我的 azure 管道没有触发

My azure pipeline is not triggering when my team members are pushing changes in GitHub repo

我为 GitHub 存储库中存在的 .net 应用程序创建了一个经典的 CI Azure 管道,并在触发器中启用了持续集成,还在分支过滤器中添加了 2 个分支。但是当我的团队成员进行了一些更改并进行了提交时,我的管道没有触发,也没有创建构建。我不明白可能是什么问题,因为我是天蓝色管道的新手

在 DevOps 中,单击左侧导航栏中的管道

Select 您的管道。

点击编辑

然后在新的 window 窗格(左上角)中,您会看到一个触发器选项卡。

在这里您可以配置持续集成设置以触发推送/拉取请求等的构建。

举个例子

继续为开发分支启用集成,因此对该分支的任何推送都会触发构建。

这里有一些故障排除建议,您可以点击this document了解更多详细信息:

  1. Are you using the GitHub app connection to connect the pipeline to GitHub? If you are using a GitHub app connection, follow these steps:

Is the mapping set up properly between GitHub and Azure DevOps? Open a pull request in your GitHub repository, and make the comment /azp where. This reports back the Azure DevOps organization that the repository is mapped to.

If no organizations are set up to build this repository using the app, go to https://github.com/<org_name>/<repo_name>/settings/installations and complete the configuration of the app.

If a different Azure DevOps organization is reported, then someone has already established a pipeline for this repo in a different organization. We currently have the limitation that we can only map a GitHub repo to a single DevOps org. Only the pipelines in the first Azure DevOps org can be automatically triggered. To change the mapping, uninstall the app from the GitHub organization, and re-install it. As you re-install it, make sure to select the correct organization when you are redirected to Azure DevOps.

  1. Are you using OAuth or PAT to connect the pipeline to GitHub? If you are using a GitHub connection, follow these steps:

OAuth and PAT connections rely on webhooks to communicate updates to Azure Pipelines. In GitHub, navigate to the settings for your repository, then to Webhooks. Verify that the webhooks exist. Usually you should see three webhooks - push, pull_request, and issue_comment. If you don't, then you must re-create the service connection and update the pipeline to use the new service connection.

Select each of the webhooks in GitHub and verify that the payload that corresponds to the user's commit exists and was sent successfully to Azure DevOps. You may see an error here if the event could not be communicated to Azure DevOps.

  1. Is your pipeline paused or disabled? Open the editor for the pipeline, and then select Settings to check. If your pipeline is paused or disabled, then triggers do not work.

  2. Have you used variables in defining the trigger or the paths? That is not supported.

  3. Have you excluded the branches or paths to which you pushed your changes? Test by pushing a change to an included path in an included branch. Note that paths in triggers are case-sensitive. Make sure that you use the same case as those of real folders when specifying the paths in triggers.

更新:

您不需要更改github中的webhooks,您需要做的是进入github设置-> Webhooks,检查是否有“最近交付”。如果最近的交付有错误,会指出问题的原因。

如果Azure DevOps和GitHub连接正常,GitHub会自动生成Webhooks。如下图:

“有效载荷URL”的内容是:

https://dev.azure.com/{organization}/_apis/public/hooks/externalEvents?publisherId=github&channelId={channelId}&api-version=6.1-preview

请注意,一个 GitHub 存储库只能连接到一个 Azure DevOps 组织。如果您已连接到多个组织,请保留您当前正在使用的唯一一个。