-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines-worker-service.yml
68 lines (59 loc) · 1.85 KB
/
azure-pipelines-worker-service.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# Docker
# Build and push an image to Azure Container Registry
# https://docs.microsoft.com/azure/devops/pipelines/languages/docker
trigger:
paths:
include:
- worker/*
resources:
- repo: self
variables:
# Container registry service connection established during pipeline creation
dockerRegistryServiceConnection: "d1596a0a-f141-4415-81c9-0ca95eded5f5"
imageRepository: "workergapp"
containerRegistry: "susanazurecicd.azurecr.io"
dockerfilePath: "$(Build.SourcesDirectory)/worker/Dockerfile"
tag: "$(Build.BuildId)"
# Agent VM
pool:
name: "azureagent" # Name of your self-hosted agent pool
stages:
- stage: Build
displayName: Build stage
jobs:
- job: Build
displayName: Build
steps:
- task: Docker@2
displayName: Build an image
inputs:
containerRegistry: "$(dockerRegistryServiceConnection)"
repository: "$(imageRepository)"
command: "build"
Dockerfile: "worker/Dockerfile"
tags: "$(tag)"
arguments: "--platform linux/amd64" # Specify platform (optional, remove if not required)
- stage: Push
displayName: Push stage
dependsOn: Build # Optional, to ensure this runs after Build
jobs:
- job: Push
displayName: Push
steps:
- task: Docker@2
displayName: Push an image
inputs:
containerRegistry: "$(dockerRegistryServiceConnection)"
repository: "$(imageRepository)"
command: "push"
tags: "$(tag)"
- stage: Update
displayName: Update stage
jobs:
- job: Update
displayName: Update
steps:
- task: ShellScript@2
inputs:
scriptPath: "scripts/updateK8sManifests.sh"
args: "worker $(imageRepository) $(tag)"