
我有一個 Jenkins 設置,其中控制器(linux)使用用戶名/密碼身份驗證通過 ssh 連接到從站(windows)。每當我嘗試啟動我得到的代理時,我都會這樣做Error: Unable to access jarfile remoting.jar
。我已嘗試修改文件和資料夾權限,但這並沒有解決問題。是什麼導致 jenkins 無法存取或執行 jarfile?
「遠端根目錄」設定為D:\Jenkins1114
,預設 Shell 為cmd.exe
,從站上的 Java 版本為11.0.11
,控制器上的 Java 版本為11.0.13
相關日誌:
[12/28/21 15:37:40] [SSH] Starting agent process: cd "D:\Jenkins1114" && java -jar remoting.jar -workDir D:\Jenkins1114 -jar-cache D:\Jenkins1114/remoting/jarCache
Error: Unable to access jarfile remoting.jar
Agent JVM has terminated. Exit code=1
[12/28/21 15:37:41] Launch failed - cleaning up connection
[12/28/21 15:37:41] [SSH] Connection closed.
答案1
它失敗是因為 cd "D:\Jenkins1114" 實際上並沒有更改驅動器。該命令需要是
cd /d "D:\Jenkins1114"
因此,它找不到 jar 文件,因為在 cd 之後它仍然位於 C: 磁碟機而不是 D: 磁碟機上。抱歉,除了在 C: 驅動器上安裝 jenkins 之外,我沒有找到其他解決方案。