This repository has been archived by the owner on Mar 17, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pipeline.yaml
128 lines (119 loc) · 3.5 KB
/
pipeline.yaml
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
pipeline:
create_cluster:
image: banzaicloud/ci-pipeline-client:0.12
action: EnsureCluster
test:
image: maven:3.6-jdk-11-slim
commands:
- mvn -Dmaven.repo.local=${PWD}/.m2/repository clean test
build_image:
image: maven:3.6-jdk-11-slim
commands:
- mvn -Dmaven.repo.local=${PWD}/.m2/repository compile jib:build
environment:
DOCKER_REPO: '{{ .CICD_REPO }}'
DOCKER_TAG: '{{ trunc 7 .CICD_COMMIT_SHA }}'
secretFrom:
DOCKER_USERNAME:
keyRef: username
DOCKER_PASSWORD:
keyRef: password
# build_image:
# image: banzaicloud/drone-kaniko
# dockerfile: Dockerfile
# repo: '{{ .CICD_REPO }}'
# tags: '{{ trunc 7 .CICD_COMMIT_SHA }}'
# secretFrom:
# DOCKER_USERNAME:
# keyRef: username
# DOCKER_PASSWORD:
# keyRef: password
# install_gcr_secret:
# when:
# branch:
# include: [master]
# image: banzaicloud/ci-pipeline-client:0.12
# action: InstallSecret
# clusterSecret:
# name: your-gcr-secret-name
# namespace: default
# merge: true
# spec:
# - name: json-key
# source: json-key
# build_image:
# image: banzaicloud/drone-kaniko
# dockerfile: Dockerfile
# registry: gcr.io
# repo: 'your-project/{{ .CICD_REPO }}'
# tags: '{{ trunc 7 .CICD_COMMIT_SHA }}'
# secretFrom:
# JSON_KEY:
# name: your-gcr-secret-name
# keyRef: json-key
package_application:
image: alpine/helm:3.0.0
commands:
- helm repo add stable https://kubernetes-charts.storage.googleapis.com
- helm repo add banzaicloud-stable https://kubernetes-charts.banzaicloud.com
- helm dep update ./.banzaicloud/charts/spotguide-spring-boot
- helm package ./.banzaicloud/charts/spotguide-spring-boot
install_mysql_user_secret:
when:
branch:
include: [master]
image: banzaicloud/ci-pipeline-client:0.12
action: InstallSecret
clusterSecret:
name: '{{ .CICD_REPO_NAME }}-mysql'
namespace: default
merge: true
spec:
- name: mysql-username
source: username
- name: mysql-password
source: password
install_mysql_root_secret:
when:
branch:
include: [master]
image: banzaicloud/ci-pipeline-client:0.12
action: InstallSecret
clusterSecret:
name: '{{ .CICD_REPO_NAME }}-mysql'
namespace: default
merge: true
spec:
- name: mysql-root-password
source: password
deploy_application:
when:
branch:
include: [master]
image: banzaicloud/ci-pipeline-client:0.12
action: EnsureDeployment
deployment:
name: './spotguide-spring-boot-1.0.0.tgz'
reuseValues: true
releaseName: '{{ .CICD_REPO_NAME }}'
values:
image:
repository: '{{ .CICD_REPO }}'
tag: '{{ trunc 7 .CICD_COMMIT_SHA }}'
pullPolicy: Always
{{{{- if .platform.AutoDNSEnabled }}}}
ingress:
enabled: true
annotations:
kubernetes.io/ingress.class: traefik
traefik.ingress.kubernetes.io/redirect-regex: ^http://(.*)
traefik.ingress.kubernetes.io/redirect-replacement: https://$1
traefik.ingress.kubernetes.io/redirect-permanent: "true"
hosts:
- "{{.CICD_REPO_NAME}}.{{.CLUSTER_NAME}}.{{.ORG_NAME}}.{{.DOMAIN_NAME}}"
{{{{ else }}}}
service:
type: LoadBalancer
{{{{- end }}}}
mysql:
existingSecret: '{{ .CICD_REPO_NAME }}-mysql'