如何將jenkins連接到需要客戶端ssl的gitlab?

如何將jenkins連接到需要客戶端ssl的gitlab?

我需要使用受 2 路 ssl 驗證保護的自架 gitlab 儲存庫。因此,要連接 git 自己的憑證,對 git 的請求應該附帶客戶端 ssl。

從瀏覽器的角度來看。匯入pfx憑證後,我們可以使用google chrome和mozilla firefox瀏覽。

jenkins 盒子上的 git 用戶端已透過全域 git config http.sslCert 配置了 ssl 用戶端,並且經過測試並透過命令列工作。jenkins version 2.141

我還透過上傳 p12 憑證向 git 新增了一種新類型的憑證,如下所示 詹金斯憑證頁面

但由於某些原因,當我單擊“新增”按鈕時,詹金斯仍然無法顯示選擇該客戶端證書的方法。因此,我使用帶密碼和不帶密碼的 p12 證書添加了一個新證書,兩者都給出了相同的結果。使用密碼我在密碼欄位中輸入了匯出密碼

帶密碼的 p12 證書

使用p12證書無需密碼

p12憑證無密碼

測試連接時兩者的結果是相同的: 測試連接

hudson.plugins.git.GitException: Command "git fetch --tags --progress 
origin +refs/heads/master:refs/remotes/origin/master --prune" returned 
status code 128:
stdout: 
stderr: fatal: unable to access 
'https://git.theurl.git/': The 
requested URL returned error: 400

at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2016)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1735)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:72)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:420)
at jenkins.plugins.git.GitSCMFileSystem$BuilderImpl.build(GitSCMFileSystem.java:351)
at jenkins.scm.api.SCMFileSystem.of(SCMFileSystem.java:196)
at jenkins.scm.api.SCMFileSystem.of(SCMFileSystem.java:172)
at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:108)
at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:67)
at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:303)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:429)
Finished: FAILURE

我真的別無選擇。我在上面找到了類似的帖子堆疊溢位但這並沒有真正幫助。如何通過這個攔截器?最近有人做過嗎?

相關內容