3

I am getting started learning Jenkins and am following this "simple" tutorial found within the Jenkins documentation; it's a tutorial which goes through how to get a simple java-maven-jenkins setup working locally. I followed the tutorial instructions carefully and have gotten the needed git repository forked and cloned for myself as well as Jenkins started on my localhost, but I ran into a wall when I reached this part:

Create your Pipeline project in Jenkins where on step 8:

"In the Repository URL field, specify the directory path of your locally cloned repository above, which is from your user account/home directory on your host machine, mapped to the /home directory of the Jenkins container - i.e.

For macOS - /home/Documents/GitHub/simple-java-maven-app

For Linux - /home/GitHub/simple-java-maven-app

For Windows - /home/Documents/GitHub/simple-java-maven-app"

I am using Windows 10 with GitHub Desktop and made sure that the repository was in the required place following the tutorial, but when I try to put the Repository URL as /home/Documents/GitHub/simple-java-maven-app (as the tutorial is asking to do), I get the following error within Jenkins: Failed to connect to repository: Command "git ls-remote -h /home/Documents/GitHub/simple-java-maven-app HEAD" returned status code 128: stdout: stderr: fatal:'/home/Documents/GitHub/simple-java-maven-app' does not appear to be a git repository fatal: Could not read from remote repository. Please make sure you have the correct access right and the repository exists.

I tried searching for others with the same problem but could only find something related to solving problems with Unix-systems.

This question I found has a similar problem encountered, but I was not able to solve this problem on my system, as it focuses on Unix systems as well.

Another weirdness (to my eyes) was that Jenkins asks for the remote repository URL according to the help button, but the tutorial insists to put the local repository as the URL. As I am very new with Jenkins, it would be much appreciated if someone could enlighten me how to fix this to be able to finish the tutorial. Also because I am new with Jenkins, I hope who ever can help can really try to explain the solution in layman terms.

Cheers

ghoulfolk
  • 326
  • 7
  • 17
  • Ever figured this out? – Danielson Dec 30 '19 at 09:53
  • 1
    Nope, I had to give up on this as I never got it to working. I have learned more jenkins pipeline stuff since I asked this question, but never got to around figuring out what was the cause and fix for this. Since then I have only used actual urls in the repository url with no problems, so I guess it just doesn't allow local resources in it (even though according to the tutorial it should) – ghoulfolk Dec 31 '19 at 12:19
  • Too bad, I also gave up and am using GitHub instead :-) – Danielson Dec 31 '19 at 12:31

2 Answers2

0

Instead of using %HOMEPATH% in docker run command use c:\Users\ for mounting volume. After that docker will ask you permission allow it and enter your password. it will work.

  • nope that didn't help. I've tried that and just about everything else I could think of, I even set my C-drive as shared with Docker, but that didn't help either – ghoulfolk Feb 28 '18 at 11:36
0

I spent several hours trying to figure this out but I just did. If you followed the step to clone the repository to C:\Users\<your-username>\Documents\GitHub\ then that is good. Also, in Jenkins if you followed the step to set the Repository URL to /home/Documents/GitHub/simple-python-pyinstaller-app that is also good. When starting the jenkins-blueocean docker you need to do the following,

```
docker run --name jenkins-blueocean --rm --detach ^
  --network jenkins --env DOCKER_HOST=tcp://docker:2376 ^
  --env DOCKER_CERT_PATH=/certs/client --env DOCKER_TLS_VERIFY=1 ^
  --volume jenkins-data:/var/jenkins_home ^
  --volume jenkins-docker-certs:/certs/client:ro ^
  --volume C:/Users/<your-username>/:/home ^
  --publish 8080:8080 --publish 50000:50000 myjenkins-blueocean:2.319.3-1
```