本文作者:徐曉偉
GitLab 是一個全球知名的一體化 DevOps 平臺,很多人都透過私有化部署 GitLab 來進行原始碼託管。極狐GitLab 是 GitLab 在中國的發行版,專門為中國程式設計師服務。可以一鍵式部署極狐GitLab。
本文主要講述了在極狐GitLab 使用者找回密碼、流水線失敗等需要提醒時傳送郵件。
說明
啟用前檢視後臺任務,檢視已停滯歷史郵件
- 如果不進行干預,當郵件配置生效後,可以重試歷史郵件
- 如果不想傳送大量歷史電子郵件,可刪除未傳送的電子郵件
文件
- 電子郵件
- 電子郵件配置
配置
-
以下配置使用 Microsoft Office 365 IMAP 配置,其他配置雷同,參見: 電子郵件
-
建立 Microsoft Office 365 IMAP 密碼 secret
kubectl -n gitlab-test create secret generic smtp-password --from-literal=password=你的密碼
-
匯出 helm gitlab 配置
helm -n gitlab-test get values my-gitlab > my-gitlab.yaml
-
修改 helm gitlab 配置
global: smtp: address: smtp.office365.com authentication: login domain: test.helm.xuxiaowei.cn enabled: true openssl_verify_mode: peer password: key: password secret: smtp-password port: 587 starttls_auto: true user_name: gitlab@test.helm.xuxiaowei.cn
-
更新 helm gitlab 配置
helm upgrade -n gitlab-test --install my-gitlab gitlab/gitlab -f my-gitlab.yaml --timeout 600s --version 7.7.0
-
等待所有 pod 更新完成
[root@anolis-7-9 ~]# kubectl -n gitlab-test get pod -o wide NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES cm-acme-http-solver-2ldtp 1/1 Running 14 (24m ago) 2d10h 192.168.210.255 anolis-7-9 <none> <none> cm-acme-http-solver-94dv5 1/1 Running 14 (24m ago) 2d10h 192.168.210.194 anolis-7-9 <none> <none> cm-acme-http-solver-klkpz 1/1 Running 14 (24m ago) 2d10h 192.168.210.253 anolis-7-9 <none> <none> my-gitlab-certmanager-8457bfdc8-w858k 1/1 Running 14 (24m ago) 2d10h 192.168.240.118 anolis-7-7 <none> <none> my-gitlab-certmanager-cainjector-74df787cf4-j7cfc 1/1 Running 14 (24m ago) 2d10h 192.168.240.66 anolis-7-7 <none> <none> my-gitlab-certmanager-webhook-7b86db4c96-dhcxl 1/1 Running 14 (24m ago) 2d10h 192.168.240.98 anolis-7-7 <none> <none> my-gitlab-gitaly-0 1/1 Running 14 (24m ago) 2d10h 192.168.210.196 anolis-7-9 <none> <none> my-gitlab-gitlab-exporter-55dcfcb595-gl6nm 1/1 Running 14 (24m ago) 2d10h 192.168.210.230 anolis-7-9 <none> <none> my-gitlab-gitlab-pages-f65879869-c9kxd 1/1 Running 1 (24m ago) 21h 192.168.210.236 anolis-7-9 <none> <none> my-gitlab-gitlab-runner-5f6ff5994c-wdw5l 1/1 Running 4 (19m ago) 25h 192.168.210.216 anolis-7-9 <none> <none> my-gitlab-gitlab-shell-55fdc9cb9f-52gnr 1/1 Running 14 (21h ago) 2d10h 192.168.240.125 anolis-7-7 <none> <none> my-gitlab-gitlab-shell-55fdc9cb9f-cfhsh 1/1 Running 14 (24m ago) 2d10h 192.168.210.219 anolis-7-9 <none> <none> my-gitlab-issuer-38-h4pdv 0/1 Completed 0 8m41s 192.168.240.114 anolis-7-7 <none> <none> my-gitlab-kas-688dc97ddd-28gr7 1/1 Running 38 (24m ago) 2d10h 192.168.240.95 anolis-7-7 <none> <none> my-gitlab-kas-688dc97ddd-tvkvd 1/1 Running 45 (18m ago) 2d10h 192.168.210.243 anolis-7-9 <none> <none> my-gitlab-migrations-38-8fnqg 0/1 Completed 0 8m41s 192.168.240.81 anolis-7-7 <none> <none> my-gitlab-minio-66f584f746-t6qwb 1/1 Running 7 (19m ago) 2d2h 192.168.210.237 anolis-7-9 <none> <none> my-gitlab-minio-create-buckets-38-nfs8t 0/1 Completed 0 8m41s 192.168.240.78 anolis-7-7 <none> <none> my-gitlab-nginx-ingress-controller-6bdd56c45-ch57n 1/1 Running 14 (24m ago) 2d10h 192.168.240.124 anolis-7-7 <none> <none> my-gitlab-nginx-ingress-controller-6bdd56c45-cm2lz 1/1 Running 15 (19m ago) 2d10h 192.168.210.193 anolis-7-9 <none> <none> my-gitlab-postgresql-0 2/2 Running 30 (19m ago) 2d10h 192.168.210.250 anolis-7-9 <none> <none> my-gitlab-prometheus-server-646489c599-8mgc9 2/2 Running 30 (19m ago) 2d10h 192.168.210.248 anolis-7-9 <none> <none> my-gitlab-redis-master-0 2/2 Running 30 (19m ago) 2d10h 192.168.210.252 anolis-7-9 <none> <none> my-gitlab-registry-78fc549f8d-d2zjv 1/1 Running 14 (24m ago) 2d10h 192.168.240.67 anolis-7-7 <none> <none> my-gitlab-registry-78fc549f8d-xbkvh 1/1 Running 14 (24m ago) 2d10h 192.168.210.247 anolis-7-9 <none> <none> my-gitlab-sidekiq-all-in-1-v2-7b6d5575fb-kwvtf 1/1 Running 0 8m41s 192.168.240.77 anolis-7-7 <none> <none> my-gitlab-toolbox-658f8894ff-tzlct 1/1 Running 0 8m40s 192.168.240.79 anolis-7-7 <none> <none> my-gitlab-webservice-default-fd8948f47-jkm44 2/2 Running 0 7m45s 192.168.240.73 anolis-7-7 <none> <none> my-gitlab-webservice-default-fd8948f47-mxjz6 2/2 Running 0 8m41s 192.168.210.195 anolis-7-9 <none> <none> [root@anolis-7-9 ~]#
-
重試一個歷史任務或者重試一個異常流水線,即可傳送郵件
- 傳送郵件
- 接收郵件
- 傳送郵件
號外號外!
極狐GitLab 正在推出DevSecOps 成熟度測評!連結:https://gitlab.cn/devsecops-assessment/ 測評非常全面並提供了可靠建議,即使不付費買產品,對自己想要落地 DevSecOps 的使用者具有很高的參考意義!快來動手試試吧!