Switch to multi-stage build/deploy

This commit is contained in:
2019-10-19 09:10:27 -04:00
parent 642fe09869
commit 7bd2f54d43
5 changed files with 219 additions and 123 deletions

View File

@@ -9,9 +9,12 @@ trigger:
include:
- Display
stages:
- stage: Build
jobs:
- job: Build
pool:
name: Hosted Ubuntu 1604
steps:
- task: Docker@0
displayName: 'Build an image'
@@ -21,7 +24,6 @@ steps:
dockerFile: 'Display/Dockerfile'
imageName: 'ckaczor/home-monitor-display:$(Build.BuildNumber)'
includeLatestTag: true
- task: Docker@0
displayName: 'Push an image'
inputs:
@@ -30,14 +32,35 @@ steps:
action: 'Push an image'
imageName: 'ckaczor/home-monitor-display:$(Build.BuildNumber)'
includeLatestTag: true
- task: Bash@3
inputs:
targetType: 'inline'
script: 'sed -i s/#BUILD_BUILDNUMBER#/$BUILD_BUILDNUMBER/ Display/deploy/manifest.yaml'
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: 'Display/deploy/manifest.yaml'
ArtifactName: 'Manifest'
publishLocation: 'Container'
- stage: Deploy
jobs:
- job: Deploy
pool:
name: Hosted Ubuntu 1604
steps:
- task: DownloadBuildArtifacts@0
inputs:
artifactName: 'Manifest'
buildType: 'current'
downloadType: 'single'
downloadPath: '$(System.ArtifactsDirectory)'
- task: Kubernetes@1
inputs:
connectionType: 'Kubernetes Service Connection'
kubernetesServiceEndpoint: 'Kubernetes'
namespace: 'home-monitor'
command: 'apply'
useConfigurationFile: true
configuration: '$(System.ArtifactsDirectory)/Manifest/manifest.yaml'
secretType: 'dockerRegistry'
containerRegistryType: 'Container Registry'

View File

@@ -9,9 +9,12 @@ trigger:
include:
- Hub/Service
stages:
- stage: Build
jobs:
- job: Build
pool:
name: Hosted Ubuntu 1604
steps:
- task: Docker@0
displayName: 'Build an image'
@@ -21,7 +24,6 @@ steps:
dockerFile: 'Hub/Service/Dockerfile'
imageName: 'ckaczor/home-monitor-hub-service:$(Build.BuildNumber)'
includeLatestTag: true
- task: Docker@0
displayName: 'Push an image'
inputs:
@@ -30,14 +32,35 @@ steps:
action: 'Push an image'
imageName: 'ckaczor/home-monitor-hub-service:$(Build.BuildNumber)'
includeLatestTag: true
- task: Bash@3
inputs:
targetType: 'inline'
script: 'sed -i s/#BUILD_BUILDNUMBER#/$BUILD_BUILDNUMBER/ Hub/Service/deploy/manifest.yaml'
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: 'Hub/Service/deploy/manifest.yaml'
ArtifactName: 'Manifest'
publishLocation: 'Container'
- stage: Deploy
jobs:
- job: Deploy
pool:
name: Hosted Ubuntu 1604
steps:
- task: DownloadBuildArtifacts@0
inputs:
artifactName: 'Manifest'
buildType: 'current'
downloadType: 'single'
downloadPath: '$(System.ArtifactsDirectory)'
- task: Kubernetes@1
inputs:
connectionType: 'Kubernetes Service Connection'
kubernetesServiceEndpoint: 'Kubernetes'
namespace: 'home-monitor'
command: 'apply'
useConfigurationFile: true
configuration: '$(System.ArtifactsDirectory)/Manifest/manifest.yaml'
secretType: 'dockerRegistry'
containerRegistryType: 'Container Registry'

View File

@@ -63,4 +63,4 @@ stages:
useConfigurationFile: true
configuration: '$(System.ArtifactsDirectory)/Manifest/manifest.yaml'
secretType: 'dockerRegistry'
containerRegistryType: 'Azure Container Registry'
containerRegistryType: 'Container Registry'

View File

@@ -9,9 +9,12 @@ trigger:
include:
- Weather/SerialReader
stages:
- stage: Build
jobs:
- job: Build
pool:
name: Hosted Ubuntu 1604
steps:
- task: Docker@0
displayName: 'Build an image'
@@ -21,7 +24,6 @@ steps:
dockerFile: 'Weather/SerialReader/Dockerfile'
imageName: 'ckaczor/home-monitor-weather-serialreader:$(Build.BuildNumber)'
includeLatestTag: true
- task: Docker@0
displayName: 'Push an image'
inputs:
@@ -30,14 +32,35 @@ steps:
action: 'Push an image'
imageName: 'ckaczor/home-monitor-weather-serialreader:$(Build.BuildNumber)'
includeLatestTag: true
- task: Bash@3
inputs:
targetType: 'inline'
script: 'sed -i s/#BUILD_BUILDNUMBER#/$BUILD_BUILDNUMBER/ Weather/SerialReader/deploy/manifest.yaml'
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: 'Weather/SerialReader/deploy/manifest.yaml'
ArtifactName: 'Manifest'
publishLocation: 'Container'
- stage: Deploy
jobs:
- job: Deploy
pool:
name: Hosted Ubuntu 1604
steps:
- task: DownloadBuildArtifacts@0
inputs:
artifactName: 'Manifest'
buildType: 'current'
downloadType: 'single'
downloadPath: '$(System.ArtifactsDirectory)'
- task: Kubernetes@1
inputs:
connectionType: 'Kubernetes Service Connection'
kubernetesServiceEndpoint: 'Kubernetes'
namespace: 'home-monitor'
command: 'apply'
useConfigurationFile: true
configuration: '$(System.ArtifactsDirectory)/Manifest/manifest.yaml'
secretType: 'dockerRegistry'
containerRegistryType: 'Container Registry'

View File

@@ -9,6 +9,10 @@ trigger:
include:
- Weather/Service
stages:
- stage: Build
jobs:
- job: Build
pool:
name: Hosted Ubuntu 1604
@@ -41,3 +45,26 @@ steps:
PathtoPublish: 'Weather/Service/deploy/manifest.yaml'
ArtifactName: 'Manifest'
publishLocation: 'Container'
- stage: Deploy
jobs:
- job: Deploy
pool:
name: Hosted Ubuntu 1604
steps:
- task: DownloadBuildArtifacts@0
inputs:
artifactName: 'Manifest'
buildType: 'current'
downloadType: 'single'
downloadPath: '$(System.ArtifactsDirectory)'
- task: Kubernetes@1
inputs:
connectionType: 'Kubernetes Service Connection'
kubernetesServiceEndpoint: 'Kubernetes'
namespace: 'home-monitor'
command: 'apply'
useConfigurationFile: true
configuration: '$(System.ArtifactsDirectory)/Manifest/manifest.yaml'
secretType: 'dockerRegistry'
containerRegistryType: 'Container Registry'