Azure DevOps - Where is my custom version counter variable stored?

余生颓废 提交于 2020-05-16 12:01:05

问题


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.

Definition of variable

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

Usage of variable

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

回答1:


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

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.



来源:https://stackoverflow.com/questions/58929004/azure-devops-where-is-my-custom-version-counter-variable-stored

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!