简体   繁体   中英

Azure Build.SourceVersionMessage returns Null on pipeline task level

In Azure pipeline I use Build.SourceVersionMessage variable to get last commit message. Based on that I want to decide if to build docker image or not (if commit message contains 'BUILD-DOCKER' then build docker image):

  ...
- task: Docker@0
  condition: and(succeeded(), contains(variables['Build.SourceVersionMessage'], 'BUILD-DOCKER'))
  ...

Problem is that during pipeline execution commit message is a null:

Evaluating: and(succeeded(), contains(variables['Build.SourceVersionMessage'], 'BUILD-DOCKER'))
Expanded: and(True, contains(Null, 'BUILD-DOCKER'))
Result: False

Any idea why is it null?

Additionally eg variable Build.SourceBranch is resolved properly

You did not do anything wrong. Just, apologize to say, this is the issue which caused by us.

Because of some design reason which based considering on security , this variable was deleted from system by us. Our team has prepared the fixed code(revoke this deletion) and the PR is in progress.

The deployment procedure will be released as soon as possible. After the released finished, this variable will be shortly injected into the environment again.

Check this ticket to get the in time prompt by our engineer.


You can use below script to check the available variables in system we are still providing:

- task: Bash@3
  inputs:
    targetType: 'inline'
    script: 'env | sort'

Please choose one from its result to set as in condition as a temporary work around which would not affect your build process.

I still have the same issue:

在此处输入图片说明

Azure DevOps variable variables['Build.SourceVersionMessage'] show 'Null' but the ENV has valid values $BUILD_SOURCEVERSIONMESSAGE

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM