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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With