首页 > 解决方案 > azure devops 变量从任务到模板

问题描述

我需要将变量传递到模板中。例如,Small(见下文)的输出应作为输入传递给介质。这怎么可能?

template: windows-tests.yml
parameters:
integration_tests: ["Small", "Medium"]
check_status: "$(Powershell1.var)"

除了上述之外,我想 从构建步骤中添加 o/p 将存储在 checkstatus 变量中,并将传递给模板。

Powershell1.var将被小测试使用,然后生成一个需要被中等使用的值。

标签: windowstemplatesvariablesazure-devopsdevops

解决方案


我需要将变量传递到模板中。

您可以参考此文档了解如何在模板中传递变量的说明。

(见下文)的输出Small应作为输入传递给Medium.

这是脚本:

模板:

parameters:
- name: Medium
  type: {data type of `Medium`}
  default: {defualt value of `Medium`}

管道:

extends:
  template: {template file}
  parameters:
      Medium: $(Small)

我想从构建步骤中添加 o/p 将存储在 checkstatus 变量中,并将传递给模板。

这是脚本:

模板:

parameters:
- name: check_status
  type: string
  default: "$(Powershell1.var)"

管道:

extends:
  template: {template file}
  parameters:
      check_status: "$(Powershell1.var)"

推荐阅读