繁体   English   中英

如何在 Azure 管道部署中的另一个模板中的 2 个不同任务之间包含 yaml 模板

[英]How to include a yaml template between 2 different tasks in the another template in Azure pipeline deployment

我是 yaml 管道部署的新手,任何人都可以指出正确的方向,了解如何在 Z3A580F142203677F1F0BC30898F63F5 管道部署的主模板中的不同任务之间包含 yaml 模板。

我创建了 build.yaml 文件,它有几个任务。 现在我需要在 build.yaml 的任务之间包含/调用/使用另一个模板(有一些任务)

我们怎样才能做到这一点?

在此处输入图像描述

您可以直接在作业中的两个任务之间插入步骤模板,如下所示。

  • 步骤模板.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."

注意:您只能在作业中的任务之间插入步骤模板。 作业模板阶段模板不可用。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM