Azure DevOps-我的自定义版本计数器变量存储在哪里? [英] Azure DevOps - Where is my custom version counter variable stored?

查看:122
本文介绍了Azure DevOps-我的自定义版本计数器变量存储在哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Azure Pipeline文件azure-pipelines.yml,该文件由我的Azure Linux代理运行.接下来,我定义了一个变量myBuildCounter,该变量由一个计数器增加.即使我没有在Azure界面中创建任何变量,变量myBuildCounter的值也会在生成过程中保存并重新使用.有人知道变量值在Azure中的存储位置吗?预先感谢.

I have a Azure Pipeline file azure-pipelines.yml which is run by my Azure Linux agent. Next I have a variable myBuildCounter defined which is increased by a counter. The value of the variable myBuildCounter is saved during builds and its value reused, even though I didn't create any variables in the Azure interface. Does someone knows where the variable value is stored in Azure? Thanks in advance.

变量的定义

variables:
  myBuildCounter: $[counter(variables['myBuildCounter'], 0)]

变量的使用

task: PowerShell@2
      inputs:
        targetType: 'inline'
        script: |
          Write-Host "Build version: $env:MYBUILDCOUNTER"
        failOnStderr: true

推荐答案

似乎您已经在yaml文件的根级别定义了此Pipeline变量.

It appears that you have defined this Pipeline variable at the root level in the yaml file.

这将使其可用于管道中的所有作业和阶段,并且是全局变量.在YAML中定义的全局变量在管道设置用户界面中不可见.

This will make it available to all jobs and stages in the pipeline and is a global variable. Global variables defined in a YAML are not visible in the pipeline settings UI.

作业级别的变量会覆盖根级别和阶段级别的变量.阶段级别的变量会覆盖根级别的变量.

Variables at the job level override variables at the root and stage level. Variables at the stage level override variables at the root level.

请参阅文档以了解更多详细信息.

Refer to this document for more details.

这篇关于Azure DevOps-我的自定义版本计数器变量存储在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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