need to tag image with first 7 characters of commit has value in azure build pipeline. but unable to get it , missing syntax issue somewhere.
tried as below
- task: Bash@3
inputs:
targetType: 'inline'
script: |
# Write your commands here
echo "##vso[task.setvariable variable=dockertag] $(build.sourceversion) | cut -c-7)"
echo "$dockertag"
dockertag is used as tag in docker build task in pipeline.
it does not output anything . am i missing anything or do we have any alternative way of doing it.