[英]Unable to upload artifact to Nexus Repository - S4SDK Pipeline
我正在嘗試使用 Jenkins 管道中的工件部署階段將工件上傳到 Nexus 存儲庫。 為此,我向 Jenkins 提供了 Nexus 憑據和查找存儲庫的路徑。 但是,此階段因錯誤“連接被拒絕連接”而失敗。
但是,我可以在http://localhost:8081/nexus上訪問 Nexus。
下面是在 pipeline_config.yml 文件中使用的代碼。
artifactDeployment:
nexus:
version: nexus2
url: 'http://localhost:8081/nexus/'
repository: myrepo
credentialsId: 'nexus'
additionalClassifiers:
- type: jar
classifier: classes
有人可以建議解決這個問題嗎?
在您的 VM 上,登錄到您的 Jenkins 容器
前
docker exec -it s4sdk-jenkins-master bash
然后執行 curl 命令從那里到達 nexus。
前
curl http://<your VM's IP>:8081/nexus
只有在 Jenkins 容器內可以訪問主機時,您才能將工件上傳到 nexus。
這看起來很像localhost
URL 的問題。 在 Jenkins 容器中, localhost 指的是該容器,而不是您本地的 Nexus。
解決方案應該是在管道配置中使用 Nexus 的主機名。 在這種情況下,這看起來像是您的筆記本電腦的主機名。
希望這會有所幫助。
最好的問候,弗洛里安
如果您有 Jenkins 和 Nexus 容器,那么:
我在本地環境中解決了問題。
希望能幫到你!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.