86 lines
2.3 KiB
YAML
86 lines
2.3 KiB
YAML
# Deploy to Azure Kubernetes Service
|
|
# Build and push image to Azure Container Registry; Deploy to Azure Kubernetes Service
|
|
# https://docs.microsoft.com/azure/devops/pipelines/languages/docker
|
|
|
|
trigger: none
|
|
|
|
resources:
|
|
- repo: self
|
|
|
|
variables:
|
|
|
|
# Container registry service connection established during pipeline creation
|
|
dockerRegistryServiceConnection: 'aosdevacr'
|
|
imageRepository: 'extranetui'
|
|
containerRegistry: 'aosdevacr.azurecr.io'
|
|
dockerfilePath: './uat.Dockerfile'
|
|
tag: 'uat-$(Build.BuildId)'
|
|
imagePullSecret: 'acr-pull'
|
|
|
|
# Agent VM image name
|
|
vmImageName: 'ubuntu-latest'
|
|
|
|
|
|
stages:
|
|
- stage: Build
|
|
displayName: Build stage
|
|
jobs:
|
|
- job: Build
|
|
displayName: Build
|
|
pool:
|
|
vmImage: $(vmImageName)
|
|
#name: 'Az-agent-pool'
|
|
steps:
|
|
- task: Docker@2
|
|
displayName: Build and push an image to container registry
|
|
inputs:
|
|
command: buildAndPush
|
|
repository: $(imageRepository)
|
|
dockerfile: $(dockerfilePath)
|
|
containerRegistry: $(dockerRegistryServiceConnection)
|
|
tags: |
|
|
$(tag)
|
|
|
|
- upload: kustomize/manifests/uat
|
|
artifact: kustomize/manifests/uat
|
|
|
|
- stage: Deploy
|
|
displayName: Deploy stage
|
|
dependsOn: Build
|
|
|
|
jobs:
|
|
- deployment: Deploy
|
|
displayName: Deploy
|
|
pool:
|
|
vmImage: $(vmImageName)
|
|
#name: 'Az-agent-pool'
|
|
environment: 'aos-uat-aks'
|
|
strategy:
|
|
runOnce:
|
|
deploy:
|
|
steps:
|
|
- task: KubernetesManifest@0
|
|
displayName: Create imagePullSecret
|
|
inputs:
|
|
connectionType: 'Kubernetes Service Connection'
|
|
kubernetesServiceConnection: 'aos-uat-aks'
|
|
namespace: 'uat'
|
|
action: createSecret
|
|
secretName: $(imagePullSecret)
|
|
dockerRegistryEndpoint: $(dockerRegistryServiceConnection)
|
|
|
|
- task: KubernetesManifest@0
|
|
displayName: Deploy to Kubernetes cluster
|
|
inputs:
|
|
connectionType: 'Kubernetes Service Connection'
|
|
kubernetesServiceConnection: 'aos-uat-aks'
|
|
namespace: 'uat'
|
|
action: deploy
|
|
manifests: |
|
|
$(Pipeline.Workspace)/kustomize/manifests/uat/uat.yaml
|
|
imagePullSecrets: |
|
|
$(imagePullSecret)
|
|
containers: |
|
|
$(containerRegistry)/$(imageRepository):$(tag)
|
|
|