-
Notifications
You must be signed in to change notification settings - Fork 2
/
azure-pipelines.yml
34 lines (31 loc) · 1.01 KB
/
azure-pipelines.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
name: $(Year:yyyy).$(Month).$(DayOfMonth)$(Rev:.r)
trigger:
- develop
- main
jobs:
- job: Docker
pool:
vmImage: ubuntu-latest
variables:
imageName: $(CONTAINER_REGISTRY)/azp-dotnet-agent
isMain: $[eq(variables['Build.SourceBranch'], 'refs/heads/main')]
steps:
- script: |
docker build --build-arg BUILD_AZP_TOKEN --build-arg BUILD_AZP_URL --build-arg BUILD_AZP_VERSION -t $(imageName):latest -t $(imageName):$(Build.BuildNumber) .
displayName: Docker Build
env:
BUILD_AZP_TOKEN: $(System.AccessToken)
BUILD_AZP_URL: $(System.CollectionUri)
BUILD_AZP_VERSION: $(Build.BuildNumber)
- task: AzureCLI@2
displayName: Docker Push
inputs:
azureSubscription: WCOM ACR Push
scriptType: 'bash'
scriptLocation: 'inlineScript'
inlineScript: |
az acr login --name acrwcom
docker push $(imageName):$(Build.BuildNumber)
docker push $(imageName):latest
docker logout
condition: and(succeeded(), eq(variables.isMain, true))