Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins Artifactory plug-in: Error occurred while requesting version information: Connection refused

I get the error "Error occurred while requesting version information: Connection refused" when I test the connection in Jenkins configuration for Artifactory plug-in. I have tried it with Anonymous access enabled in Artifactory, with Anonymous access disabled, and tried all three options (Supported, Unsupported, Required) for Password Encryption in Artifactory. I have Default Deployer Credentials in my Jenkins Artifactory configuration, and I have tested the connection with 'Use Different Resolver Credentials' and without. I consistently get this error.

Any help/ideas would be greatly appreciated

like image 705
JesusReagan Avatar asked Oct 15 '16 00:10

JesusReagan


People also ask

How do I connect Jenkins to Artifactory?

To install the Jenkins Artifactory Plugin, go to Manage Jenkins > Manage Plugins, click on the Available tab and search for Artifactory. Select the Artifactory plugin and click Download Now and Install After Restart.

How do you upload artifacts to jFrog Artifactory using Jenkins pipeline?

To upload or download files to and from your Artifactory server, you need to create an Artifactory server instance in your Pipeline script. If your Artifactory server is already defined in Jenkins, you only need its server ID which can be obtained under Manage | Configure System.

How do you push artifacts to Artifactory from Jenkins?

This is made via passing Jenkins BUILD_NUMBER variable to Maven. In the post-build actions section, add deploy artifacts to the Artifactory step, specify that you would like to add your artifacts, and check the 'Deploy Maven Artifacts' checkbox. You will also need to specify a project name and path to your repository.


1 Answers

I also ran in a similar problem yesterday.

Problem:
I was running jenkins and artifactory in two different docker containers on my local. I had exposed port 8086 for artifactory and could access it using http://localhost:8086/artifactory in my browser. But giving the same url for artifactory in jenkins produced the above reported error in question.

Solution:
For some unknown reasons, jenkins artifactory plugin couldn't resolve http://localhost:8086/artifactory even though the docker mappings was correct and it was possible to connect to artifactory web based console with the same URL.

Replacing "localhost" with docker container IP did the trick. Name of my container in which artifactory was running was docker-plgr_artifactory_1

Admins-MacBook-Pro-2:~ prakash.tiwari$ docker exec -it docker-plgr_artifactory_1 cat /etc/hosts
127.0.0.1   localhost
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
172.18.0.2  08038bc9449b

The IP of container was 172.18.0.2. So I replaced http://localhost:8086/artifactory with http://172.18.0.2:8081/artifactory and jenkins was now able to connect to artifactory. (8081 is the port in docker container at which artifactory was running. You'd have given it at the time of running the container. Alternatively, you can find it by running docker ps and checking the value under PORTS field.)

Credit: https://www.arvinep.com/2016/04/jenkins-docker-container-problem.html

Note: I know this solution doesn't explain the cause and why it works, but I hope it at least helps some people and saves their time.

like image 80
prakasht Avatar answered Sep 23 '22 18:09

prakasht