-
Notifications
You must be signed in to change notification settings - Fork 9
/
cicd.yaml
140 lines (135 loc) · 5.47 KB
/
cicd.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
129
130
131
132
133
134
135
136
137
138
139
140
# We actually use this file for CI of this repository.
# Though, it does not have any effect by locating this file in git repository.
# We applied it to our own k8s cluster.
apiVersion: cicd.tmax.io/v1
kind: IntegrationConfig
metadata:
name: cicd-operator
namespace: cicd
spec:
git:
type: github
repository: tmax-cloud/cicd-operator
token:
valueFrom:
secretKeyRef:
name: tmax-cloud-bot-token
key: token
secrets:
- name: tmax-hub
mergeConfig:
method: squash
query:
blockLabels:
- hold
checks:
- test-code
- test-lint
approveRequired: true
jobs:
preSubmit:
- name: test-code
image: golang:1.17
script: |
make test-crd
make test-gen
make test-verify
make test-unit
when:
branch:
- master
- name: test-lint
image: golang:1.17
script: |
go install github.com/golangci/golangci-lint/cmd/[email protected]
golangci-lint run ./... -v -E gofmt -E golint -E gocyclo -E misspell --timeout 1h0m0s
when:
branch:
- master
postSubmit:
- name: test-code
image: golang:1.17
script: |
make test-crd
make test-gen
make test-verify
make test-unit
when:
branch:
- master
- name: test-lint
image: golang:1.17
script: |
go install github.com/golangci/golangci-lint/cmd/[email protected]
golangci-lint run ./... -v -E gofmt --timeout 1h0m0s
when:
branch:
- master
- name: build-push-image
image: quay.io/buildah/stable
script: |
TAG=${CI_HEAD_REF#refs/tags/}
IMG_OPERATOR="$IMAGE_URL_OPERATOR:$TAG"
IMG_BLOCKER="$IMAGE_URL_BLOCKER:$TAG"
IMG_APISERVER="$IMAGE_URL_APISERVER:$TAG"
IMG_WEBHOOK="$IMAGE_URL_WEBHOOK:$TAG"
buildah bud --format docker --storage-driver=vfs -f ./build/controller/Dockerfile -t $IMG_OPERATOR .
buildah tag --storage-driver=vfs $IMG_OPERATOR $IMAGE_URL_OPERATOR:latest
buildah push --storage-driver=vfs $IMG_OPERATOR docker://$IMG_OPERATOR
buildah push --storage-driver=vfs $IMAGE_URL_OPERATOR:latest docker://$IMAGE_URL_OPERATOR:latest
buildah bud --format docker --storage-driver=vfs -f ./build/blocker/Dockerfile -t $IMG_BLOCKER .
buildah tag --storage-driver=vfs $IMG_BLOCKER $IMAGE_URL_BLOCKER:latest
buildah push --storage-driver=vfs $IMG_BLOCKER docker://$IMG_BLOCKER
buildah push --storage-driver=vfs $IMAGE_URL_BLOCKER:latest docker://$IMAGE_URL_BLOCKER:latest
buildah bud --format docker --storage-driver=vfs -f ./build/apiserver/Dockerfile -t $IMG_APISERVER .
buildah tag --storage-driver=vfs $IMG_APISERVER $IMAGE_URL_APISERVER:latest
buildah push --storage-driver=vfs $IMG_APISERVER docker://$IMG_APISERVER
buildah push --storage-driver=vfs $IMAGE_URL_APISERVER:latest docker://$IMAGE_URL_APISERVER:latest
buildah bud --format docker --storage-driver=vfs -f ./build/webhook/Dockerfile -t $IMG_WEBHOOK .
buildah tag --storage-driver=vfs $IMG_WEBHOOK $IMAGE_URL_WEBHOOK:latest
buildah push --storage-driver=vfs $IMG_WEBHOOK docker://$IMG_WEBHOOK
buildah push --storage-driver=vfs $IMAGE_URL_WEBHOOK:latest docker://$IMAGE_URL_WEBHOOK:latest
env:
- name: IMAGE_URL_OPERATOR
value: tmaxcloudck/cicd-operator
- name: IMAGE_URL_BLOCKER
value: tmaxcloudck/cicd-blocker
- name: IMAGE_URL_APISERVER
value: tmaxcloudck/cicd-api-server
- name: IMAGE_URL_WEBHOOK
value: tmaxcloudck/cicd-webhook
securityContext:
privileged: true
when:
tag:
- v.*
notification:
onSuccess:
email:
receivers:
title: "CI/CD Operator {{ .Spec.Refs.Base.Ref.GetTag }} 배포 안내 메일"
isHtml: true
content: |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>CI/CD Operator {{ .Spec.Refs.Base.Ref.GetTag }} 배포 안내 메일</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
</head>
<body>
<div style="font-size: 10pt; font-family: Verdana,Geneva,sans-serif">
<div>안녕하세요, CK1-2팀 김창주입니다.<br>HyperCloud CI/CD Operator {{ .Spec.Refs.Base.Ref.GetTag }} 배포 안내 메일입니다.</div>
<div>
<ul>
<li>이미지: docker.io/tmaxcloudck/cicd-operator:{{ .Spec.Refs.Base.Ref.GetTag }}</li>
<li>이미지: docker.io/tmaxcloudck/cicd-blocker:{{ .Spec.Refs.Base.Ref.GetTag }}</li>
</ul>
</div>
<div>수정 사항은 릴리즈 노트 <a href="{{ .Spec.Refs.Link }}/releases/tag/{{ .Spec.Refs.Base.Ref.GetTag }}" target="_blank">{{ .Spec.Refs.Link }}/releases/tag/{{ .Spec.Refs.Base.Ref.GetTag }}</a> 참조 부탁드립니다.<br><br>감사합니다.</div>
</div>
</body>
</html>