如何为基于YAML的管道创建管道变量? [英] How do I create pipeline variables for a YAML-based pipeline?

查看:107
本文介绍了如何为基于YAML的管道创建管道变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用设计器/类构建管道,您可以定义具有默认值的管道变量,以将其传递到任务中.如何对基于YAML的管道执行相同的操作?

With designer/class build pipeline, you can define pipeline variables with default values to be passed into the tasks. How do I do the same for a YAML-based pipeline?

我想创建三个构建管道,每个构建管道都将一个变量设置为不同的值.所有这三个都指向一个YAML文件. 文档状态:

I want to create three build pipelines, each would have a single variable set to a different value. All three point to a single YAML file. The documentation states:

您可以选择允许在队列时间设置哪些变量,以及哪些变量由管道作者固定.如果变量出现在YAML文件的变量块中,则它是固定的,不能在队列时间被覆盖.要允许在队列时间设置变量,请确保它没有出现在管道或作业的变量块中.您可以在编辑器中设置一个默认值,排队的人可以覆盖该值.

You can choose which variables are allowed to be set at queue time and which are fixed by the pipeline author. If a variable appears in the variables block of a YAML file, it is fixed and cannot be overridden at queue time. To allow a variable to be set at queue time, make sure it doesn't appear in the variables block of a pipeline or job. You can set a default value in the editor, and that value can be overridden by the person queuing the pipeline.

目前尚不清楚如何对YAML文件执行此操作.

It's not clear how to do this for YAML file.

我可以创建一个模板YAML文件,并为每个调用该模板文件的配置值创建一个单独的YAML文件,但是我无法在运行时设置配置值.

I can create a template YAML file, and an individual YAML file for each config value that calls the template file, but then I can't set configuration value at run-time.

推荐答案

在编辑构建定义时(至少在具有默认体验的情况下,不是在创建时).您需要单击3个点,然后从列表中选择variables:

when you edit the build definition (not when you create it, at least with default experience). you'd need to click on 3 dots and pick variables from the list:

,在那里您可以定义变量,并且它们会有一个复选框-Settable at queue time.

and there you would be able to define variables, and they would have a checkbox - Settable at queue time.

这篇关于如何为基于YAML的管道创建管道变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