Unable to see launch slave agents on Unix machines via SSH on Jenkins - jenkins

I have two different Jenkins instances with different versions.
One has version 1.609.1 and when I create a slave on it I see options in the launch method like:
"Launch slaves agents on a Unix machine via SSH"
"Launch slave agents via Java web start"
"Launch slaves via execution of command on the master and let Jenkins control this Windows slave as a Windows service"
I have one more instance that is of version 2.89.4, but the slave launch option is different - it has one *"Launch slaves agent via SSH". The rest of the all options are the same.
Is this slave launching option something version-specific?

It is specific to the plugin. You need to add it in your missing instance. See SSH Slaves Plugin.

Related

Can Jenkins Slave machine be configured for two different servers

Hello At work we have 2 Jenkins servers but at the moment we have limited slaves machines , I was asked to make a research if its possible to configure a slave machine for 2 different servers ?
so if I would use a machine as a slave I would do these steps:
1-Install Jenkins on the slave machine.
2-On the Jenkins master, go to "Manage Jenkins" and then click on "Manage Nodes".
3-Click on "New Node" to create a new slave node.
4-Give your slave node a name and select "Permanent Agent" as the type.
5-Click "OK" to create the slave node.
6-On the slave machine, open a terminal and navigate to the Jenkins home directory. This is typically located at /var/lib/jenkins on Linux machines.
7-java -jar slave.jar -jnlpUrl https://<Jenkins_URL>/computer/<Node_Name>/slave-agent.jnlp -secret <Node_Secret>
Replace <Jenkins_URL> with the URL of your Jenkins server, <Node_Name> with the name of your slave node, and <Node_Secret> with the secret that was generated for the slave node on the Jenkins master.
8-The slave agent should now be connected to the Jenkins master and ready to run build tasks.
why can't I do the same steps twice for two different servers , can you explain why it's not possible ?
It is possible but you have to configure them differently.
Both applications are same so windows/java by default thinks it as reconnection instead of new instance. Not sure but this can work by renaming your jnlp files.
Both the application needs to configure to use different IP to avoid connection error.

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.

Running HP Load Runeer or QTP from Jenkins

