-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines.yml
82 lines (78 loc) · 2.4 KB
/
azure-pipelines.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
trigger:
branches:
include:
- '*'
tags:
include:
- '*'
pool:
vmImage: 'ubuntu-latest'
name: $(BuildID)-$(Build.SourceBranchName)
variables:
${{ if notIn(variables['Build.SourceBranch'], 'refs/heads/master', 'refs/tags/develop') }}:
buildImage: false
deployService: false
deployEnvironment: 'no'
imageTags: 'no'
proxyServiceName: 'no'
${{ if eq(variables['Build.SourceBranch'], 'refs/tags/develop') }}:
buildImage: true
deployService: true
deployEnvironment: development
imageTags: |
$(Build.BuildId)
develop
proxyServiceName: olympiad-dev_proxy
${{ if eq(variables['Build.SourceBranch'], 'refs/heads/master') }}:
buildImage: true
deployService: true
deployEnvironment: production
imageTags: |
$(Build.BuildId)
latest
proxyServiceName: olympiad_proxy
stages:
- stage: build
condition: and(succeeded(), ${{variables.buildImage}})
jobs:
- job: packProxy
displayName: Pack docker image
steps:
- task: Docker@2
displayName: buildAndPush
inputs:
containerRegistry: 'rtuitlab connection by admin'
repository: 'rtuitlab/olympiad-proxy'
command: 'buildAndPush'
Dockerfile: './Proxy/Dockerfile'
buildContext: './Proxy'
tags: ${{variables.imageTags}}
# - stage: deploy
# condition: and(succeeded(), ${{variables.deployService}})
# jobs:
# - deployment: DeployProxy
# displayName: Deploy proxy
# pool:
# vmImage: 'ubuntu-latest'
# environment: ${{variables.deployEnvironment}}
# strategy:
# runOnce:
# on:
# failure:
# steps:
# - download: none
# - task: SSH@0
# inputs:
# sshEndpoint: 'swarm manager'
# runOptions: 'commands'
# commands: 'docker service rollback ${{variables.proxyServiceName}}'
# readyTimeout: '20000'
# deploy:
# steps:
# - download: none
# - task: SSH@0
# inputs:
# sshEndpoint: 'swarm manager'
# runOptions: 'commands'
# commands: 'docker service update --image rtuitlab/olympiad-proxy:$(Build.BuildId) ${{variables.proxyServiceName}}'
# readyTimeout: '20000'