Search code examples
azureazure-devopsazure-pipelines-release-pipelineazure-pipelines-yaml

Azure pipeline build name (Last commit)


Hi everyone I was wondering if is there any chance to modify in the build name the last commit message, for instance as it's shown in the below image, we always see the buildname followed by the last commit from the repo.

enter image description here

this pipelines is using the multirepo feature, so when the pipeline is triggered by azure build policy it shows the last commit of the pull request and when it triggered manually it shows the last commit from the hosted repo, so in that case we would like to change that message for other generic message.

I have seen in the microsoft docs that we are able to change the name of the build, but I didnt see anything related with the last commit message.


Solution

  • The commit message is the value of Build.SourceVersionMessage that corresponds to the message on Build.SourceVersion commit.

    There is no method to change the displayed commit message. In fact, it is not part of the build name (Build.BuildNumber). It just displays together with build name in the title line as part of the summary. Changing the value of build name will not affect the displayed commit message.


    In addition, For YAML pipelines, Azure DevOps has provided a built-in feature to hide the commit message and only display the build name in the title line of a pipeline run. For more details, see "Disable showing the last commit message for a pipeline run".

    If you prefer this, you can try it.

    For example:

    # Set the format of build name.
    name: $(Date:yyyyMMdd).$(Rev:rr)
    
    # Set the triggers.
    trigger:
      . . .
    
    # Disable showing the last commit message.
    appendCommitMessageToRunName: false
    
    stages:
    - stage: A
      displayName: 'Stage A'
      . . .
    

    enter image description here