-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.drone.yml
141 lines (121 loc) · 3.14 KB
/
.drone.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
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
---
kind: pipeline
type: docker
name: notify-pipeline-start
steps:
- name: slack
image: plugins/slack
pull: if-not-exists
settings:
webhook:
from_secret: SLACK_WEBHOOK
channel:
from_secret: SLACK_CHANNEL
link_names: true
# template source: https://gist.github.com/wzulfikar/e9064862d17467ed36b81d2f2c17389a
template: >
*Build started: {{ repo.owner }}/{{ repo.name }} - Build #{{ build.number }}* (type: `{{ build.event }}`)
Commit: <https://github.com/{{ repo.owner }}/{{ repo.name }}/commit/{{ build.commit }}|{{ truncate build.commit 8 }}>
Branch: <https://github.com/{{ repo.owner }}/{{ repo.name }}/commits/{{ build.branch }}|{{ build.branch }}>
Author: {{ build.author }}
<{{ build.link }}|Visit build page ↗>
---
kind: pipeline
type: docker
name: build-docker-image
steps:
- name: build-docker-image
image: plugins/docker
pull: if-not-exists
settings:
repo: ${DRONE_REPO,,}
tags:
- ${DRONE_SOURCE_BRANCH/\//-}
- ${DRONE_SOURCE_BRANCH/\//-}-${DRONE_COMMIT_SHA:0:8}
cache_from:
- ${DRONE_REPO,,}:${DRONE_SOURCE_BRANCH/\//-}
username:
from_secret: DOCKER_USERNAME
password:
from_secret: DOCKER_PASSWORD
when:
event:
exclude:
- tag
- name: build-docker-image-tag
image: plugins/docker
pull: if-not-exists
settings:
repo: ${DRONE_REPO,,}
tags:
- ${DRONE_TAG/\//-}
cache_from:
- ${DRONE_REPO,,}:master-${DRONE_COMMIT_SHA:0:8}
username:
from_secret: DOCKER_USERNAME
password:
from_secret: DOCKER_PASSWORD
when:
event:
- tag
---
kind: pipeline
type: docker
name: notify-pipeline-end
steps:
- name: slack
image: plugins/slack
pull: if-not-exists
settings:
webhook:
from_secret: SLACK_WEBHOOK
channel:
from_secret: SLACK_CHANNEL
link_names: true
template: >
*{{#success build.status}}✔{{ else }}✘{{/success}} {{ uppercasefirst build.status }}: {{ repo.owner }}/{{ repo.name }} - Build #{{ build.number }}* (type: `{{ build.event }}`)
Commit: <https://github.com/{{ repo.owner }}/{{ repo.name }}/commit/{{ build.commit }}|{{ truncate build.commit 8 }}>
Branch: <https://github.com/{{ repo.owner }}/{{ repo.name }}/commits/{{ build.branch }}|{{ build.branch }}>
Author: {{ build.author }}
Duration: {{ since build.created }}
<{{ build.link }}|Visit build page ↗>
depends_on:
- build-docker-image
trigger:
status:
- success
- failure
---
kind: secret
name: SLACK_WEBHOOK
get:
path: slack-webhook
name: backend_url
---
kind: secret
name: SLACK_CHANNEL
get:
path: slack-webhook
name: backend_channel
---
kind: secret
name: DOCKER_USERNAME
get:
path: docker-credentials
name: username
---
kind: secret
name: DOCKER_PASSWORD
get:
path: docker-credentials
name: password
---
kind: secret
name: dockerconfigjson
get:
path: docker-credentials
name: dockerconfigjson
---
kind: signature
hmac: 1124d1f9c29438b718e1bb673df6c54e70ee258556b3206083b79faa4ea8ff84
...