name: $(Rev:r) pr: none trigger: batch: 'true' branches: include: - master paths: include: - WebDisplay stages: - stage: Build jobs: - job: Build pool: vmImage: 'ubuntu-latest' steps: - task: Docker@2 displayName: 'Build an image' inputs: command: 'build' containerRegistry: 'Docker Hub' dockerFile: 'WebDisplay/Dockerfile' arguments: '-t ckaczor/home-monitor-web-display:$(Build.BuildNumber)' - task: Docker@2 displayName: 'Push an image' inputs: command: 'push' containerRegistry: 'Docker Hub' arguments: '-t ckaczor/home-monitor-web-display:$(Build.BuildNumber)' - task: Bash@3 inputs: targetType: 'inline' script: 'sed -i s/#BUILD_BUILDNUMBER#/$BUILD_BUILDNUMBER/ WebDisplay/deploy/manifest.yaml' - task: PublishBuildArtifacts@1 inputs: PathtoPublish: 'WebDisplay/deploy/manifest.yaml' ArtifactName: 'Manifest' publishLocation: 'Container' - task: Bash@3 inputs: targetType: 'inline' script: 'sed -i s/#BUILD_BUILDNUMBER#/$BUILD_BUILDNUMBER/ WebDisplay/deploy/manifest-internal.yaml' - task: PublishBuildArtifacts@1 inputs: PathtoPublish: 'WebDisplay/deploy/manifest-internal.yaml' ArtifactName: 'Manifest-Internal' publishLocation: 'Container' - stage: Deploy jobs: - job: Deploy pool: vmImage: 'ubuntu-latest' 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' - job: Deploy_Internal pool: vmImage: 'ubuntu-latest' steps: - task: DownloadBuildArtifacts@0 inputs: artifactName: 'Manifest-Internal' 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-Internal/manifest-internal.yaml' secretType: 'dockerRegistry' containerRegistryType: 'Container Registry'