Unable to schedule job in VM using Jenkins - jenkins

I am scheduling QTP scripts using Jenkins, intended to run on weekends. The QTP scripts are in the same Jenkins machines.
The build is not triggered at the scheduled time instead it triggers only when I login to the VM as it seems so.
Configuration:
OS : Windows 7 Ultimate
Jenkins version: 1.620 (master only)
When I do build manually, it works. Only the scheduling is not working.

If you are running Jenkins Slave as a service, you have to make sure that it runs as administrator in services.msc in the Log On tab. Make sure to restart the service after you add the Admin Account.
Cheers!

Related

Jenkins skip some jobs in chain of freestyle jobs

We got a requirement to implement CICD using Jenkins.
Here, Jenkins is running in windows machine and application server running in linux machine and build activity should happen in Linux system. So, We are connecting to linux machine using Jenkins's SSH plugin and executing jobs.
I have created list of freestyle jobs to checkout code from CVS, cleanup activity, Build , stop server, start server, Run Junit, run sonar. all these jobs are chained using 'build other projects' option in post build Action section.
Here, all jobs executes in sequential manner. But, sometimes I need to execute only few jobs like stop and start server.
So, please help me how we can randomly pick jobs which need to be run before triggering build.
Thanks,
Ganesha

Jenkins as Service Keeps Losing Elevated Privileges

We recently tried moving our Windows Jenkins slaves to run as a service instead of just running the slave agent jnlp file.
According to the Mercurial Plugin (https://wiki.jenkins-ci.org/display/JENKINS/Mercurial+Plugin),
The default installation runs windows service with "local system" account, which does not seem to have enough priveleges for hg to execute, so You could try running Jenkins service with the same account as TortoiseHG, which will allow it to complete.
This we did, and it worked. For a while.
But sometimes after there was a disconnect between the Jenkins slave and master, it would stop working. Jenkins would call mercurial and it would hang, just like it would do if the service was running with the "local system" account.
I could sometimes get it to start working again by restarting the Jenkins service on the slave. But somtimes I'd have to go back in and re-set the service to run with an elevated account.
Has anybody else experienced anything like this? Is there any way to keep the Jenkins Service running with elevated priveleges?

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'.

How to run jenkins job as a system user?

Rightnow, my jenkins jobs are run by Tomcat Server user.
I wanted it to run as User 'Admin', so i tried creating a slave and
added my same jenkins machine as the slave.
I have also added this as a windows service, and have confiured the
Admin user/pwd in the Logon Tab.
But still, when i run a job which executes the UI tests, i'm not able
to see them running in the firefox but it runs and the screenshots
are captured!
Are you asking how to have Jenkins spawn a process in your session that you can see at the monitor?
Have a look here: Open Excel on Jenkins CI, replace excel with whatever you are launching.
If you use jenkins as windows service, it won't allow GUI execution.
It only allows backgound running jobs.
If you want run UI test then stop your jenkins service , use some other way to connect your slave.

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.

Resources