OpenShift deployment with Jenkins fails - jenkins

I have an jenkins job that builds and deploys to a tomcat7 instance on OpenShift
Tomcat7 cartridge is copied from http://cartreflect-claytondev.rhcloud.com/github/worldline/openshift-cartridge-tomcat
....
....
Starting tomcat cartridge
Timed out waiting for http listening port
Error deploying to gear
The last command on the build is
gear remotedeploy --deployment-datetime $deployment_dir
So when this job runs, it always fails, however tailing the server logs shows deployment goes fine and application is deployed successfully. Seems to me the jenkins job waiting tomcat startup but never receives a signal. Therefore "Timed out waiting for http listening port" and job thinks deployment failed and so job fails.
Is there anything that I can do to fix this? May be inside build script? Or make remote deploy not to expect an signal?
Please advise, thanks.
Updating this ticket(10/13/2014);
I see a difference in the console output between this failing job and a successful job. below excerpt is always on the successful job (which is deploying to jbossews) and failing job (which is deploying to the aforementioned cartridge) doesn't have that part at all!
I thought this could be an important difference. See below console output;
+ hot_deploy_enabled_for_latest_deployment
++ ruby_sdk latest_deployment_metadata.hot_deploy
++ oo-ruby -I/usr/lib/openshift/cartridge_sdk -rruby/sdk -e 'include OpenShift::CartridgeSdk; puts latest_deployment_metadata.hot_deploy'
+ enabled=
+ '[' '' == true ']'
+ return 1

It would probably be worth logging an issue with the person who built the cartridge here https://github.com/worldline/openshift-cartridge-tomcat, or you could try using one of the standard jbossews (which is tomcat) cartridges that openshift offers. Seems that all they did for this cartridge was rename everything that said "jbossews" to "tomcat". OpenShift offers tomcat 6, tomcat7, jboss as 7, jboss eap, and wildfly cartridges, I am sure one of those would work equally as well, and work correctly with jenkins also.

You could try the worldline-openshift-origin-release-4, it may fix your issue : http://cartreflect-claytondev.rhcloud.com/github/worldline/openshift-cartridge-tomcat?commit=worldline-openshift-origin-release-4

Related

How to keep jenkins agent online after I restart my remote desktop

I am new to Jenkins and currently I have to test machine Test1 and Test2 on the test machines , I run ranorex automation tests , every thing works fine until i start getting the issue and that is when I restart my remote desktop(Test1 machine) and remote desktop(Test2 machine) both machine does not comes online on jenkins dashboard and appears as offline , then when I manually start both machine then on dashboard they both came online and my test execution works , previously i tried to use jenkins as service which some how block my automation test execution and error comes "The system needs to be interactive" , so I disabled jenkins service for Windows Service which solves my "The system needs to be interactive" error but I landed with this issue , whenever I perform restart my both test machines went offline
Any help in this regards
Thanks
You can use a schedule task with the 'On Startup' trigger, this is how I'm doing it and it works well.

Can no longer deploy Grails 2.2.5 app on Tomcat

I have run into a very serious problem where I can longer deploy a war of a Grails 2.2.5 web application on Tomcat. The build (with 'grails war') proceeds without a problem, and I deploy it to Tomcat. I retsart Tomcat, and the web application simply does not run. It comes up with the deploying message, but clearly doesn't get as far as running Bootstrap.groovy, because logging from there doesn't show up in the log. No error messages are given, but the web app is simply not running.
I ran into a similar problem a few days ago on a different server which I solved by upgrading to Tomcat 7, but this one is already running Tomcat 7. I have no idea why this has started happening, unless it is something obscure to do with the recent change in Maven where only TLS 1.2 connections are allowed (a change which occurred a week or so ago).
So what could be happening? Is there some way I can log what is happening as the web app starts up, such that I might be able to see where the problem is occurring?
If it is of any relevance, it works OK when I do 'grails run-war' on my development machine.

Unable to listen on port 33848 when running Jenkins tests

I am using jenkins-test-harness to run some tests on my jenkins library code, but when it executes the tests I get the following error for each test :
hudson.UDPBroadcastThread#run: Cannot listen to UDP port 33,848, skipping: java.net.SocketException: Can't assign requested address
The test will pass (if it should pass), but it then takes about 75 seconds for the jenkins server to shut down. I believe that these two are related, but I can't work out why I am getting this error. I have nothing else running on this port.
When I run the tests within a gradle docker container, rather than locally on the command line or inside the IDE (IntelliJ). This is very frustrating. While it does not change the result of the tests, it takes the running from about 10 minutes to over 1 hour and 15 minutes.
Am I missing a setting which is making this fail?
For me this was caused by Jenkins assuming that the default IP address it would be provided with would be IPv4 when in fact my machine was dual stack, preferring IPv6. I resolved it by ensuring that the integrationTest section of my build.gradle file had systemProperties 'java.net.preferIPv4Stack' : true. A bit like this:
integrationTest: {
/* other statements */
systemProperties 'java.net.preferIPv4Stack' : true
}
I must confess I saw no significant difference to my Jenkins shutdown time. I'd be interested to know if this resolves the error message, and if that resolves your overall issue.

Websphere call back to Jenkins

I am using Jenkins to do a deployment to WebSphere. What I want is in the "Console Output ". To show a feedback from WebSphere if the deployment has failed or has been successful in a line. Can someone point me in a direction? How can I get a callback from WebSphere back to Jenkins saying the deployment has failed.
Is there a plugin or an API I can use or a script I can write.
I have tried to look for plugin in but I cannot find anything.
You can use a simple script ant/bat/sh etc. to get server state. I do believe there is the script for that severStatus.sh. If service is running it will return STARTED state.
Also you can jython script command AdminControl.getAttribute(server, "state" ).
Just read/set the state in you jenkins job and analyze a result.
See also the following link: Checking the status of application server
For app deployment, the AdminApp.install returns error messages upon failure. Upon success, you can you use the AdminApp.getDeployStatus to get progress details. Use AdminApp.isAppReady to know when the app is fully deployed and ready to be started.
Documentation is here: https://www-01.ibm.com/support/knowledgecenter/SSEQTP_8.5.5/com.ibm.websphere.nd.doc/ae/txml_callappinstall.html

jenkins job to check if port 80 responds to a http request

I am new to jenkins.I need to create a jenkins job to check if port 80 responds to a http request with 200 and restart apache if it is not.Please advise.
You need Conditional Build Step and HTTP Request plugins.
Enable build step as condition in global configuration.
Setup a job with Conditional build step executing HTTP Request plugin, and on failure restart apache.
Restarting apache can be done through Publish over SSH plugin, or through Execute shell buildstep, if you are on Linux. If you are on Windows, you will need Execute batch command buildstep, and then use plink.exe that comes with Putty to connect to your apache server. This is all providing that your apache server is running on Linux in the first place.
If your apache is on Windows, that's a whole different can of worms.
You are not providing any information in your question, and as it is, it is too broad and shows zero research on your part.

Resources