Files
Extranet_UI_V2/azure-pipelines-preprod.yaml
arfat qureshi 6ce776f218 first commit
2025-10-29 11:44:13 +05:30

90 lines
2.4 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:
tags:
include:
- 'v-*'
branches:
exclude:
- '*'
resources:
- repo: self
variables:
# Container registry service connection established during pipeline creation
dockerRegistryServiceConnection: 'aosprodacr'
imageRepository: 'extranetui'
containerRegistry: 'aosprodacr.azurecr.io'
dockerfilePath: './preprod.Dockerfile'
tag: 'preprod-$(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)
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/preprod
artifact: kustomize/manifests/preprod
- stage: Deploy
displayName: Deploy stage
dependsOn: Build
jobs:
- deployment: Deploy
displayName: Deploy
pool:
vmImage: $(vmImageName)
environment: 'aos-preprod-aks'
strategy:
runOnce:
deploy:
steps:
- task: KubernetesManifest@0
displayName: Create imagePullSecret
inputs:
connectionType: 'Kubernetes Service Connection'
kubernetesServiceConnection: 'aos-preprod-aks'
namespace: 'preprod'
action: createSecret
secretName: $(imagePullSecret)
dockerRegistryEndpoint: $(dockerRegistryServiceConnection)
- task: KubernetesManifest@0
displayName: Deploy to Kubernetes cluster
inputs:
connectionType: 'Kubernetes Service Connection'
kubernetesServiceConnection: 'aos-preprod-aks'
namespace: 'preprod'
action: deploy
manifests: |
$(Pipeline.Workspace)/kustomize/manifests/preprod/preprod.yaml
imagePullSecrets: |
$(imagePullSecret)
containers: |
$(containerRegistry)/$(imageRepository):$(tag)