Skip to content

Commit

Permalink
Set up CI with Azure Pipelines
Browse files Browse the repository at this point in the history
[skip ci]
  • Loading branch information
1mb4dr committed Oct 8, 2020
1 parent c27df62 commit 0630c63
Showing 1 changed file with 79 additions and 0 deletions.
79 changes: 79 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# 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:
- master

resources:
- repo: self

variables:

# Container registry service connection established during pipeline creation
dockerRegistryServiceConnection: '092c6ef6-0721-426d-bc83-6ea1ea9d5213'
imageRepository: 'biobadrpipelineappwithazurekubernetes'
containerRegistry: 'uniqueacrnamebadr.azurecr.io'
dockerfilePath: '**/Dockerfile'
tag: '$(Build.BuildId)'
imagePullSecret: 'uniqueacrnamebadr8b45-auth'

# 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: manifests
artifact: manifests

- stage: Deploy
displayName: Deploy stage
dependsOn: Build

jobs:
- deployment: Deploy
displayName: Deploy
pool:
vmImage: $(vmImageName)
environment: 'biobadrpipelineappwithazurekubernetes.pipeline'
strategy:
runOnce:
deploy:
steps:
- task: KubernetesManifest@0
displayName: Create imagePullSecret
inputs:
action: createSecret
secretName: $(imagePullSecret)
dockerRegistryEndpoint: $(dockerRegistryServiceConnection)

- task: KubernetesManifest@0
displayName: Deploy to Kubernetes cluster
inputs:
action: deploy
manifests: |
$(Pipeline.Workspace)/manifests/deployment.yml
$(Pipeline.Workspace)/manifests/service.yml
imagePullSecrets: |
$(imagePullSecret)
containers: |
$(containerRegistry)/$(imageRepository):$(tag)

0 comments on commit 0630c63

Please sign in to comment.