1

I'm new to yaml pipeline deployments, Can any point me to the right direction on how to include a yaml template between different tasks in the main template in Azure pipeline deployment.

I have created build.yaml file which has several tasks. Now I need to include/call/use another template (which has some tasks) in between the tasks in build.yaml

how can we achieve this ?

enter image description here

Raghu Hoskote
  • 117
  • 2
  • 14

1 Answers1

3

You can directly insert a step template between two tasks in a job like as below.

  • step-template.yml
steps:
- task: Bash@3
  displayName: 'Insert step'
  inputs:
    targetType: inline
    script: echo "This step is inserted form the templates."
  • azure-pipelines.yml
steps:
- task: Bash@3
  displayName: 'Before inserted step'
  inputs:
    targetType: inline
    script: echo "This step is before the inserted step."

- template: step-template.yml

- task: Bash@3
  displayName: 'After inserted step'
  inputs:
    targetType: inline
    script: echo "This step is after the inserted step."

Note: You can only insert Step templates between tasks in a job. The Job templates and Stage templates are not available.

Bright Ran-MSFT
  • 5,190
  • 1
  • 5
  • 12