Search This Blog

Having fun with the Jenkins DSL

Jenkins it's a outstanding deployment tool. I love Jenkins, i use for a very long time. I remember when was called Hudson. There are several things that made Jenkins one for the most used solutions for deploys. Jenkins has a awesome community with more than 1k plugins.

For this post i will cover a specific plugin called Jenkins Job DSL. This plugin gives you a Groovy DSL to code your Jobs, yes Code not XML. :-) This is good for lots of reasons. First of All in a DevOps context this allow you to automate the job creation which is tedious and manual. Moreover the DSL is great because it allow you to create a massive number of job, so in a microservices context lets say you have 50 microservices and all run in they own jetty and they code is on GitHub and build is done using maven. You can automate all that and create a JOB using the DSL this job will create the other jobs. Even if you have one job only for me it makes sense because you have it automated.

We will create a simple DSL and will invoke a bash script with download an builds Apache web server. The server version will be a build parameter so the user will pass this on the job when the build happens.

Groovy Job DSL for Jenkins

Bash Script to Build and Install Apache

Then you just need create a freestyle job and configure your favorite SCM provider. If you want just commit this 2 files into a GitHub account then point Jenkins there. And configure a DSL-JOB Step pointing to the groovy class: ReleaseApache.groovy and that's it. When you run this job, Jenkins will generate another job for you. :-)

Popular posts from this blog

I often don't blog about this kind of stuff. Yesterday I friend of mine showed me this awesome project called cool-retro-term.

When you work with Cloud Computing and DevOps Engineering you spend lots of time on the black screen testing things on the cloud. When I saw this project I got very excited because it brings some nostalgy back to my life. To be 100% clearI'm not that old as my friend :-) However I share his joy into this retro terminals. This also reminds me some old games like Fallout 1. I just this is pure fun so I'm sharing here with you guys some screenshots and also how to run on Gnome Ubuntu 17.04.

Terraform is a good tool for infrastructure provisioning. However to test terraform it could be pretty difficult. So you will create some terraform scripts and upload to the cloud a run some slow Jenkins job? and if your syntax is wrong? Well, this process can be very painful. So I want to share some simple sandbox I built in order to speed up terraform + aws development in your local machine. I might be wondering how is that possible─? Well, my secret sauce is Localstack. So we are limited to all endpoints that localstack mocks. As Localsttack adds more endpoints we benefit from that. The main idea behind this simple project is to show how easy is to docker-ize somDevOpsps tools and make engineering easy. Currently is very often to spend 40mim or more doing baking and that's is wrong. So that's kind of mainframe era so the idea is to save time and run things local - as much as possible. Docker helps a lot with that. I run software in production using AWS Amazon Linux. Now t…

Go is a simple, fast and powerful programing language. Go is growing a lot into the DevOps Engineering scene like Hashicorp Stack or even Kubernetes. One of the main advantages of GO is the fact that you can generate a single binary with all you needed, bundled in a single file. This makes distribution so much easier.

Go is also very compact for some use cases and you can write so less code and still very very efficient and get best of performance. Today we will see how to create a very, very, very simple service in go. This service will access redis to increment how many times it was called. We will use Minikube in order to run kubernetes locally and we will store our data in Redis.