Klaus

pipeline-examples

 Tue, 26 Sep 2017 17:27:08 +0200 
Nice collection of #Jenkins pipeline examples.

#^jenkinsci/pipeline-examples
Image/photo
pipeline-examples - A collection of examples, tips and tricks and snippets of scripting for the Jenkins Pipeline plugin
Klaus

Jenkins Shared Libraries

 Fri, 04 Aug 2017 18:53:36 +0200 
Should have used shared libraries much earlier.

#^Jenkins Shared Libraries Workshop
by Julien Pivotto on SlideShare
Klaus

CI/CD

 Sun, 29 Jan 2017 02:12:59 +0100 
Since October last year I try to understand Travis CI and have over 70 builds already, but I still don't get it. I don't know if it is Travis CI (random failures, no DB socket available, etc.), PHPUnit, HHVM (extremely slow running unit tests). Just tired.

Last week I had to work with Jenkins' Pipelines for a work project. It also took me 2 full days and 60 replays to learn and understand, but it is really amazing! I have a complete workflow with building, testing, feedback to Gerrit, publishing of reports, ordinary artifacts archiving, deployment to QA, eMail notifications and manual approval to deploy to production. There are also some bugs, no question, especially I am missing Gerrit trigger for multi-branch Pipelines, so I can test pull requests already, but it makes so much more fun to work with.
Klaus

Tear down docker test containers based on image name

 Thu, 01 Sep 2016 16:49:47 +0200 
Given your #CI generates #Docker images from your Git commits and tags them with something like web01-qa:$BUILD_NUMBER. Right now I can not set a name for the container that gets spun up after every commit, so I needed a solution to tear down the old containers after successful start of a new container based on the image they were created from. This is what I came up with:

docker ps --format "{{.ID}}\t{{.Image}}" | awk -F ':' '/web01-qa/{print $NF, $0}' | sort -r -n | tail -n+2 | awk '/web01-qa/{system("docker stop " $2)}'
Get all running containers, sort them by $BUILD_NUMBER for the image name containing web01-qa, stop all matching containers except the one from the newest image.

Or use docker rm -f if not interested in the old containers anymore.