forked from microsoft/vsts-agent-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines-all.yml
132 lines (116 loc) · 3.66 KB
/
azure-pipelines-all.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml
trigger:
- master
variables:
repoName: 'janzi/vsts-build-agents'
tagName: 'ubuntu-$(ubuntuversion)'
tagNamest: 'ubuntu-$(ubuntuversion)-standard'
tagNamestb: 'ubuntu-$(ubuntuversion)-standard-buildah'
tagNamedst: 'ubuntu-$(ubuntuversion)-docker-standard'
pool:
vmImage: 'ubuntu-latest'
steps:
- task: Docker@2
displayName: Build base image
inputs:
command: 'build'
repository: '$(repoName)'
Dockerfile: 'ubuntu/$(ubuntuversion)/Dockerfile'
tags: |
$(Build.SourceBranchName)
$(Build.BuildId)
$(tagName)
addPipelineData: true
arguments: -t $(repoName):$(tagName)
- task: Docker@2
displayName: Build standard image
inputs:
command: 'build'
repository: '$(repoName)'
Dockerfile: 'ubuntu/$(ubuntuversion)/standard/Dockerfile'
tags: |
$(Build.SourceBranchName)
$(Build.BuildId)
$(tagNamest)
addPipelineData: true
arguments: -t $(repoName):$(tagNamest)
- task: Docker@2
displayName: Build standard with buildah image
condition: and(succeeded(), eq(variables['supportBuildah'], 'true'))
inputs:
command: 'build'
repository: '$(repoName)'
Dockerfile: 'ubuntu/$(ubuntuversion)/buildah/Dockerfile'
tags: |
$(Build.SourceBranchName)
$(Build.BuildId)
$(tagNamestb)
addPipelineData: true
arguments: -t $(repoName):$(tagNamestb)
- task: Docker@2
displayName: Build docker standard image
inputs:
command: 'build'
repository: '$(repoName)'
Dockerfile: 'ubuntu/$(ubuntuversion)/docker/18.06.3-ce/standard/Dockerfile'
tags: |
$(Build.SourceBranchName)
$(Build.BuildId)
$(tagNamedst)
addPipelineData: true
arguments: -t $(repoName):$(tagNamedst)
- task: Docker@2
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
displayName: Login to Docker Hub
inputs:
command: login
containerRegistry: dockerhub
- task: Docker@1
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
inputs:
containerregistrytype: 'Container Registry'
dockerRegistryEndpoint: dockerhub
repository: '$(repoName)'
includeSourceTags: true
addDefaultLabels: true
imageName: $(repoName):$(tagName)
command: 'push'
- task: Docker@1
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
inputs:
containerregistrytype: 'Container Registry'
dockerRegistryEndpoint: dockerhub
repository: '$(repoName)'
includeSourceTags: true
addDefaultLabels: true
imageName: $(repoName):$(tagNamedst)
command: 'push'
- task: Docker@1
condition: and(succeeded(), and(eq(variables['Build.SourceBranch'], 'refs/heads/master'), eq(variables['supportBuildah'], 'true')))
inputs:
containerregistrytype: 'Container Registry'
dockerRegistryEndpoint: dockerhub
repository: '$(repoName)'
includeSourceTags: true
addDefaultLabels: true
imageName: $(repoName):$(tagNamestb)
command: 'push'
- task: Docker@1
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
inputs:
containerregistrytype: 'Container Registry'
dockerRegistryEndpoint: dockerhub
repository: '$(repoName)'
includeSourceTags: true
addDefaultLabels: true
imageName: $(repoName):$(tagNamest)
command: 'push'
- task: Docker@2
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
displayName: Logout of ACR
inputs:
command: logout
containerRegistry: dockerhub