-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy path.drone.yml
More file actions
169 lines (158 loc) · 3.57 KB
/
.drone.yml
File metadata and controls
169 lines (158 loc) · 3.57 KB
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
kind: secret
name: username
get:
path: caesar-team/data/registry
name: username
---
kind: secret
name: password
get:
path: caesar-team/data/registry
name: password
---
kind: secret
name: develop_url
get:
path: secret/data/k8s-4xxi
name: develop_url
---
kind: secret
name: COMPOSER_AUTH
get:
path: caesar-team/data/github
name: COMPOSER_AUTH
---
kind: secret
name: develop_token
get:
path: secret/data/k8s-4xxi
name: develop_token
---
kind: secret
name: develop_ca
get:
path: secret/data/k8s-4xxi
name: develop_ca
---
kind: secret
name: notifications
get:
path: secret/data/notifications-4xxi
name: caesar-builds
---
kind: secret
name: notification_username
get:
path: secret/data/notifications-4xxi
name: username
---
kind: secret
name: notification_icon
get:
path: secret/data/notifications-4xxi
name: icon_url
---
kind: pipeline
type: docker
name: 4xxi
globals:
- &confNoSaveBuild
dockerfile: ./Dockerfile
repo: plugins/docker
tags: fourxxi
dry_run: true
daemon_off: false
- &confSaveBuild
dockerfile: ./Dockerfile
repo: caesarteam/caesar-secure-message-server
username:
from_secret: username
password:
from_secret: password
- &stepFeatureBuild
image: plugins/docker
settings:
<<: *confNoSaveBuild
- &stepDevelopBuild
image: plugins/docker
environment:
COMPOSER_AUTH:
from_secret: COMPOSER_AUTH
settings:
tags: [ "${DRONE_BRANCH}" ]
<<: *confSaveBuild
- &stepMasterBuild
image: plugins/docker
environment:
COMPOSER_AUTH:
from_secret: COMPOSER_AUTH
settings:
tags: [ "${DRONE_BRANCH}", "latest" ]
<<: *confSaveBuild
- &stepDevelopDeploy
name: deploy develop
image: sinlead/drone-kubectl
settings:
kubernetes_server:
from_secret: develop_url
kubernetes_token:
from_secret: develop_token
kubernetes_cert:
from_secret: develop_ca
environment:
CICD_GIT_COMMIT: ${DRONE_COMMIT}
CICD_GIT_BRANCH: ${DRONE_BRANCH}
commands:
- sed -i "s/\$CICD_GIT_BRANCH/$CICD_GIT_BRANCH/g" deploy/004_deployment.yml
- sed -i "s/\$CICD_GIT_COMMIT/$CICD_GIT_COMMIT/g" deploy/004_deployment.yml
- kubectl apply -f deploy/004_deployment.yml -n dev-caesar-team
- &stepNotifyToSlack
name: notify-to-slack
image: plugins/slack
pull: always
settings:
webhook:
from_secret: notifications
channel: caesar-builds
username:
from_secret: notification_username
icon_url:
from_secret: notification_icon
template: >
{{#success build.status}}
*Event*: `{{build.event}}` {{build.status}}
*Repository*: `{{repo.name}}` to `{{build.branch}}`
*Commit*: `{{build.commit}}`
*Info*: {{build.number}} build was started {{since build.created}} and executed for {{since build.started}}
<{{build.link}}|*Build link*>
{{else}}
*Event*: `{{build.event}}` {{build.status}}
*Repository*: `{{repo.name}}` to `{{build.branch}}`
*Commit*: `{{build.commit}}`
*Info*: {{build.number}} build was started {{since build.created}} and executed for {{since build.started}}
<{{build.link}}|*Build link*>
{{/success}}
steps:
- name: build feature
<<: *stepFeatureBuild
when:
branch: [ feature/* ]
- name: build develop
<<: *stepDevelopBuild
when:
branch: [ develop ]
- name: build master
<<: *stepMasterBuild
when:
branch: [ master ]
- <<: *stepDevelopDeploy
when:
branch: [ develop ]
- <<: *stepNotifyToSlack
when:
status: [ success, failure ]
branch: [ develop, master ]
trigger:
branch: [ master, develop, feature/* ]
event:
exclude: [ pull_request ]