How to start an application on Windows after a Jenkins build - windows

I am want to start a (Spring Boot) application on a Windows server after it was built by Maven, which was started by Jenkins.
I am able to build in Jenkins using mvn spring-boot:run, which automatically starts the application, but this results in a Jenkins build process that never finishes. I want the application to start and to continue running while the Jenkins build finishes.
Also, when I need to stop and restart the application, I need to
stop/kill the Jenkins build process
look up the application's Java process that was started via the Windows Task Manager and kill that as well, since the application keeps running in a separate process.
There must be a better way to do that.

If you have Jenkins build pipeline, it is easy to build the application and run the application. You can follow this link to get an idea. Although this link is unix system, you can modify to do it for Windows.
https://vindytechblog.wordpress.com/2017/03/04/jenkins-configurations-to-build-and-deploy-wso2-carbon-application/
Also, you can mention the command in the last pipeline about what to do after building the application. Besides, you have to first stop already running the spring boot application instance.
You can also refer below the link about the pipeline script.
https://www.baeldung.com/jenkins-pipelines

Related

Migrate jenkins from service to standalone

Right now I'm running Jenkins as windows service. Most likely because of that I'm unable to spawn test application window. It's just appearing as a process in the background. I already tried Log-On option to allow service to interact with desktop, but that doesn't seem to change anything in this case.
I'd like to try running Jenkins through jenkins.war, however the first thing I've noticed is that it begins all the configuration prompting about plugins etc. Application is already configured and has all the builds in place.
Could someone explain if it's necessary to reconfigure everything or it just keeps all the settings in some different location when running as service? There's was no dedicated user, the service was operated just by local system account.
So the solution was fairly simple. The main problem was when Jenkins ran as a service entire configuration was saved in it's install directory so upon running jenkins.war configuration was set in current account user directory so it was like fresh installation.
The thing that helped was thin backup plugin. Ran the backup while service instance was running, then restored it for the new instance that allowed full plugin, configuration and builds restore. After that also passwords for source control had to be updated (restored ones didn't work probably because of per instance encryption key).

running process with gitlab ci

I have a gitlab runner installed on one of my test servers.
I want to build and deploy my app on every commit.
The server is a windows server and the app is a .net core 1.1 app.
my build script works fine but eventually it runs dotnet MyApp.dll which obviously makes the pipeline stop wait until it finishes (but, of course, my app won't finish, I want it to run..)
I tried running start dotnet MyApp.dll but that still doesn't work as gitlab's runner won't stop running until all of it's child processes exit.
I am certain I'm using gitlab's CI in a non idiomatic way but fail to understand how to deploy locally correctly.
Any suggestions?
Windows doesn't offer any easy way to disown a process and you probably don't want to task yourself with stopping the process on your next deploy. What you should do is use SRVANY.EXE to create service out of your application and then use the Gitlab CI to stop the service, replace the files and run it again. It's been a while since I used Windows so I'm sorry but I can't provide the exact commands to run.

Running load tests via Jenkins on a slave EC2 instance that starts and stops with the build

Ideally, we'd like to run load tests on an EC2 Jenkins slave that starts and stops with our build.
Are there any tools out there (without writing our own plugins) that currently solve this?
I've come across this, but it seems to only be triggered based on the load of Jenkins in general, and not tied to a build.
This configuration is environment specific, and not project specific, so I would prefer to keep this maintained within Jenkins instead of within Maven and the project itself. Although, I'm open to suggestions in that realm.
You can check out WebLOAD Jenkins plugin, it executes RadView's WebLOAD load testing tool, triggered by Jenkins. WebLOAD itself can launch EC2 cloud machines as needed, if that's what you need.

Where to observe application deployed by Jenkins?

Question from a first-time Jenkins user. So I hope you wouldn't mind if the question is too silly.
I have installed jenkins on a Ubuntu machine, and is accessible at localhost:8080. I have successfully configured it to work with Maven2 and Git as well. Next, I created a job/project (A Java/Spring application), and got it to build without error on Jenkins as well.
Now my question is, where do I see this application running? :)
Best Regards
James
To deploy : http://mojo.codehaus.org/tomcat-maven-plugin/plugin-info.html to do it with maven or https://wiki.jenkins-ci.org/display/JENKINS/Deploy+Plugin to do it with jenkins
You can see the console output in the running job if you click the running job and look for the link on the left hand side.
Building and deploying are two different things. Jenkins can do the latter for you too but you need to have it configured in your maven project. Typically this is accomplished (for tomcat) using the tomcat maven plugin

Configuring Rational Functional Tester (RFT) to run in Hudson/Jenkins

I've just installed Hudson and it is running beautifully. It builds, runs JUnit-tests and also CheckStyle analysis.
Next step for us would be to create an installation, install it and then run automated tests on the actual installation. I would then like to fail the build if the tests fail or at least publish the results somehow. I think we would set it up so that part runs periodically or manually triggered.
We use InstallAnywhere for installation and IBM Rational Functional Tester for automated tests.
So questions are: anyone created a similar setup? are there any plugins, tutorials or other resource that could help me along. Or do you have any tips or advice in general.
The command line reference for Rational Functional Tester:
http://publib.boulder.ibm.com/infocenter/rfthelp/v8r0m0/index.jsp?topic=/com.ibm.rational.test.ft.doc/topics/RobotJCommandLine.html
Sample command for running a test:
java -classpath "C:\IBM\RFT\FunctionalTester\bin\rational_ft.jar"
com.rational.test.ft.rational_ft -datastore \\My_project\AUser\RobotJProjects -user admin -project
\\My_project\AUser\TestManagerProjects\Test.rsp -build "Build 1" -logfolder "Default" -log
"Al_SimpleClassicsA#1" -rt.log_format "TestManager" -rt.bring_up_logviewer true -playback
basetests.SimpleClassicsA_01
An additional note, you'll want to configure windows properly on your agent machine which will be running the tests. This is not advice specific to Hudson or RFT, but rather all GUI automation tools on Windows. RFT will require an interactive desktop environment for it to be able to click buttons, etc. If you have your Hudson agent running as a Windows service, there will be no desktop. See the following: Silverlight tests not working unless RDP connection open
We have run a fairly complicated distributed build on Hudson, it is a process that basically follows:
Test on Windows.
Test on OSX, run code coverage & push results to server.
Test on OSX Tiger.
Package for OSX Leopard & push build to server.
Package for Windows & push build to server.
Update product website.
We don't use InstallAnywhere or Rational Functional Tester, but have similar sorts of mechanisms in their place. The key we found to making it all sing in Hudson was being able run our various steps from the command line. Maven and appropriate plugins made short work of this task. So my advice would be just that, using whatever build tool you are using (ant, maven, ?) configure them so that you can run your rational functional tester and install anywhere from the command line with a simple goal passed to your build tool (i.e. mvn test or mvn assembly:assembly).
After that, make sure whatever machine Hudson is running on has everything installed (i.e. Rational Functional Tester) and configured, so that you can open up the command line and type in the goal and have your tests correctly execute.
Hooking it up in Hudson from that point on is fairly simple - just pass in the goal when you configure the build.
I believe the best answer is that integrating RFT with Hudson/Jenkins is a useless endeavor.
As this IBM FAQ says, to make RFT work you must:
be logged in the machine;
the screen can't be locked;
if you are remotely connected, you can't minimize the connection screen.
So you can't run Jenkins/Hudson as a service, making it not very useful. You must run it from your logged account. If you are in a corporate computer (very probable if you are using RFT), you probably must use a hack to prevent the screen saver to start. If the screen is locked, your tests will always fails.
It isn't very difficult to configure your tests to run from the command line, you just have to take care of the return codes when the tests fail and succeed.
Jenkins/Hudson would also give you some advantages, like integrating the tests with your version control, probably automatically running the tests when a commit is made. It would also help sending emails when the tests fail.
But you still would have to integrate the RFT logs with some kind of JUnit plugin to have a nice report. You also would have to have script to run the tests using the command line.
I think it is not worth the trouble to use an continuous integration server with RFT. Better just have your tests running every day in Windows Task Scheduler. It is a simpler solution with less failure points.
Or use my final solution: quit RFT and use the free Selenium with a headless web driver.
I have some general advice on this because I have not yet implemented this myself.
I am assuming you want to have Hudson run the RFT scripts automatically for you via a build or Hudson process?
I want to implement something similar in my organisation as well.
I have not yet been able to implement this because of organisational constraints but here is what I have thought out/done so far:
Downloaded Windows process viewer, got the command for running the tests.
Made shell Script out of it, separated out the variables etc
The future plan is to setup a Windows Slave machine which would have all the tools in it that would be required once the Tests are kicked off, for eg. the correct versions of browsers, and environment variables, and other tools that are required.
Hudson would kick off a process which runs the shell scripts created which runs all the RFT Scripts and performs necessary operations on the slave machine.

Resources