I am trying to upload the artifact to Nexus repository using the Artifact deployment stage in the Jenkins pipeline. For doing this I am providing Jenkins with the Nexus credentials and the path to find the repository. But, this stage is failed with an error "the connection is refused to nexus".
However, I am able to access Nexus on http://localhost:8081/nexus .
Below is the code used in pipeline_config.yml file.
artifactDeployment:
nexus:
version: nexus2
url: 'http://localhost:8081/nexus/'
repository: myrepo
credentialsId: 'nexus'
additionalClassifiers:
- type: jar
classifier: classes
Could someone please suggest in resolving this issue?
On your VM, login to your Jenkins container
ex
docker exec -it s4sdk-jenkins-master bash
Then execute curl command to reach the nexus from there.
ex
curl http://<your VM's IP>:8081/nexus
You will be able to upload artifact to nexus, only if the host is reachable from within the Jenkins container.
this looks very much like an issue with the localhost
URL. From within the Jenkins container, localhost refers to that container, and not to your local Nexus.
The solution should be to use the hostname of the Nexus in your pipeline config. It looks like this is the hostname of your laptop in this case.
Hope this helps.
Best regards, Florian
If You have Jenkins and Nexus container, So:
I fixed problem in my environment local.
I hope can helps!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.