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.
Related
I have the following setup:
Microsoft TFS with jobs and pipelines
A VM under Virtual Machine Manager (VMM) which has Windows10
The job from TFS can connect to VM to run commands remotely
My goal is to automate test case when there is no network connection inside the VM (mainly no internet connection) to verify that some features of my software under test behave as expected and do not use network to achieve my test calls.
Currently I use powershell on target machine to run scripts remotely in the VM https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/deploy/powershell-on-target-machines?view=azure-devops .
I made research online already but I didn't find something specific to TFS and VMM.
Perhaps it is worth it to mention that I found this script online:
#!/bin/sh
ip link set ens32 down
sleep 20
ip link set ens32 up
But the script was written in a Linux and SSH connection context, which isn't the same as my environment.
Is there anyway to achieve automation of networking disconnection remotely and then turning on again the network connection state ? (simulation tools are also ok for me if they do achieve my goal and can be integrated in TFS pipeline or VM tools installation).
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.
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.
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.
I have a test program in Java for testing a web app using webdriver. It builds and runs in my local machine just fine.
Now, I need to build it in jenkins, then deploy and run it on a VM running on Windows (e.g. server 2008 R2).
Obviously, the test program doesn't work on jenkins as it needs to open a browser. This cannot be done under system account in Jenkins server. So I need to deploy it to a remote machine and somehow start the test.
I've heard this can be done using ssh for a linux box, but don't know how to do it for a windows VM.
Any idea?
If you have installed jenkins as service then you need to create a JNLP node in order to run your webdriver tests.
Follow the post for creating JNLP node and running your tests on that.
http://qtp-help.blogspot.in/2013/09/setup-webdriver-maven-project-on-jenkins.html