Connection issue with Jenkins within Docker on RaspberryPi 3 (rpi-jenkins) when cloning a Bitbucket Git Repo - docker

I'm currently playing around with Jenkins on Raspi within Docker (using dilgerm/rpi-jenkins image).
Now I have a problem with connecting to a Bitbucket Git repository.
When entering the repository url, I get (the commonly known) "Failed to connect to repository"
When using https and providing credentials (via Jenkins Credentials store), I get the error.
When using ssh and configuring the keys properly, I get the same error.
Now I am wondering if I have to configure the ssh-key withing the docker container (for the Jenkins user?). Currently, I have implemented the key on the hosting Raspi itself.
Or may it be required to configure/publish the ssl port of the Docker container on startup (-p parameter)?
Any help appreciated.

Related

##[error]Git fetch failed with exit code: 128

We have a Git repo on TFS and I am trying to create a pipeline using azure pipelines to connect to the TFS repos.
I get the following error:
fatal: unable to access 'http://tfs.****************': Could not resolve host: tfs.******
##[error]Git fetch failed with exit code: 128
I would suggest you first use "git clone" command line to clone remote repo.
Kindly check when you run it manually from the build agent, it work for that repo or not.
This will narrow down if the issue related to your environment or pipeline.
If you are able to use git command to connect and clone that repo.
This means there is something wrong with your build service
account. You should make sure build service account has access to that
repo. You could also directly change the service account to the one
you used to run git command.
If you are not able to do it. Then this may related to network
environment. Make sure your build agent are able to access TFS
on-premise server. Temporarily turn off firewall and any proxy. Also
try to directly use browser to login TFS web portal.
It seems that it is a self-deployment of TFS server then you need to make sure that the Server can be reached from Azure DevOps.
Based on URL in your post, I assume server is not reachable from public internet. So TFS server should be either on-prem or on a VM in Azure. So reach out to your infrastructure team to see where the server is, and how the connection could be established from build agent being used by Azure DevOps to the TFS server.

Webhook for local Jenkins and hosted Gitlab?

I want to make a webhook for when I push something to Git lab. Git lab is hosted by school and I've installed Jenkins locally. Now when I want to make a webhook http://localhost:8080/project/timely-frontend
Gitlabs says: "URL is blocked: Requests to localhost are not allowed". Are there any other possible ways to make a push webhook?
If Jenkins and Gitlab are both installed on the same internal (school) network, try using the internal private IP address of Jenkins as the webhook URL instead of localhost.
On the Jenkins host, this can be obtained using a command line ip addr show on Ubuntu and put that in the Gitlab webhook.
Keep in mind that especially if Jenkins is running on a non-standard port (8080), other firewalls outside your control could still block the connection.

How to set up an Azure DevOps service connection or endpoint to my localhost Jenkins install

I have Jenkins installed on an Ubuntu 18.04.3 LTS desktop PC on my localhost.
I also have an AzureDevOps repo on which I can successfully run a build, through a Jenkins pipeline job, connecitivity achieved via my AzureDevOps personal access token (PAT).
I am now trying to set up a Jenkins service connection or endpoint in AzureDevOps, to enable me trigger an Azure DevOps pipeline release whenever a Jenkins build completes successfully.
To achieve this in AzureDevOps, I am trying to set up access to Jenkins via a Jenkins service endpoint. The endpoint configuration requires among others, a Jenkins "Server URL" (screenshot below). Not surprisingly, AzureDevOps is unable to connect to my Jenkins instance as it's running on my local machine and therefore not publicly accessible.
Any suggestions on how I can overcome this hurdle would be most appreciated.
How to set up an Azure DevOps service connection or endpoint to my localhost Jenkins install
As we know, in order to receive the service hook notifications, you'll need to expose a port to the public internet.
To expose a port to the public internet, you can try to use the tool ngrok:
ngrok exposes local servers behind NATs and firewalls to the public
internet over secure tunnels.
Please check the document Configure a service hook for PR events for some more details.
Hope this helps.

