Trigger Pipeline

Initiate execution of a pipeline from another pipeline.

This step is useful for splitting the automation process in two or more pipelines for better management and reusability of automation.

This step will initiate the pipeline execution and will not wait for pipeline to finish. Pipeline execution will continue running asynchronously.

#Syntax

YAML

steps:
  step-name:
    type: trigger-pipeline
    pipeline: "2efeaf06-7d87-4092-ba66-94877c6f2d47" # pipeline ID
    branch_filter: master # optional
    ref: refs/heads/master # optional
ParameterDescriptionRequired
titleThe display name of the step.No
typeThe type of the Microtica built-in step.
Should always be trigger-pipeline for this type of step.
Yes
pipelineThe ID of an existing pipeline to be triggered.Yes
branch_filterInitiate pipeline execution only for commit/manual trigger on specified branch.
If not specified, pipeline will be triggered on every pipeline execution.
E.g. develop, feature/upgrade-eks etc.
No
refBranch or tag ref the triggered pipeline should pull the code from.

Default: refs/heads/master
No

#Trigger pipeline when commits are made on specific branch

Microtica allows you to trigger another pipeline only if the parent pipeline was trigged from a specific branch or tag.

This is very useful for use-cases when you want to split pipeline logic in two or more pipelines. For example, you can have one pipeline that runs the build, test and packaging and triggers another pipeline that deploys the code on specific environment (dev, test, prod) based on branch the parent pipeline was triggered from.

microtica.yaml

steps:
  Clone:
    title: Clone my source code from Git
    type: git-clone

  BuildAndTest:
    title: Build and test my service
    image: node:12-alpine
    commands:
     - npm install
     - npm run build

  TriggerAnotherPipeline:
    title: Trigger my deployment pipeline
    type: trigger-pipeline
    pipeline: "2efeaf06-7d87-4092-ba66-94877c6f2d47" # pipeline ID
    branch_filter: develop
    ref: refs/heads/develop

Given the above configuration, the pipeline will trigger another pipeline with ID 2efeaf06-7d87-4092-ba66-94877c6f2d47 only if the parent pipeline was triggered from branch develop.

By setting the ref value to develop branch we tell the pipeline to pull the code from develop branch.