microsoft / azure-pipelines-tasks

Tasks for Azure Pipelines
https://aka.ms/tfbuild
MIT License
3.49k stars 2.61k forks source link

[enhancement]: Add ability to batch yaml pipeline by all triggers #19478

Open PatrickMunsey opened 9 months ago

PatrickMunsey commented 9 months ago

Task name

Add ability to batch yaml pipeline by all event triggers

Describe your feature request here

Current Behaviour

Currently when ymal pipeline triggers are configured for multiple tags, if multiple tags are pushed at the same time to the same commit and branch, multiple builds will be triggered even if batch: true. This is because batch only batches builds triggered by the same event type.

trigger:
  batch: true
  tags:
    include:
      - '@app1@*'
      - '@app2@*'
      - '@api1@*'

Proposal

Add some sort of configuration that would allow for broader batching of a pipelines builds across all triggers. If 2 or more tags are pushed to the same commit at the same time, only one build of the pipeline should be run. e.g.

# maintains current behaviour
trigger:
  batch: true

perhaps extend current configuration to allow for something like

# Batches all pipeline event triggers so a single build for the entire pipeline only happens at a time.
trigger:
  batch: 
    - tags
    - branches

Why is this needed

I have a deployment pipeline for an application that consists on multiple sub libraries (infra, k8s charts, app, api etc.). Each of these are versioned and tagged so that docker builds etc are versioned correctly. Whenever each of these components/ tags are updated, I only need to trigger the associated pipeline once to ensure the current deployment is synced to the current verison for all sub libraries.

There is no way to make it so that the pipeline is only run once if multiple tags are updated and pushed to a single commit.

ismayilov-ismayil commented 8 months ago

Hi @PatrickMunsey thanks for reporting! We are working on more prioritized issues at the moment, But will get back to this one soon.