How to set / connect jenkins slave agent back on previous machine - jenkins

Is there any possibility to set a slave agent back to the previous machine without deleting the agent / node? Will the node be completely deleted if i'm deleting the agent?
In my case for example, if someone has installed by accident the agent via "Launch"-Button (Java WS) on an other machine. But this other machine is not intended to have an connection with the agent (because of missing files and wrong user).
He got the option displayed to add an agent for his current used machine (wrong machine) which led to the problem, but now i don't see this option ("Launch"-Button) anymore to reconnect the agent with the previous necessary machine.
Maybe this could be a resolution?
Already tried:
Using following command line on required slave machine in C:\Jenkins:
java -jar slave.jar -jnlpUrl http://<<build-server:port>>/computer/<<agent name>>/slave-agent.jnlp
Execution wasn't successful..
Thanks in advance!!

Related

linux slave is not coming online after jenkins service restart. Jenkins master is on windows

I have my jenkins installed on windows . and have two linux node added to it.
for some reason I needed to restart the jenkins service and now my linux is not coming online.but
when I go to these nodes I can see the option to mark them offline Which I believe comes when node is actually online like below
[![enter image description here][2]][2]
How To bring these nodes back online. before jenkins restart everything was fine and I have not made any changes to slaves.
**Changes I made to jenkins.xml before restart was **
Changed the java version
<executable>C:\Program Files\Java\jdk-17.0.5\bin\java.exe</executable>
Added keystore value in pre existing argument
<arguments>-Xrs -Xmx512m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -Dhudson.model.DirectoryBrowserSupport.CSP="" -jar "%BASE%\jenkins.war" --httpPort=-1 --httpsPort=8000 -httpsKeyStore="jenkins.jks" --httpsKeyStorePassword=xxxxx -webroot="%BASE%\war"</arguments>
I don't think your changes had anything to do with the error. Try these options:
Go into the Linux VMs and make sure they are online
Ping the Linux VMs from the master VM to see if they are reachable
Edit the slave node configuration, check everything is as it was before, and save
Finally, remove the slave nodes and add them again

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.

Jenkins Windows Slave Disappears on restart

I have a Jenkins master setup which has 2 linux slaves and a windows slave. I have a configuration where all boxes are switched off in the night and restarted in the morning. The Jenkins master shows 2 linux nodes in the morning however it does not show windows slave (it just disappears and not even shown offline). The Jenkins version I am using : 2.73.
The problem was related to swarm configuration which was resolved after putting together correct configuration files and enable on machine startup (to handle a situation if the machine goes down).

My windows slave is running as unix slave in Jenkins?

it is weird that jenkins no recognizing slave as windows. it is launched as JAVA WEBSTART but it runs as unix slave. How can i have this run as windows slave?
JNLP agent connected from /198.112.40.148
<===[JENKINS REMOTING CAPACITY]===>Slave.jar version: 2.21
This is a Unix slave
WARNING: C:\softs\jenkins looks suspiciously like Windows path. Maybe you meant C:/softs/jenkins?
Copied maven-agent.jar
Copied maven3-agent.jar
Copied maven3-interceptor.jar
Copied maven-interceptor.jar
Copied maven2.1-interceptor.jar
Copied plexus-classworld.jar
Copied classworlds.jar
Slave successfully connected and online
Jenkins tries to guess the OS based on parth.separator. For some reason your java process has it set wrongly.
Are you over-riding the path.separator property in your command line?
If cygwin is involved with this, then perhaps you are connecting to a Unix-ish environment on top of Windows.

Is this a supported Jenkins Master-slave configuration?

We have a master Jenkins running on a Linux system. The same master is attached as node using "Launch slave via execution of a command on the master". It has the same FS root as the JENKINS_HOME. The command is ssh "machine_name" "shell_script"
The shell script gets the latest slave.jar and runs it.
The master has 0 executors. The node has been given 7. I'm seeing weird behavior in the builds, like workspaces being deleted once a day, etc. I'm not sure if this is related to the way the Jenkins Master-slave is configured.
Any ideas if this is a supported configuration?

Resources