Wednesday, September 11, 2024

Enabling Manual Triggers for Azure DevOps Pipeline Stages

Azure DevOps pipeline stages now support manual triggers, allowing for more flexibility. There are situations where some stages of a pipeline should run automatically, while others may require manual intervention. This blog explains how to configure a manual trigger for Azure DevOps pipeline stages.

Pre-requisites: Azure DevOps YAML Pipeline

To enable a manual trigger for a specific stage, include the trigger: manual option in the pipeline's YAML definition. Below is an example pipeline demonstrating how to configure a manual trigger for a stage.

trigger:
  branches:
    include:
      - develop

pool: 
  name: "Azure Pipelines"

  
stages:
- stage: StageA
  jobs:
  - job: JobA
    steps:
      - powershell: Write-Host "This is Job A"
        name: checkCondition
  - job: JobB
    condition: in(dependencies.JobA.result, 'skipped')
    steps:
    - powershell:  Write-Host "This is Job B"      

- stage: StageB
  trigger: manual
  jobs:
  - job: JobA
    steps:
      - powershell: Write-Host "This is Job A"
        name: checkCondition
  - job: JobB
    steps:
    - powershell:  Write-Host "This is Job B"   


In this example, the first stage runs automatically, while the second stage requires a manual trigger before execution.





No comments:

Post a Comment