1. 程式人生 > 其它 >|NO.Z.00374|——————————|CloudNative|——|KuberNetes&CI/CD.V12|-----------------------------------------------------------|Jenkins.v11|Credentials配置|

|NO.Z.00374|——————————|CloudNative|——|KuberNetes&CI/CD.V12|-----------------------------------------------------------|Jenkins.v11|Credentials配置|



[CloudNative:KuberNetes&CI/CD.V12]                                                                    [Applications.KuberNetes] [|DevOps|CICD|Jenkins|JenkinsCredential配置|]








一、JenkinsCredentials配置
### --- 在Jenkins下配置主機私鑰

~~~     此環境下已經把公鑰匯入到了gitlab下的SSH key中了
~~~     在Jenkins下配置私鑰即可
### --- 所有節點配置域名hosts檔案

[root@k8s-node01 ~]# cat /etc/hosts
192.168.1.16 gitlab.test.com
### --- k8s-master01主機的私鑰

[root@k8s-master01 spring-cloud-demo]# cat ~/.ssh/id_rsa
~~~     # Chrome:
~~~     http://192.168.1.14:28080/:Dashboard——>Credentials——>System
~~~     ——>Global credentials(unrestricted)——>Add Credentials
~~~     ——>kind:username with password——>Username:yanqi_vip——>Password:******
~~~     ——>ID:REGISTRY_USER——>Description:映象倉庫密碼——>OK 
~~~     # Chrome:
~~~     http://192.168.1.14:28080/:Dashboard——>Credentials——>System
~~~     ——>Global credentials(unrestricted)——>Add Credentials
~~~     ——>kind:SSH Username with private key——>ID:空:自己生成
~~~     ——>Description:gitlab key——>Username:gitlab-key
~~~     ——>Private Key:Enter directly:key:master節點的私鑰
~~~     ——>Passphrase:空:若是需要輸入密碼可以輸入進去,私鑰可以不用寫入
~~~     ——>ok ——>會生成一個ID,這個ID後期會使用到

~~~     # 檢視新增的憑證
二、測試Gitlab是否可以正常獲取到資料
### --- 測試Gitlab是否可以正常獲取到資料

~~~     # 在jenkins下建立專案:
~~~     NEW Iterm——>Enter an item name:gitlab-test——>Pipeline——>ok
~~~     ——>General:This project is parameterized:Add Parameter
~~~     ——>List Git branches(and more)——>name:BRANCH
~~~     ——>Repository URL:[email protected]:kubernetes-guide/spring-cloud-demo.git
~~~     ——>Gredentials:gitlab-key(gitlab key)——>Parameter Type:Branch
~~~     ——>save——>檢視:Pipeline gitlab-test:BRANCH:refs/heads/master:說明是可以獲取到的
~~~     # 在gitlab取專案地址:
~~~     [email protected]:kubernetes-guide/spring-cloud-demo.git
三、驗證是否可以獲取到資料
### --- 驗證是否可以獲取到資料

~~~     顯示refs/heads/master說明從gitlab獲取資料正常








===============================END===============================


Walter Savage Landor:strove with none,for none was worth my strife.Nature I loved and, next to Nature, Art:I warm'd both hands before the fire of life.It sinks, and I am ready to depart                                                                                                                                                    ——W.S.Landor



來自為知筆記(Wiz)