Azure Release Pipelines/Deployments
- Sample dotnet application which we used for creating releases
---
pool:
name: 'Azure Pipelines'
vmImage: 'ubuntu-latest'
trigger:
- master
stages:
- stage: 'buildpackage'
displayName: 'Build and Package'
jobs:
- job: 'buildpackage'
displayName: 'Build and Package'
steps:
- task: DotNetCoreCLI@2
inputs:
command: publish
publishWebProjects: True
arguments: '--configuration Release --output $(Build.ArtifactStagingDirectory)'
zipAfterPublish: True
- task: PublishPipelineArtifact@1
inputs:
targetPath: '$(Build.ArtifactStagingDirectory)'
artifactName: 'qtwebapp'
-
We will be taking a sample application and performing the following steps
- build docker image
- scan docker image
- push docker image to docker registry
- deploy the container as deployment into k8s cluster
-
The Application we will be using
-
Create Kubernetes Cluster Refer Here
- Setup service connection with Kubernetes Cluster and select namespace

- Refer Here for the basic pipeline to build docker image
- Refer Here for sample aks azure devops deployment pipeline
- Refer Here for changes in pipeline added to deploy to k8s cluster
- The yaml for deployment
---
pool:
name: 'Azure Pipelines'
vmImage: 'ubuntu-latest'
trigger:
- developer
stages:
- stage: 'buildnpush'
displayName: 'Build docker image and push'
jobs:
- job: 'buildnpush'
displayName: 'Build docker image and push to registry'
steps:
- task: Docker@2
inputs:
containerRegistry: 'Docker'
repository: 'shaikkhajaibrahim/azdevopsstudentsregister'
command: 'buildAndPush'
tags: "latest"
- task: PublishPipelineArtifact@1
inputs:
artifactName: 'manifests'
path: 'kubernetes'
- job: 'qadeploy'
displayName: 'Deploy to QA'
dependsOn: 'buildnpush'
steps:
- task: DownloadPipelineArtifact@2
inputs:
artifactName: 'manifests'
downloadPath: '$(System.ArtifactsDirectory)/manifests'
- task: Kubernetes@1
inputs:
connectionType: 'Kubernetes Service Connection'
kubernetesServiceEndpoint: 'aksfromreleases'
namespace: default
command: 'apply'
useConfigurationFile: true
configurationType: configuration
configuration: '$(System.ArtifactsDirectory)/manifests/mysql-deploy.yaml'
- script: 'ls $(System.ArtifactsDirectory)'
- script: 'ls $(System.ArtifactsDirectory)/manifests'
- task: Kubernetes@1
inputs:
connectionType: 'Kubernetes Service Connection'
kubernetesServiceEndpoint: 'aksfromreleases'
namespace: default
command: 'apply'
useConfigurationFile: true
configurationType: configuration
configuration: '$(System.ArtifactsDirectory)/manifests/scr-deploy.yaml'
Azure DevOps Pipeline – Secrets
Like this:
Like Loading...