无法使用自定义变量命名 release(yaml) 管道

时间:2021-02-25 15:22:18

标签: azure-devops azure-pipelines

我配置了由管道资源(构建)触发的发布管道。我根据构建管道设置了一些自定义变量,尝试使用带有构建管道信息的发布管道进行更新。

以下是我的发布管道代码:

            resources:
            pipelines:
            - pipeline: pipeline1
              project: appcom
              source: pipeline-api
              trigger:
                branches:
                - develop
                - feat/*
            -  pipeline: pipeline2
               project: appcom
               source: pipeline2-api
               trigger:
               branches:
               - develop
               - feat/*

          variables:
          - name: alias
            value: $(resources.triggeringAlias)
          stages:
          - stage: ScanImage
            jobs:
            - job: ScanImage
               pool:
                 vmImage: 'ubuntu-16.04'
               steps:
               - script: echo $(alias)

               - task: Bash@3
                 inputs:
                 targetType: 'inline'
                   script: |
                    if [ "$(alias)" == "pipeline1" ]; then
                    echo "##vso[task.setvariable 
                    variable=apiname]$(resources.pipeline.pipeline1.pipelineName)"
                    fi
                - script: echo "##vso[build.addbuildtag]$(apiname)"

当管道被执行时,它说标签已创建,如下图所示 enter image description here 当我去尝试用标签过滤时,它说没有标签,如下图 enter image description here

对此有什么想法吗?a

1 个答案:

答案 0 :(得分:0)

<块引用>

无法使用自定义变量命名 release(yaml) 管道

标签不会直接显示在构建定义的摘要中,但我们可以使用带标签的过滤器来列出哪些管道包含指定的标签:

enter image description here

如果你想直接检查标签,你需要打开一个构建管道:

enter image description here

或者您可以使用 REST API Builds - Get 来检查标签信息:

GET https://dev.azure.com/{organization}/{project}/_apis/build/builds/{buildId}?api-version=6.0

enter image description here

注意:标记已添加到构建 ID 614011,您应该确保检查正确的管道。

相关问题