简体   繁体   English

如何在 Azure DevOps 上跟踪是什么触发了我的管道?

[英]How to track what triggered my pipeline on Azure DevOps?

I am using YML file to configure my azure pipelines.我正在使用 YML 文件来配置我的 azure 管道。 My pipeline can either be triggered by new commits to development branch and/or scheduled cron.我的管道可以由对开发分支和/或计划的 cron 的新提交触发。 How can I track which triggered the pipeline?如何跟踪哪个触发了管道? I wanted to do some task based on what triggered by pipeline, whether from a new commit or a cron.我想根据管道触发的内容执行一些任务,无论是新提交还是 cron。 It's a small add-on task, so I am avoiding writing a new pipeline to separate the tasks.这是一个小的附加任务,所以我避免编写一个新的管道来分离任务。 Thanks in advance!提前致谢!

Here is my code sample:这是我的代码示例:

trigger:
  - development

schedules:
  - cron: '0 0 * * *' # will run midnight every day
    displayName: 'Midnight tests' (UTC - 7:00)'
    branches:
          include:
            - development
        always: true

stages:
### do some work

We could add task bash and enter script printenv to print all pipeline env variable.我们可以添加任务 bash 并输入脚本printenv来打印所有管道环境变量。 Then we could see the variable BUILD_REASON , we can track this variable to check how the build pipeline is triggered.然后我们可以看到变量BUILD_REASON ,我们可以跟踪这个变量来检查构建管道是如何触发的。

Schedule is trigger from cron, IndividualCI is trigger from commit push. schedule 是由 cron 触发的,IndividualCI 是由提交推送触发的。 You could check the pic below.你可以查看下面的图片。

在此处输入图片说明

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

相关问题 Azure Devops捕获触发管道的用户` - Azure Devops capture the user who triggered the pipeline ` 触发管道使用不同的提交作为 Azure DevOps 中的触发管道 - Triggered pipeline uses different commit as triggering pipeline in Azure DevOps Azure DevOps 发布管道:如何复制到我的 VM - Azure DevOps Release Pipeline: How to copy to my VM 当新图像在不同的容器注册表上可用时,如何触发azure devops构建管道? - How can azure devops build pipeline be triggered when a new image is available on different container registries? azure devops 管道中的服务器作业是什么意思? - What is meant by server jobs in azure devops pipeline? Azure Devops:如何配置我的管道脚本以触发具有不同 repo 的另一个管道? - Azure Devops: how configure my pipeline script to trigger another pipeline with different repo? 在 azure devops 中:将 docker 容器部署到 azure 时,如何将我的管道变量作为 appsettings 注入? - In azure devops: how can I inject my pipeline variables as appsettings when deploying a docker container to azure? 如何将变量传递给 Azure DevOps 运行管道 - How to pass variable to Azure DevOps Run Pipeline 如何在 Azure DevOps 管道 (Salesforce) 中增加标签 - How to increment tags in Azure DevOps Pipeline (Salesforce) 如何从 Azure DevOps 触发 AzureML 管道? - How to trigger an AzureML Pipeline from Azure DevOps?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM