1
votes

Is it possible to create a wrapper pipeline in Azure DevOps that simply runs two or more independent pipelines (in parallel) and does nothing else?

I have a problem to solve. and the scenario looks like this "*

  1. In my project, I have say 9 teams and each designing separate Sanity Test Script. All of them have their own existing Sanity Pipeline. i.e. 9 Sanity Pipelines*
  2. There is a plan that there will be only One Master/ Wrapper pipeline and this in turn calls upon 9 child pipelines pertaining to Sanity
  3. When master run by Release Engineer or IT Area lead to get report, the child pipelines run in Parallel
  4. Also in master Pipeline, I do not want to be too much lengthy. Simply I want to mention the name of Child pipeline in my individual Job tag ( with params may be ) and it will run. easy configurable " So I was thinking to use following at my master pipeline: resources: pipelines: pipeline: Sanity1 Source: P00xxx-Sanity1-Pipeline pipeline: Sanity2 Source: P00xxx-Sanity2-Pipeline This list should be easily expandable....... Then How in Jobs--> Job --> Steps can I run the pipeline using alias, e.g. Sanity1 ?? Any example code snippet?
3
I don't have a ready answer but you can split the steps from the rest of the build process by using templates. That was both the individual builds can include their 1 steps template in a job and the big build can include 9 jobs each referencing a different steps template, one from each sanity build.jessehouwing
This repo shows how to split the steps from the job definition, making is easy to re-use the steps in multiple pipelines: github.com/Microsoft/vsts-team-calendar/tree/masterjessehouwing
Hi @user2571588 .Is there any update about this ticket? Feel free to let me know if the answers could give you some help. Just a remind of this.Kevin Lu-MSFT

3 Answers

0
votes

You can use PowerShell and rest API (Builds - Queue). Add PowerShell step and compose any run sequence. Here you can find different examples to queue builds:

  1. Build Pipeline using powershell
  2. Trigger another build exist in project in Azure Devops
0
votes

According to your description, you can try to use parameters and conditions to set up the pipeline.

You can try the following Yaml sample:

trigger:
- none
parameters:
- name: pipeline1
  displayName: Gradle sample #PipelineName
  type: boolean
  default: false
- name: pipeline2
  displayName: groovy-spring-boot-restdocs-example.git #PipelineName
  type: boolean
  default: false
- name: pipeline3
  displayName: Gradle sample-CI  #PipelineName
  type: boolean
  default: false



pool:
  vmImage: 'windows-latest'

steps:
- ${{ if eq(parameters.pipeline1, true) }}:
  - task: TriggerPipeline@1
    inputs:
     serviceConnection: 'TestBuild'
     project: '966ef694-1a7d-4c35-91f3-41b8c5363c48'
     Pipeline: 'Build'
     buildDefinition: 'Gradle sample' #PipelineName
     Branch: 'master'

- ${{ if eq(parameters.pipeline2, 'true') }}:
  - task: TriggerPipeline@1
    inputs:
     serviceConnection: 'TestBuild'
     project: '966ef694-1a7d-4c35-91f3-41b8c5363c48'
     Pipeline: 'Build'
     buildDefinition: 'groovy-spring-boot-restdocs-example.git' #PipelineName
     Branch: 'master'

...

Explanation:

I use the Trigger Azure DevOps Pipeline task from the Trigger Azure DevOps Pipeline Extension to trigger the child pipelines.

The parameters is used to list the pipeline names and the if condition is used to determine whether the pipeline name is selected.

Result:

When you run the pipeline you could select the checkbox.

enter image description here

If the pipeline name has been selected, the corresponding task will run and trigger the corresponding pipeline.

This should make the selection interface clearer.

0
votes

Another approach would be to take the pipeline and leverage templates. The wrapper pipeline can call a template which will leverage all the desired tasks and execution and can be setup to run in parallel as part of the pipeline.

Here's a blog post about this