Laur IVAN

How to Develop Pipelines – Some Best Practices

Posted by in IT, Software

These days I’m developing a bunch of pipelines to automatise the build/deployment process. Here are some things I’ve learned: How to develop Initially, I’ve started developing the pipeline as any other program: Create a repository, fire my editor, write a Jenkinsfile and use the Pipeline script from SCM. While the result is exactly what you want to have at the end, the edit-deploy-run cycle becomes a chore and it’s quite unpleasant at the beginning (I had a bunch of typos for example), so DON’T. Instead, create a simple pipeline with…read more

Sending HTTP requests with Jenkins Pipelines

Posted by in Uncategorized

As part of the CI/CD process, we might need to communicate with some external services’ APIs (e.g. notifying elastic search of a new index alias). I found an easy way to do it: Using a jenkins plugin. Jenkins plugin Jenkins has a HTTP request plugin. If you install it (or have it installed), you have the ability to send HTTP requests to external servers from Jenkins. Fortunately, this plugin also plays wery well with pipelines. You can sent practically any (REST) command to a destination:

You can customisethe request…read more

An Initial CI/CD Pipeline

Posted by in IT

Release-based deployments are sort of nice in the sense that you plan, draw a line, prepare stuff and release one or more components at the same time. It however stalls feature deployments a lot (e.g. a nice feature can be implemented in say a day but the release is sheduled in a month). It also gives way to out-of-order releases to please the business. Agile (CI/CD) aims to alleviate some of these problems. Prerequisites As part of the transition process, one has to establish a stack. In my case, it’s…read more

Run Restricted Groovy API in Jenkins

Posted by in IT, Tutorial

The more recent versions of Jenkins have improved on security. Unfortunately, a side-effect is that scripts which were running before would fail now. An example is:

… which would list the projects defined in Jenkins. Fortunately, you can have access to theis API via the In-process Script Approval plugin (which is installed by default). If the script (pipeline) is versioned or executed in the sandbox, then you’ll need to approve method by method. If the script is not versioned, then you have the option to execute it outside the…read more

Fix Missing In-process Script Approval in Jenkins

Posted by in IT, Tutorial

Normally, when you have a script or a method to be approved, you should see the In-process Script Approval entry in your Jenkins’ configuration: Unfortunately, the In-process Script Approval entry in Jenkins’ configuration is not always shown, even though we have items to be approved. I found that installing the Permissive Script Security and briefly enabling it would solve the problem. On linux (Ubuntu), you need to edit /etc/default/jenkins and add

Then, you need to restart Jenkins for the security plugin to be disabled. I executed one of the…read more

Fix Jenkins Ignored Plugin “Check Now”

Posted by in IT, Tutorial

TL;DR: Check if a browser extension is blocking your request when you click Check Now While playing more with jenkins, I’ve encountered an error while requesting Check Now for plugin updates: it seemed that my request got ignored. I’ve tried different URLs (with and without HTTPS, stable or not) with the same result: my request seemed to be ignored. I’ve assumed first there’s a proxy error or some limitation on the server side. The logs however didn’t reveal anything. Then, I’ve checked the browser side and I’ve found that my…read more

Update Jenkins on Ubuntu

Posted by in IT, Tutorial

I’ve got an installation of Jenkins on a Ubuntu 14.04.5 LTS which I needed to update. In order to do so I did the following: Download the new version (2.107 at the moment of writing this post). In /home/user/backup/ execute:

Backup the old version (Jenkins war is installed in /usr/share/jenkins):

Overwrite the old jenkins.war:

Restart jenkins

Now, you’re all set and you can start updating the plugins. HTH, A little experiment: If you find this post and ad below useful, please check the ad out :-)

Fix Jenkins POM Freezer
“Wrong Relative POM” Error

Posted by in IT, Tutorial

If you get a build error in Jenkins like:

Then you have a POM freezing issue with the parent POM. I.e., the Jenkins plugin has failed to freeze the POM version from a 1.0-SNAPSHOT to an actual 1.0-6034-79. A cause can be the plugin expects a certain sequence of tags in the POM and doesn’t find it. In my case, the initial configuration was:

and the expected configuration would be something like

Note the sequence group – artifactId – version. HTH, A little experiment: If you find…read more