forked from kmcolli/kevin-azure-pipelines-openshift
-
Notifications
You must be signed in to change notification settings - Fork 21
/
azure-pipelines.yml
57 lines (53 loc) · 1.58 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
trigger:
- main
pool:
name: Default
variables:
project-name-dev: 'ado-openshift'
image-name: 'ado-dotnet'
stages:
- stage: Build
displayName: Build and Push Image
jobs:
- job: BuildAndPushJob
displayName: Build and Push Job
steps:
- task: [email protected]
displayName: 'Build Docker image'
inputs:
command: 'build'
containerRegistry: 'openshift-registry'
buildContext: 'App'
repository: '$(project-name-dev)/$(image-name)'
Dockerfile: 'Dockerfile'
tags: $(Build.BuildId)
- task: [email protected]
displayName: 'Push Docker image to OpenShift internal registry'
inputs:
command: 'push'
containerRegistry: 'openshift-registry'
repository: '$(project-name-dev)/$(image-name)'
tags: $(Build.BuildId)
- task: PublishPipelineArtifact@1
displayName: Publish pipeline artifacts
inputs:
targetPath: '$(Build.SourcesDirectory)/manifests'
artifact: 'manifests'
publishLocation: 'pipeline'
- stage: Deploy
displayName: Deploy to DEV
dependsOn: Build
condition: succeeded()
jobs:
- job: DeployDevJob
displayName: Deploy to DEV Job
steps:
- task: KubernetesManifest@0
displayName: Deploy to Kubernetes cluster
inputs:
action: deploy
kubernetesServiceConnection: 'openshift'
namespace: '$(project-name-dev)'
manifests: |
$(Build.SourcesDirectory)/manifests/*.yaml
containers: 'image-registry.openshift-image-registry.svc:5000/$(project-name-dev)/$(image-name):$(Build.BuildId)'