Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to upload artifact to Nexus Repository - S4SDK Pipeline

Tags:

s4sdk

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

screenshot

Could someone please suggest in resolving this issue?

like image 660
Sankeerth Avatar asked Mar 12 '18 19:03

Sankeerth


1 Answers

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.

like image 65
Ram Avatar answered Oct 20 '22 04:10

Ram