Jenkins deployment on GCP VM via shell script

I'm new to Google Cloud Platform and want to build a deployment pipeline via Jenkins. I have a virtual machine up and running that I connect via SSH button given on the dashboard and do deployments.
Unlike AWS where I get pem file to connect... I don't have a file to connect here. Now, in Jenkins when I want to connect via shell script and deploy latest code on VM - I don't know how to do it.
something like
ssh -i #some-file name:ip
Kindly help as to how can I connect/ssh gcp vm via shell in Jenkins and make deployments. Step by step answer needed. Thanks!
There are still PEM files stored in the VM instance, you can locate them in $HOME/.ssh.
See this stack post about how to retrieve SSH keys on GCE

Jenkins master fails to connect to the slave over SSH

Jenkins master is running on Amazon instance and slave machine set up on dedicated Soyoustart machine. Worked fine until it was needed to redo the slave setup: reinstalled the OS, installed Java, added masters key to slave authorized_keys and removed/added again the slave in masters known_hosts. Set up new credentials for the slave and configured the node in Jenkins master but it is unable to connect to the slave.
The setup is the the same that is and has been working with other slaves without hiccups. The only thing different is that this time the new slave is the same machine with the IP as the old one was.
It is possible to ssh into the slave from master from CLI(replaced filename and slave IP with placeholder for this post):
$ ssh -i <key-file> jenkins#<slave-ip>
Credentials have been set up :
Node is configured:
Output when connecting to the slave:
[05/17/15 07:30:31] [SSH] Opening SSH connection to <slave-ip>.
Key exchange was not finished, connection is closed.
ERROR: Unexpected error in launching a slave. This is probably a bug in Jenkins.
java.lang.IllegalStateException: Connection is not established!
at com.trilead.ssh2.Connection.getRemainingAuthMethods(Connection.java:1030)
at com.cloudbees.jenkins.plugins.sshcredentials.impl.TrileadSSHPublicKeyAuthenticator.getRemainingAuthMethods(TrileadSSHPublicKeyAuthenticator.java:88)
at com.cloudbees.jenkins.plugins.sshcredentials.impl.TrileadSSHPublicKeyAuthenticator.canAuthenticate(TrileadSSHPublicKeyAuthenticator.java:80)
at com.cloudbees.jenkins.plugins.sshcredentials.SSHAuthenticator.newInstance(SSHAuthenticator.java:207)
at com.cloudbees.jenkins.plugins.sshcredentials.SSHAuthenticator.newInstance(SSHAuthenticator.java:169)
at hudson.plugins.sshslaves.SSHLauncher.openConnection(SSHLauncher.java:1173)
at hudson.plugins.sshslaves.SSHLauncher$2.call(SSHLauncher.java:701)
at hudson.plugins.sshslaves.SSHLauncher$2.call(SSHLauncher.java:696)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
[05/17/15 07:30:31] Launch failed - cleaning up connection
[05/17/15 07:30:31] [SSH] Connection closed.
Version numbers:
Jenkins 1.613
SSH Credentials Plugin 1.11
SSH Slaves plugin 1.9
For those who prefer to dig into code:
SSH Credentials Plugin
SSH Slave Plugin
Trilead SSH
Am I missing something obvious here? What could be causing this? Any known workaround? Or does it look like a bug that needs to be reported?
Please let me know if more information is needed.
I'm running Jenkins master using official Docker image which uses OpenJDK8 and should not need to install JCE.
Apparently this is an unresolved issue in Jenkins/SSH security.
My current workaround is by commenting out MACs and KexAlgorithm line in /etc/ssh/sshd_config of Jenkins Slave and restarting the sshd (service ssh restart on Ubuntu)
UPDATE: the issue has been resolved as of 2017-04-29
I suspect that you need to install the Java Cryptography Extension for your JVM.
Without that the RSA key size is limited and authentication is not being established.
See https://issues.jenkins-ci.org/browse/JENKINS-26495 for more details.

Resources