How to get Git Tag in Azure Pipelines

前端 未结 8 1094
青春惊慌失措
青春惊慌失措 2021-02-07 07:28

In Azure Pipelines, I have enabled git tags to trigger pipelines like so:

trigger:
  branches:
    include:
    - \'*\'
  tags:
    include:
    - \'*\'
<         


        
8条回答
  •  不知归路
    2021-02-07 08:09

    When you configure the pipeline to be triggers with tag the meaning that when new tag is pushed the pipeline start to run. so:

    1) The pipeline will start from the git tag.

    2) I don't understand the question, if you pushed tag test so the tag name will be test.

    If you want to know programmatically if the build trigger was a tag and what is the tag name you can check the environment variable Build.SourceBranch if the build is from a tag the value will be: refs/tags/tagName.

    So just add a PowerShell task and print the value:

    Write-Host $env:Build_SourceBranch
    

提交回复
热议问题