From 4775a4d979e28044685fa1846b9b5482da0930a9 Mon Sep 17 00:00:00 2001 From: yusufkaratoprak Date: Mon, 26 Apr 2021 18:52:40 +0300 Subject: [PATCH] Set up CI with Azure Pipelines [skip ci] --- azure-pipelines.yml | 73 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 azure-pipelines.yml diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 0000000..1b6088b --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,73 @@ +# 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: +- dev + + + +variables: + + # Container registry service connection established during pipeline creation + dockerRegistryServiceConnection: '2b7ea4b4-1757-4911-b98e-6cbb012bf891' + imageRepository: 'voloeventhub' + containerRegistry: 'voloeventhub.azurecr.io' + dockerfilePath: '**/Dockerfile' + tag: '$(Build.BuildNumber)' + + + # 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) + + - publish: manifests + artifact: manifests + +- stage: Deploy + displayName: Deploy stage + dependsOn: Build + + jobs: + - deployment: Deploy + displayName: Deploy + pool: + vmImage: $(vmImageName) + environment: 'volosofteventhub-6985.default' + strategy: + runOnce: + deploy: + steps: + + + - 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) +