michal2616
michal2616

Reputation: 117

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 e.g. variable Build.SourceBranch is resolved properly

Upvotes: 2

Views: 1535

Answers (1)

Mengdi Liang
Mengdi Liang

Reputation: 19026

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.

Upvotes: 2

Related Questions