Skip to content

Commit

Permalink
Merge pull request #2 from CybercentreCanada/feature/imagetag
Browse files Browse the repository at this point in the history
docker image tag
  • Loading branch information
cccs-jc authored Mar 11, 2021
2 parents 9cd9a8a + 3640c5a commit d9af2dd
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ variables:
containerRegistry: 'uchimera.azurecr.io'
dockerfilePath: '$(Build.SourcesDirectory)/Dockerfile'
tag: '$(Build.BuildId)'
buildTimestamp: $[format('{0:yyyyMMddHHmmss}', pipeline.startTime)]

# Agent VM image name
vmImageName: 'ubuntu-latest'
Expand All @@ -32,6 +33,9 @@ stages:
steps:
- checkout: self

- bash: |
BRANCH_NAME=`echo "$SYSTEM_PULLREQUEST_SOURCEBRANCH $BUILD_SOURCEBRANCH" | sed -r 's/^\s*(refs\/heads\/)?(\S*).*$/\2/' | sed 's/\//_/g'`
echo "##vso[task.setvariable variable=BRANCH_NAME]$BRANCH_NAME"
- task: Docker@2
displayName: Build and push an image to container registry
Expand All @@ -41,5 +45,7 @@ stages:
dockerfile: $(dockerfilePath)
containerRegistry: $(dockerRegistryServiceConnection)
tags: |
latest
$(BRANCH_NAME)
$(BRANCH_NAME)_$(buildTimestamp)_b$(Build.BuildId)

0 comments on commit d9af2dd

Please sign in to comment.