Jenkins ssh from Linux server to a Windows node - jenkins

Linux is the operating system for my Jenkins server. How to configure a job to run a .bat script on a windows node? Is this even possible to go cross platform like that?

We have Ubuntu Jenkins server that runs jobs on Windows slave nodes. We had a Windows Jenkins server and we use the same jobs, without modification, running on the Ubuntu master. Maybe this or this link could be helpful.
We connect Windows nodes to the Ubuntu master the same way we connected them to the Windows master. For more info about connecting nodes see this article.

Related

How do I delay the VMware tools start?

My situation is as follows. I am using the vSphere Jenkins plugin to clone and start a VM on a vSphere server during a stage of a pipeline. I use SSH to connect to the VM from the Jenkins master and start the slave. VMware tools is installed on the machine so that the vSphere Jenkins plugin knows what IP to SSH to.
Now comes the problem: I need to change the IP address of each VM after startup. For that I am using a script that changes the IP of the machine, wrapped in a systemd oneshot service which loads the script on startup. The issue is that VMware tools sends the IP information back to the jenkins plugin before the systemd service gets loaded and then Jenkins tries to connect to an IP that has been changed.
How do I delay the start of VMware tools or how else could I overcome this issue?
I ended up adding this line in the [Unit] section of my .service file:
Before=vmware-tools.service
It does what I want it to.

Jenkins Master on Linux to trigger PowerShell script on windows slave

I have a Linux server where I have installed Jenkins and I have a windows slave server too. Just wanted to know is it possible to run powershell task from windows slave as we have Jenkins installed on Linux server? Or do I need to make a windows master to run all these powershell tasks?
This is possible. Make sure that you select the appropriate slave (using label expressions) to execute the job.

How to get a Jenkins slave to open a windows server session

I'm trying to get a Jenkins slave to open a session on a windows server.
Basically, What I'm try to achieve is:
Jenkins slave is running as a service on a windows 2003 server. When master calls slave, it will open a desktop session on the server and kick off an .exe that will perform GUI testing
What I have done:
Jenkins node created (Node A). Dumb slave. Remote FS root set to path on Windows 2003 server. ("C:\Jenkins\Node"). Launch method Java Web Start
Slave 'Node A' installed from Jenkins master using Java Web Start on windows 2003 server
Jenkins slave now running as a service on server
Jenkins project created and 'Restrict where this project can be run' is set to 'Node A'
Project windows batch command 'C:\GUITest.exe'
When I build the project in Jenkins I was expecting that the slave would be able to open a session and run C:\GUITest.exe. But, I'm missing something.
Anyone any ideas, or know if it is possible (plugins I may need ??)
Any advise / direction much appreciated.
Looks like you want to run GUI test on windows session. It won't work if you run Jenkins Slave as service, you have to run JNLP agent on your windows server. Also if you want to run in unattended mode, meaning that the windows remote session would be disconnected, you need some other setup as well. Please provide more information on what you are trying to do.
You must ensure that whatever process runs the GUI tests (might be a java / cmd / ssh process if you're connected to Jenkins) is not running on session 0 as it won't have access to Desktop and the Windows UI in general. I was in a similar situation and running the same process as a scheduled task instead of service solved it for me.

Can a Windows Jenkins Master have a Linux Jenkins Slave?

I have setup lots of Windows Masters with Windows Slaves.
I have instructions for setting up a Linux Master.
However, what I would really like to do is to setup a Linux (ubuntu) Slave on a Windows master.
The issue is that my Windows master doesn't have a SSH option for slaves, so none of the Linux Slave instructions seem to apply.
Any ideas if this is possible and if so, how to go about it?
Frank
There shouldn't be any major differences between running a master on different operating systems.
I thought the SSH Slaves plugin came installed by default, but if not, you can try installing it from the plugin centre.

Jenkins building on a remote machine

I can only build my system on a FreeBSD 5 machine.
I am looking and introducing gerrit and Jenkins into my team.
I have setup the server running gerrit and Jenkins both on a Debian machine for now.
What is the standard way of dealing with Jenkins building on a remote server?
The standard way would be to install a Jenkins Slave on the remote server. See https://wiki.jenkins-ci.org/display/JENKINS/Distributed+builds
You then setup the job that must be built on a FreeBSD 5 machine, to only only run on that slave/node. This is can be achieved within the job configuration by specifying the FreeBSD machine by name.
If you don't want other Jenkin jobs to run on that FreeBSD machine, you can configure the slave to only run jobs that are tied to it. See step 4 in the JENKINS Step by step guide to setup master and slave machines for the config page that you need to do this.

Resources