Post Deployment JVM log validation for JBOSS and WAS Application - jenkins

We use Jenkins and Urban Code Deploy to do our builds and deployments respectively. Post the deployment we manually go ahead and validate the JVM logs. Most of the Applications we deploy are JBOSS and WAS8.5. I wanted some suggestion on automating this post deployment validation task. Is there any tool, plugin that can be integrated with Urban Code Deploy to perform this log parsing against certain keywords.
I have "Log parser" plugin which is an open source plugin in Jenkins. Are there any better ideas?

In UrbanCode Deploy you can use the step called "Monitor File Contents" to check if a regular expression is contained in a file.
Another way would be to output the log file content in a shell step, like cat logfile, and then use a post-processing script to check if an expression is in the file. In this case, you can use JavaScript syntax. See

Related

How to get files produced during a Travis-CI build?

I am using Travis-CI to test code in a repository. There are quite some files after the testing and I would like to have them at a persistent place. How can I do that under the context of Travis-CI?
As an artificial example, suppose my Travis-CI server runs a C program that stores a large number of integers in a specific file. The file can be found at the Travis-CI server after the build. But how can I get that file? In my use case, this file is large and it would not make sense to read it from the console of Travis-CI; in other words, I would not consider using "cat ..." in .travis.yml.
After some search, here is what I got:
The most convenient way seems to deploy the generated files to GitHub pages. The process is explained here: https://docs.travis-ci.com/user/deployment/pages/. In short:
first, create a GitHub page from the repository under test. This can be done through the Github web of the repository. The outcome includes an additional remote branch called gh-=pages generated.
then, in .travis.yml, use the deploy section to specify the condition to do the deployment.

How to use a GitLab link for applying jenkins.yml file for the concept of Jenkins Configuration as Code

I have a local instance of Jenkins. I have previously tried storing the jenkins.yml in my system and giving its path on http://localhost:8080/configuration-as-code. This worked but I want to use a Gitlab repository to store the jenkins.yml file.
I have already tried giving the gitlab link of my jenkins.yml in the path or URL textbox. Some weird things happened, like
1. jenkins broke or huge error console
2. It reapplies the previous configuration(from system path)
jenkins:
systemMessage: "Hello, world"
Your problem as described: you want the job configuration to be saved in GIT and, when a build is triggered, the job should get the current stand of its configuration from there and then, run the build.
Maybe there is a kind of plug-in that does it for you, but I am not aware of any. Maybe anyone?
My suggestion is to define a pipeline job and use a declarative pipeline. It is a file, normally named Jenkinsfile that can be stored in GIT. In the Job, you define the GIT address and when you trigger a build, the file is got from GIT and executed.
There are several flaws in this: pipelines learning curve is not small, you are confronted with groovy (not XML!) and your current XML file is barelly useful.
Maybe someone shows up and tells us about new (for me) plugin that solves your problem using the configuration XML file. In the other hand, pipelines are such a beautyful feature that I encourage you to give it a try

let Tycho/Jenkins build fail when p2 site doesn't exist

I have an RCP application which I build in Jenkins using "mvn clean verify" to run Maven/Tycho. When the target platform of my application contains a p2 repository site that is not available anymore, Tycho prints a warning but still uses it's local cache.
[WARNING] Failed to access p2 repository http://download.eclipse.org/technology/babel/update-site/R0.11.1/indigo, use local cache. Neither http://download.eclipse.org/technology/babel/update-site/R0.11.1/indigo/content.jar nor http://download.eclipse.org/technology/babel/update-site/R0.11.1/indigo/content.xml found.
It took my quite some time to notice this problem because the Jenkins build succeeds without any issues and I am not going to read all console output...
I would like to get notified of this issue so I can take measures when a repository is moved or deleted. Tycho should still use it's cache under normal circumstances.
Can I solve this using Jenkins or can I instruct Tycho to fail fast (drawback: also fails on temporary outage)?
To partly answer my question the best solution is probably to set up a local p2 mirror, but I think this requires a lot more work.
You can mark a Jenkins build unstable or failed based on it's output by using the Jenkins Text finder plugin.
Manage Jenkins plugins and install the text finder plugin from the
Available plugins.
Edit the project to add a post-build action "Jenkins Text Finder".
Check 'Also search the console output', set the Regular expression to
'Failed to access p2 repository' and check 'Unstable if found'.

Jenkins on Windows using something other than ant

I am looking at using Jenkins on Windows.
I currently have an ant script. It works pretty well. Except for instance, when the build breaks because of a syntax error, I can not see the error in the Jenkins console log.
So I am thinking may be ant is not the best tool for use on Windows.
What do most of you use for Jenkins on Windows?
If it is ant, how do you send the build output, VStudio, to the Jenkins console?
Thanks
Primarily I use Jenkins with maven projects, although you should see the ANT output in the online logs regardless.
What are you building? Are you building Java projects? Ant is what you use. If you are bulding a C project, you should use Make. If you're building a VisualStudio project, you should use msbuild. You use the build tool for your project. Jenkins will execute them without a problem.
Take a look at the build in question. On the left side of the screen, there's a Console output item. Click on that. Is there any output. No matter what tool you use, Jenkins captures the STDOUT and STDERR in that console output. If nothing else, you should see the exact commands Jenkins is executing to checkout and to build your project. Try executing those commands.
Still, you didn't give us much to go on. No idea what you're building or what you're doing with Ant. You didn't state any error, the console output, or even what the Jenkins error log is stating.
Jenkins does two things:
It watches your repository for changes.
Once it detects the changes, it executes the very commands you'd execute to build the project.
Jenkins doesn't care whether you use Ant, Maven, Make, or simply do a del /s/q. Jenkins will simply execute the commands you tell it to execute.
Addendum
It is c, c++, Java and InstallShield. I use ant to do file copy and move, call msdev.exe project. Some Javac calls, InstallShield command line builds..
Jenkins can execute multiple step builds in a single job. After you specify the build step, you can press the Add button to add another build step. There's no reason that all the build steps even have to be of the same type. Just select a "Freestyle" build, and use the right build tools for the job.
There's an optional MSBUILD plugin in Jenkins that should do your MS Build. This should give you the complete output from MSBuild, so you can see any errors.
After you do your MSBuild step, you can create a second build step to run an Ant task to build your InstallShield. After that, you could run another build step to do the copying you need either on the command line or through something like Ant (or Nant.
Whatever the output of the various tools is the output you'll get in the build console.
dev.cmd shows the output and I continue to use ant.

Grails WAR file version

I would like to printout the grails war file version on my main page template, so when I deploy a WAR file, it become easy to recognize which version of the app is running on which server and so on.
Where to set it and how to print it out in a gsp tag?
There's a tag you can use as a short cut
<g:meta name="app.version"/>
You can set it using
grails set-version someVersionHere
I figured out how to display it but still don't know how to set it except by changing it in the application.properties
ApplicationName Version: ${grailsApplication.metadata['app.version']} Built by grailsApplication.metadata['app.grails.version']
I guess its the only way!!
To answer your question of SETTING the VERSION:
For example building with Jenkins or Hudson will automatically set the build number and CVS revision number to your war.
Using that sort of build tool + the Build Info plugin is a good way to achieve visibility to which version of your site you are running.
Of course setting up Jenkins takes some effort, but the it is a one-time cost and then you will just have button "Build Now" that will take care of it and you can optionally also configure deployment tasks to upload it automatically as well... but now I've drifted slightly off-topic.

Resources