I have HP Load Runner installed in Windows 2012 and its hosted in the cloud.
For running load runner scripts, I connect to the system via mstcs, open the Virtual User Generator application and run the scripts.
Now I want to run the scripts via Jenkins( installed in a different system ) and I tried using the Jenkins HP Application Automation Tools plugin but I was unable to figure out how to do that.
In Jenkins I found out the following option:
Execute HP functional tests from HP ALM
Execute HP tests from file system
Execute HP tests using HP ALM Lab Management
Execute HP tests using HP Performance Center
But I am not sure how to use them or any of these will work. Can some please help me with this?
For individual scripts alone, mdrv command line. For controller alone wlrun command line. You may refer to knowledge base articles on the arguments to employ.
Have you gone through the documentation for HP automation plugin for Jenkins?
At last I figured out how to integrate it.
Integrating HP Load Runner:
For Running HP Load Runner scrips there is a Jenkins plugin named HP Application Automation Tools.
The challenge for us was the fact that Jenkins and Load Runner were installed on separate machines. We had Jenkins installed in our Dev server and HP Load Runner installed on cloud. If both were installed on the same machine then the task would be as simple as providing the filesystem path for Load Runner Scenario *.lrs files, in Execute HP tests from file system plugin.
So I went ahead and installed a slave instance of Jenkins in our CTC in which Load Runner was installed.
Steps to setup Jenkins slave instance.
On your master machine go to Manage Jenkins -> Manage Nodes.
New Node --> Enter Node Name.
Select Dumb Slave --> Press OK.
Fill out the following:
Set a number of executors (one or more) as needed.
Set a Remote FS Root, a home directory for the master on the slave machine. For a Windows slave, use something like: "C:\Jenkins\"
Set a label so that you can use that label to run jobs on the slave machine.
Select the appropriate Usage setting.
Launch Method: An easy way to control a Windows slave is by using Launch slave agents via Java Web Start (Recommended for Windows).
Availability --> Keep this slave online as much as possible
Press OK.
Now you need to connect your slave machine to the master using the following steps.
Open a browser on the slave machine and go to the Jenkins master server url (http: //your jenkins master:8080/).
Go to Manage Jenkins > Manage Nodes, Click on the newly created slave machine. You will need to login as someone that has the "Connect" Slave permission if you have configured global security.
Click on the Launch button to launch agent from browser on slave.
Run the program.
Now you should see the Slave machine connected under Nodes.
If you want the service to run on start-up of the slave machine do the following (Windows only directions):
In the Slave agent program running on your slave machine, click File --> Install as Windows Service.
Start, type Services and Select the Services program.
Find Jenkins Slave in the list, Double click to open.
Select Startup type --> Automatic.
Go to the Log On tab, change the Log on as to a user of your choice (Special user account Jenkins recommended).
Make sure that auto login is set for the slave machine for the user account, then the VM (or physical computer) should connect and be available when needed.
Creating Load Runner job in Jenkins:
Create a new freestyle project in Jenkins.
Check the "Restrict where this project can be run" checkbox and choose the Label Expression what you have provided for Slave Jenkins.
Under Add build step select Execute HP tests from file system and inside the Tests textarea provide the path of the folder of cloud machine which is having your Load Runner Scenario *.lrs scripts .
Click on build, Jenkins will trigger the Jenkins slave instance in cloud machine which will in turn invoke the Load Runner Controller and run the controller scripts(*.lrs).
Integrating HP QTP Scripts:
Steps for integrating HP QTP Scripts are exactly same as for HP Load Runner, the only difference is :
HP Unified Functional Testing should be installed in the same machine where you are going to configure Jenkins as a slave instance.
Under Add build step select Execute HP tests from file system and inside the Tests textarea provide the path of the folder of CTC machine which is having your HP QTP scripts .
Running Windows Server 2012 R2 Datacenter in a VM & want it set up as a jenkins node to run HP ALM test sets. In step 6, setting jenkins slave to run as a service, I received 'access denied' from jenkins slave agent process. Open a cmd prompt as admin user, cd to the jenkins slave install directory and enter
jenkins-slave.exe install
to fix this. Next, run services, locate the jenkins slave service. Should say 'Automatic', so 'start' it up and trial run your jenkins job. Check by rebooting the new jenkins slave platform and checking the service comes back as 'Automatic'.

Jenkins build slave appears offline but slave service is up and Running

I am having trouble that Jenkins home page shows the Build slave is offline. But when I actually log in to build slave server, the slave service is up and running.
I am using Windows 2003 OS for all my Build slaves and Master server. The only way to get it online is to restart the service again.
Follow the given steps, you will not required to restart the services.
Goto Jenkins -> Manage Jenkins -> Manage Nodes
This will show you the list configured nodes.
In which
Build Slave -> Launch Slave Agent (Where "Build Slave" is your slave node.)
This will work if your slave is configured properly and connected with the services.
Jenkins master need communicate with Slave with ssh connection if master and slave are not in the same node.
Double check if master's ssh public key is in slave's ~/.ssh/authorized_keys.

Jenkins Master/Slave configuration

I've been reading about Jenkins master/slave configurations but I still have some questions:
Is it so that the slave Jenkins is not actually installed and started up the way master Jenkins is? I assumed I would install one master Jenkins and another slave Jenkins in the same way, and then master Jenkins would control the slave e.g. through SSH? So I cannot view the slave Jenkins through a GUI?
The reason why I have thought about adding a slave Jenkins on another VM is because the VM contains our application servers (many test environments). Deploying and starting/stopping application servers from master Jenkins is a pain because master Jenkins and application servers are on different machines. Therefore, if I would add a slave Jenkins to the machine where our application servers are, these would actually be deployed and started/stopped locally (by slave Jenkins). I wonder if I have missed something, of if my presumptions are still valid.
In a standard Jenkins master/slave setup, Jenkins is only installed on the master. That is where you see the user interface and start/configure build jobs.
The slaves execute the jobs. There is no Jenkins installation here other than a small Java app to have Jenkins communicate to/from the slave. Jenkins talks to these slaves through the slave.jar app over e.g. SSH via the SSH Slaves Plugin and can monitor if the slave is running, etc.
So in your case, you can start jobs from the master that will execute on the application servers.
The master/slave setup also allows you to host all whole bunch of different slaves, with different OSes, different hardware, etc. You can communicate job results (artifacts) from one slave to another via the Copy Artifacts Plugin.
There are also ways to duplicate the actual Jenkins master with load balancing in a heavy use scenario. That is not what you seem to be looking for.

Resources