-
Notifications
You must be signed in to change notification settings - Fork 1
/
.drone.yml
118 lines (99 loc) · 2.8 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
kind: pipeline
type: docker
name: build-release
trigger:
event:
- tag
steps:
- name: Build Docker container
image: plugins/docker
settings:
repo: docker-registry.k8s.array21.dev/betterplayer-bot
tags:
- latest
- ${DRONE_TAG}
registry: docker-registry.k8s.array21.dev
- name: Deploy to Kubernetes
image: ubuntu:latest
environment:
DEBIAN_FRONTEND: noninteractive
SSH_KEY:
from_secret: ssh_key
commands:
- apt update && apt install -y openssh-client
- mkdir -p $HOME/.ssh/
- eval `ssh-agent`
- echo "$SSH_KEY" | tr -d '\r' | ssh-add - > /dev/null
- rm -rf $HOME/.ssh/config
- touch $HOME/.ssh/config
- echo "Host *\n\tStrictHostKeyChecking no" > $HOME/.ssh/config
- "ssh [email protected] kubectl set image -n prodlab deployment/betterplayer-bot betterplayer-bot=docker-registry.k8s.array21.dev/betterplayer-bot:${DRONE_TAG}"
- "ssh [email protected] kubectl rollout restart deploy -n prodlab betterplayer-bot"
- "ssh [email protected] kubectl rollout restart deploy -n prodlab betterplayer-canary-bot"
- name: slack
image: plugins/slack
settings:
webhook:
from_secret: discord_webhook
username: Drone CI/CD - BetterPlayer - build-release
when:
status: [ failure ]
---
kind: pipeline
type: docker
name: build-latest
trigger:
branch:
- master
steps:
- name: Build Docker container
image: plugins/docker
settings:
repo: docker-registry.k8s.array21.dev/betterplayer-bot
tags:
- latest
registry: docker-registry.k8s.array21.dev
- name: Deploy to Kubernetes
image: ubuntu:latest
environment:
DEBIAN_FRONTEND: noninteractive
SSH_KEY:
from_secret: ssh_key
commands:
- apt update && apt install -y openssh-client
- mkdir -p $HOME/.ssh/
- eval `ssh-agent`
- echo "$SSH_KEY" | tr -d '\r' | ssh-add - > /dev/null
- rm -rf $HOME/.ssh/config
- touch $HOME/.ssh/config
- echo "Host *\n\tStrictHostKeyChecking no" > $HOME/.ssh/config
- "ssh [email protected] kubectl rollout restart deploy -n prodlab betterplayer-canary-bot"
- name: slack
image: plugins/slack
settings:
webhook:
from_secret: discord_webhook
username: Drone CI/CD - BetterPlayer - build-latest
when:
status: [ failure ]
---
kind: pipeline
type: docker
name: build-and-test
trigger:
event:
- pull_request
- push
steps:
- name: Gradle Build
image: gradle:7.2-jdk16
commands:
- gradle build
- name: Slack notifications
image: plugins/slack
settings:
webhook:
from_secret: discord_webhook
username: Drone CI/CD - BetterPlayer - build-and-test
when:
status: [ failure ]