Skip to content

Instantly share code, notes, and snippets.

@drch-
Created September 6, 2018 02:22
Show Gist options
  • Save drch-/5ac3e5262c4e8497e83cc9fe52d3feb9 to your computer and use it in GitHub Desktop.
Save drch-/5ac3e5262c4e8497e83cc9fe52d3feb9 to your computer and use it in GitHub Desktop.
conditionally run template depending on branch - doesn't work
# build docker image
- template: tasks/_docker-build.yml
parameters:
workingDirectory: $(projectBaseDir)
tag: $(dockerImage)-$(Build.BuildId)
# tag and push images if branch is master or develop
- ${{ if in('$(Build.SourceBranchName)', 'develop', 'master') }}:
- template: tasks/_awscli-docker-login.yml
parameters:
awsSecret: $(AWS.Secret)
awsKey: $(AWS.Key)
- template: tasks/_docker-tag-and-push.yml
parameters:
sourceImage: $(dockerImage)-$(Build.BuildId)
targetImage: ${{ format('{0}/{1}:{2}-{3}', '$(dockerRegistryHost)', '$(dockerImage)','$(Build.SourceBranchName)', '$(Build.BuildId)')}}
- template: tasks/_docker-tag-and-push.yml
parameters:
sourceImage: $(dockerImage)-$(Build.BuildId)
targetImage: ${{ format('{0}/{1}:{2}-{3}', '$(dockerRegistryHost)', '$(dockerImage)','$(Build.SourceBranchName)', 'latest')}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment