Unable to set Hostname for new Jenkins node configuration - jenkins

I'm trying to configure Jenkins permanent node for remote Linux server.
My Jenkins master is on Windows.
Unfortunately I do not get the option to enter the hosts details and it populates by login ID in place of Hosts. (Please see snapshot)
I'm using ssh keys in the credentials for user root.
I guess I have all the required plugins.
I'm on the latest version of Jernkins.
Can you please suggest how can i fix the problem ?

I found out that my username was for someone reason set in the hostname under credentials for Jenkins.
Deleting the same from the Jenkins credentials resolved the hostname issue for the slave node and now I m able to enter the correct IP.

Related

ssh to remote server with password in jenkins without ssh plugin

Can I do ssh to remote server with password without using jenkins plugin and public /private key concept ? Also can I make jenkins pipleline interactive by asking parameter value to user during runtime?
I tried it by 'execute shell' option but its not working
It's a while since I worked in this area, but I seem to remember that one computer logging into a second machine using SSH needed to have a trust relationship set up. User name and password would not work (at least under Linux)

want to add a jenkins slave as a different user say "UserX"

I have logged-in to Jenkins UI using my Unix credentials (pmandal).
Then I have added a slave node (Slave1).
Now when i "Launch slave", it tries to ssh from the MASTER to the Slave(Slave1) as "jenkins" USER, and ssh fails.
My requirement is: I want the ssh from the MASTER to the Slave as a different user say "UserZ", coz i want all my operations to be performed as UserZ.
But i am unable to do so.
So my main question here is : "How to i make the MASTER to ssh to the Slave as UserZ"?
Any help would be appreciated.jenk
create the credentials in jenkins store.
This can be done from https://<yourjenkins.url>/credentials/store/system/domain/_/newCredentials
connect the node with the option "launch agent agents via ssh jenkins". From the config page of the node, you can select the credentials you just created
Note: the option "launch agent agents via ssh jenkins" is the recommended way to connect unix/linux machines: https://support.cloudbees.com/hc/en-us/articles/115003929412-How-to-create-an-agent-in-Linux-from-console

SSH errors with Jenkins git plugin

There are lots of question on here about Permission denied (publickey) errors when using the Jenkins git plugin.
Can someone explain the authentication flow this plugin uses to check out a repository? I can't find a good description on the plugin page.
I want to just SSH into the build slave, checkout the repository there, then run my job, but clearly that is not how it works.
I guess I could add my credentials to the jenkins master, but I dont want any code there. I want it on my build slave.
Issue has nothing to do with git really. As their documentation states, it relies on git runtime which in its turn relies on system environment when it comes to secure connections. Ssh requires client to have valid key to connect and fails to that message if client does not provide one. Without any additional actions, key is not injected into environment, so client could not provide any valid key.
What you actually can use is ssh agent plugin. That allows to add key to ssh-agent on slave that will be catched up by git.

running builds on slave nodes gives me Could not find a suitable ssh-agent provider error

When I try to run my build on a slave node using jenkins I get the following error:
Could not find a suitable ssh-agent provider
Does anyone know why and how I can avoid the error?
Assuming you've installed Windows Git on Windows slave, it comes with ssh-agent binary (e.g. C:\Program Files\Git\usr\bin). Try adding its path to system variable PATH.
Alternatively generate personal API token (OAuth) for that GitHub user and specify along with your repository address, e.g.
git clone https://4UTHT0KEN#github.com/foo/bar
If you have Windows slave and SSH Credentials plugin that is because Windows doesn't provide ssh-agent. If you're using SSH Credentials plugin for provide key to git to check out a repo in comand-line step, you can provide key to git client on each agent (because git have ssh-agent). If your case not that I supposed, you need to follow steps described here in second comment.

Jenkins - change master's ip

I had a technical problem that forced me to change my jenkins master computer.
I took the hard disk and moved it to a new computer, but now the IP of the master computer changed.
The master jenkins works but the slave nodes are marked as offline, and when I try to create new nodes the installation fails on the node pc.
I noticed that the error I get when creating new nodes is connection time out, and i see the old IP.
How can I fix this?
I had a similar situation as the one described by Gilad, and i use the web start launch method (thanks Vitali for the comment). I solved it doing the following:
In your jenkins Dashboard go to Manage Jenkins > Configure System
Under Jenkins Location set the Jenkins URL to the new IP address of your server computer
Save changes
On jenkins dashboard under Build Executor Status click on your slave node
Click launch button to download new slave agent with updated IP and save it in desired location.
web start slave launch. On the picture, below the sentence "Run from slave command line" you should see a command that includes the new IP address
Launch the slave agent and it should now connect to the new IP address successfully!
Hope this helps anyone else!
I found the solution, I will post it in case anyone else will have this problem:
Go to the jenkins folder in the slave node (this is the folder you defined when you created the node).
open jenkins-slave.xml and in change the ip address to the new address.

Resources