Running Jenkins Jobs on Windows Virtual Machine - testing

Im trying to setup Jenkins to run tests on a Virtual Machine but im not to sure how to proceed.
What id like to be able to do is to get Jenkins to build the environment on the vm and then have Jenkins execute the test scripts on the vm environment. After the tests have passed/failed id then like Jenkins to clean the database and pull down the virtual environment.
Server box - Windows 7
Virtaul Machine - VMWare
So what im looking for is some information or tutorials on how to implement the above. It would also be helpful if you could recommend what Jenkins plugins I can use to implement the above or if you want to go above and beyond can you outline the steps needed to achieve the above.
Any help would be appreciated.

I'm doing just that in my environment using the vSphere Cloud Plugin. Here's a basic step-by-step guide:
Install the plugin
Configure your ESX/ESXi server as a new "vSphere Cloud"
Create a new Jenkins node, of type "Slave virtual computer running under vSphere Cloud" (which becomes available after Installing the plugin).
When configuring the new node, optionally specify a snapshot name. This will revert the VM to this snapshot when the node launches.
Use the node in a pipeline script: node("node-name-or-label") { ...your code here... }
I use the method above with about 10 Windows nodes, reverting each to a "Clean" snapshot to start each build with a known state.

Related

Jenkins Multi-Job to shring build/workspace across all nodes

I have created a multi-job with few Sub-Jobs (which run my each test suite), in the main job i am cloning my repo from git and store it jenkins/workspace in a linux machine. all my sub jobs run in windows nodes. is there any way to share or access my linux machines jenkins/workspace with other jobs running on windows node. Please suggest if there is any other way to acheive it.

Automatically install programs to vm

I've got a question about VMs and installing programs.
I've got a vsphere 6.0 running on my server and I try to automatically create new VMs (or use clean installed snapshots) an then automatically install software on these VMs.
e.g.:
A user wishes to create a new Windows 7 with xampp installed and firefox + thunderbird + eclipse. The VM will be created and during the first start these programs will be installed.
Is this possible or are there any tools that can help?
Or can I use the VMware API to realize this?
Thank you very much.
There is no way that Vsphere can do these installations that I know of. In fact I don't know of a way to install an application to a running windows box remotely - you can imagine the security implications of that.
There is an easy way to do this however.
I would build my windows VM, install all the required applications (leaving them as configured or not depending on your needs) then convert the VM into a template and then deploy new vms based on that template. Then you have your windows vms ready to go with the installed applications.

Vagrant box or any VMs to simulates Open Build System environments

Is there a vagrant box or any other kind of VMs that simulates Open Build System environments?
I'd like to make sure my package works fine locally before sending it to the building system. The problem is many times my local environments have more stuff installed or different version from the building environment.
I think that having a local VM to simulate the environments would be ideal but I couldn't find it.
Disclaimer: I don't use OBS nor have I tried this myself.
OBS has an appliance that likely can be run in vagrant/vbox here:
https://en.opensuse.org/openSUSE:Build_Service_Appliance

Selenium Grid 2 - Start Node as a windows service

I am trying to run tests with on a remote m/c using grid 2. So I have a Hub running on my computer and a Node running on a Remote m/c and I can run my tests without any issues. However, to smoothen the experience I want to run the hub and the node as a windows service. This way i can manage the hub and node in the code. So I installed the Hub as a service on the server and Node as a service on the Remote m/c using srvany as shown below
C:\Program Files\Resource Kit\Instsrv.exe RunHub C:\Program Files\Resource Kit\Srvany.exe
C:\Program Files\Resource Kit\Instsrv.exe RunNode C:\Program Files\Resource Kit\Srvany.exe (where RunHub and RunNode are batch files)
I also made the necessary changes in the registry.
The issue I'm facing is that when I run the node as a windows service in the remote m/c, it is not registering itself correctly to the hub. When I look at the grid overview(http://localhost:4444/grid/console) i do not see the node there. However, if I run the same bat file manually and not as a service everything works fine. Can someone please let me know what I'm doing wrong? Or what's the best way to troubleshoot this?
thanks,
Ok I figured this out myself. There was a reference to a file in a different directory in the bat files. This file could not be accessed when running it as a service. I moved the file to the correct dir and now i can run the Node service

Possible to register Selenium RC's with the Hudson Selenium Grid Hub w/o the RC's being slaves in the Hudson cluster?

I am trying to get Hudson to run my ruby based selenium tests. I have installed the Selenium Grid plugin, but I don't want to have the RC's running as slaves in a Hudson cluster. The reason for this is I don't want to waste the next six years of my life trying to configure each of my projects in various Windows environments.
Hudson currently pulls each project from Github and builds it just fine. With a regular Selenium Grid setup, I am able to edit the grid_configuration.yml file to represent the various environments I wish to tests against, then pass environment variables to the rake task that runs the test i.e. which browser/platfom to run on and the URL of the application under test -- usually a port on the hub machine running in a specific environment.
In this way, the machines on which the RC's run don't need to know anything about the source code of my apps, they just need to have selenium-grid installed and have registered with the hub.
Is there a way of elegantly emulating this with Hudson?
do you have a concept of build agents, I do not know much about Hudson. We are using Anthill Pro at work and we have set up an Ahtill Pro agent. The source code is downloaded to the agent and the agent is responsible to run the maven goal for running the tests. It works pretty well for us as the RC machines are not part of the build environment. the tests are responsible to talk to Selenium HUB and get new sessions and do the testing.
I hope this helps.
Cheers
Haroon
I chose to not use the plugin in order to take advantage of the newer Grid version. I cloned a few VMs with a startup script that runs ant launch-remote-control from a shared drive that they can all access. Hudson doesn't have, and doesn't need any access to the Grid nodes and they aren't slaves to Hudson. I altered my Hudson server to launch the hub on machine startup. This setup allows me to run the grid normally with or without Hudson.