我正在嘗試做我的第一個Jenkins作業。我想運行一個上傳到git的java專案,但在構建作業時我得到了這樣的錯誤:
我想運行一個上傳到git的java專案。
未指定證書 從遠程 Git 倉庫獲取變化 repository ERROR: Error fetching remote repo 'origin' (獲取遠程 repo)。 hudson.plugins.git.GitException。無法從 https://gitlab/engineering/automation/create_pass_criteria.git 在 hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:908) 在 hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1123) 在 hudson.plugins.git.GitSCM.checkout(GitSCM.java:1159) 在 org.jenkinsci.plugins.workflow.step.scm.SCMStep.checkout(SCMStep.java:129) 在 org.jenkinsci.plugins.workflow.step.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:97) 在 org.jenkinsci.plugins.workflow.step.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:84) 在 org.jenkinsci.plugins.workflow.step.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)。 在java.util.concurrent.Executors$RunnableAdapter.call(Unknown 來源)在java.util.concurrent.FutureTask.run(未知來源)在 java.util.concurrent.ThreadPoolExecutor.runWorker(未知來源) at java.util.concurrent.ThreadPoolExecutor$Worker.run(未知來源) at java.lang.Thread.run(Unknown Source) 導致的。 hudson.plugins.git.GitException。命令 "git fetch --tags --progress https://gitlab/engineering/automation/create_pass_criteria.git refs/heads/:refs/remotes/origin/" 回傳狀態碼128: stdout: stderr: fatal: unable to access 'https://gitlab/engineering/automation/create_pass_criteria.git/'。 對方的證書頒發者已被標記為不被用戶信任。
這是我的groovy jenkinsfile:
uj5u.com熱心網友回復: 在Jenkins中為你的git倉庫添加憑證,然后在管道中為git簽出提供憑證 要添加憑證 -
Jenkins -> Manage Jenkins ->Manage Credentials
在適用于Jenkins的商店下,點擊Jenkins,然后點擊全域憑證(不受限制的)。
從左側點擊添加憑證,為你的git倉庫定義用戶名和密碼,并記下憑證ID#!
#!groovy
pipeline {
agent { node { label "agent_314" } }
階段 {
stage("Build") {
步驟 {
echo "Building..."
git 'https://gitlab/engineering/automation/create_pass_criteria.git'
sh './mvnw clean compile' 。
}
}
}
}
更多資訊可以參考這里
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/318085.html
標籤:
上一篇:單擊HTML按鈕拋出UncaughtTypeError:Cannotreadpropertiesofnull(reading'length')
