Adding a slave to jenkins - jenkins

I am trying to add a slave in Jenkins. I followed the steps as in https://wiki.jenkins-ci.org/display/JENKINS/Step+by+step+guide+to+set+up+master+and+slave+machines .
I added a new node on the Master. But inorder to connect my slave machine, I am not able to find the added node on the slave.
Any ideas on what might be going wrong?
I checked and I do have connect permissions.

The easiest way to add a new Jenkins slave node is
Adds a new node on master (you can do it on the Jenkins web UI)
Once step 1 is done, it will show that the node is offline.
Remote desktop to slave machine. Browse the URL that says the node is offline on slave.
Clicks Lunch on the page, wait until it shows a confirmation dialog to download/execute slave-agent.jnpl file.
Wait until it shows this popup.
Clicks File and selects Install as a Windows Service

Related

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

Jenkins - Master Slave set up questions

I followed tutorial to get Jenkins set up on Windows.
What i have is:
Jenkins running with recommend plugins installed
Jenkins URL changed to http:// my ipv4:8080/
A project with a simple command [echo hi]
For nodes i currently have just the Master node which is tied to my main PC
My goal is have one computer send a command to all the slave PC's so they run a python script i created.
I create a windows VM and connected to the Jenkins server. I logged in with the admin account and created a new node.
I cant find anything useful to help me figure out what to put in launch command. When i launch my node on the VM without the launch command specified, it fails to launch.
Is the batch script i wrote in the project, what's sent to all the slave machines or do I have this all wrong?
Thank you!
EDIT
I got it working thanks to the answer posted here. I wrote up a doc on how i got Jenkins working from installation to deployment. There are other resources out there but i hope this will help someone.
Jenkins Master/Agent Setup
If you want to have the option Launch slave agents via Java Web Start you should specify the TCP port for slaves.
It is done through Manage Jenkins > Configure Global Security > TCP port for JNLP agents. You can select fixed port 50000. More info here.

How to find the IP/Host name of the slave added as a node to the Jenkins Master?

Is there any way to find the IP/hostname of the slave node?
Situation here is,
no access to the Jenkins master machine.
no details to the Slave Machine available.
Just we have is to login Jenkins Master dashboard and can see the slaves.
I couldn't able to fins any details of the slaves IP or Hostname.
Your steps to find or suggestions will be appreciated.
This is not same as the below case
How to find the ip address of a jenkins node from the master
I cannot able to login to the Jenkins master machine too.
I have found the easiest way to find the node/slave machines IP from Jenkins Master UI.
Goto Jenkins Master Dashboard page
Click Manage Jenkins
Click Manage Nodes
Click Any Slave Machine
Click Log
You can see the first line with the IP Address of it.
The way to get the slave machine Host name is as below,
Manage Jenkins -> Manage Nodes -> (Select the Slave Machine ) -> System Properties
Then Look for "Computer Name"

Switch Jenkins Slave to a Different Master

I have a simple Jenkins master/slave set-up but I'd like to be able to switch which master the slave points at.
Is it possible to do this by changing some config on the slave?
For a Windows Slave configuration remove the JNLP Slave for Master1/Slave node by
1. Stopping the Jenkins Slave Windows service
2. Launch a Command Prompt as an Administrator
3. then use sc delete jenkins_service_name
For OS X check out https://github.com/rhwood/jenkins-slave-osx/wiki/Uninstall
Now open a browser on the slave machine and go to your Jenkins master2 server url then Jenkins -> Manage Jenkins -> Manage Nodes -> Node (assuming the node is already setup on master2 server) and click on the Launch button to launch agent from browser on slave machine. You prob. know how to do this already. If not use this guide https://wiki.jenkins-ci.org/display/JENKINS/Step+by+step+guide+to+set+up+master+and+slave+machines
Maybe you can try having the slave setup on both master1 and master2 by
1. Skip my delete steps above
2. open a browser on the slave machine and go to your Jenkins master2 server url then Jenkins -> Manage Jenkins -> Manage Nodes -> Node (assuming the node is already setup on master2 server) and click on the Launch button to launch agent from browser on slave machine.
3. Instead do "Save File" and click ok in step 5b from https://wiki.jenkins-ci.org/display/JENKINS/Step+by+step+guide+to+set+up+master+and+slave+machines
4. Save the slave-agent.jnlp to a new folder. I'm sure the two agents will run on that slave machine without interfering each other.
Definitely. If you want to be able to switch the slave back and forth between two masters, you can set up a second slave agent on the slave machine. Steps to do this depend on the type of slave (JNLP, remote ssh, etc). Disconnect the slave from the old master using the Manage Slaves page, and shut down the first slave agent on the slave machine. Start your second slave agent, and add that slave to the second master.
You can actually have both slave agents running and have the slave be connected to both masters, although they won't know anything about each other and could both send a job to the slave at the same time regardless of the number of executors.

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