I'm trying to get a setup where Gitea and Jenkins are running in separate Docker containers and set up a simple pipeline.
The issue I'm running into is connecting Jenkins to Gitea. In my setup, Gitea is listening for SSH on port 22 in the container, and I map this to port 3001 on my localhost (for testing purposes for now).
From the create new pipeline interface, I'm asked to provide the SSH url to the Gitea repo. I did provide this as:
git@localhost:3001/repo/project.git
But it seemed Jenkins was unable to connect saying that I need a valid URL. I have already added the Jenkins generated key to my Git user profile.
I then tried to do a git clone from my localhost, so I generated a pair of keys, added the public key to the same Git profile, and then executed the command
git clone ssh://git@localhost:3001/repo/project.git
However the result was:
Cloning into 'project'...
ssh_exchange_identification: Connection closed by remote host
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
So I'm not really sure what I'm missing. I did add my local machine generated key to GitHub and was able to clone fine from there, so am pretty sure this is related to Gitea in the Docker environment.
I already verified that the Jenkins container can see the Gitea container and that they are joined on the same network.
What am I missing here so that I can git clone from Gitea running in Docker ? I believe this would be the key to solving the Jenkins issue as well.
Thanks