Files
HomeMonitor/Power/Service/deploy/azure-pipelines.yml

65 lines
1.8 KiB
YAML

name: $(Rev:r)
trigger:
batch: 'true'
branches:
include:
- master
paths:
include:
- Power/Service
stages:
- stage: Build
jobs:
- job: Build
pool:
name: Hosted Ubuntu 1604
steps:
- task: Docker@0
displayName: 'Build an image'
inputs:
containerregistrytype: 'Container Registry'
dockerRegistryConnection: 'Docker Hub'
dockerFile: 'Power/Service/Dockerfile'
imageName: 'ckaczor/home-monitor-power-service:$(Build.BuildNumber)'
includeLatestTag: true
- task: Docker@0
displayName: 'Push an image'
inputs:
containerregistrytype: 'Container Registry'
dockerRegistryConnection: 'Docker Hub'
action: 'Push an image'
imageName: 'ckaczor/home-monitor-power-service:$(Build.BuildNumber)'
includeLatestTag: true
- task: Bash@3
inputs:
targetType: 'inline'
script: 'sed -i s/#BUILD_BUILDNUMBER#/$BUILD_BUILDNUMBER/ Power/Service/deploy/manifest.yaml'
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: 'Power/Service/deploy/manifest.yaml'
ArtifactName: 'Manifest'
publishLocation: 'Container'
- stage: Deploy
jobs:
- job: Deploy
pool:
name: Hosted Ubuntu 1604
steps:
- task: DownloadBuildArtifacts@0
inputs:
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/manifest.yaml'
secretType: 'dockerRegistry'
containerRegistryType: 'Azure Container Registry'