Setting execution permission from git

Filed under: Automation, DevOps, Git, Linux, — Tags: Linux, Unix — Thomas Sundberg — 2020-01-31

The execution flag must be set on a file for it to be possible to be executed as a script on a Linux system.


Jenkins configuration as code

Filed under: Automation, Continuous integration, DevOps, — Tags: Jenkins, Jenkins Configuration as Code, jcasc — Thomas Sundberg — 2019-12-23

Configuring Jenkins is not as easy as one might imagine or want. There are some 1500 plugins available. Selecting the proper plugins and then configuring them is a daunting task.

Jenkins configuration as code doesn't solve the selection problem. But it does solve the problem of having a repeatable setup of Jenkins. The setup is version controlled and thus traceable.

Here is an example where I use this this tool chain:

A working example is available at GitHub.


Two Jenkins jobs - one Jenkinsfile

Filed under: Automation, Continuous integration, DevOps, — Tags: Jenkins, Jenkinsfile, pipeline — Thomas Sundberg — 2019-11-26

I have a situation where I want two jobs in Jenkins to have the same definition. They will run a set of tests against two different environments.

I want to name the jobs so it is obvious which environment they target. My naming schema looks like this: *-dev

The jobs will therefore be named as:


Zero-downtime deployment with HAProxy as load balancer

Filed under: Automation, Continuous deployment, Linux, Tools, — Tags: Gatlin, HAProxy — Thomas Sundberg — 2017-03-29

I want to deploy new versions of an application with no downtime. It turns out to be a bit tricky. Here is one solution that sort of works.


Why should you care about quality?

Filed under: Automation, Quality, Technical debt, Test automation, — Tags: Stress reduction — Thomas Sundberg — 2016-09-01

Brian McCallister tweeted "Current development speed is a function of past development quality."

It kind of summaries why I am passionate about code quality and taking the time early to do the right thing right.


Continuous deployment - a case study

Filed under: Automation, Continuous deployment, Gradle, — Tags: Gradle Plugin, Jenkins, Puppet, artifactory, continuous delivery, continuous deployment, rpm — Thomas Sundberg — 2015-12-23

Continuous deployment is considered, among some enlightened, to be the holy grail in many organisations where software is developed.

What is continuous deployment then? My interpretation is that every change is deployed into production. That is, every change that passes the quality gates the team has created.

A relaxed version is continuous delivery. Continuous delivery means that every change that passes the quality gates ends up as a release candidate. A release candidate that is possible to deploy into to production. The deployment will, however, be done later. If ever.

I will describe how I implemented continuous deployment for one product and continuous delivery for three others for a client.


RPM Cheat sheet

Filed under: Automation, Linux, — Tags: Centos, Cheat sheet, Linux RPM Package Manager, Red Hat Linux, rpm — Thomas Sundberg — 2015-09-10

It turns out that I always have to search for the syntax when working with RPMs. To simplify my own life, and possible yours, here is a list of some commands I find useful. Some of them should be executed as root.


YUM Cheat sheet

Filed under: Automation, Linux, — Tags: Centos, Red Hat Linux, YUM — Thomas Sundberg — 2015-09-10

Remembering the syntax for yum is something I seem to have problems with. To simplify my own life, and possible yours, here is a list of some commands I find useful. Some of them should be executed as root.


When is it automated?

Filed under: Automation, — Tags: Automated deployment, Automation vs Manual, Gall's law, KISS, Manual deployment, Puppet — Thomas Sundberg — 2015-02-28

I had a discussion about an automation task that I have implemented the other day.

The task is about automating the deployment of a web application on top of a JBoss. The application is old and we are not allowed to do any improvements at the moment. The instruction is, deploy it as it is at the moment. You will be allowed to do improvements later when you are able to deploy the application smothly.


Which artifacts do you want when you build a system?

Filed under: Automation, Continuous integration, — Tags: Gradle, Jenkins, Maven, TeamCity, deb, rpm — Thomas Sundberg — 2015-02-16

A Continuous Integration, CI, server builds a system every time a change has been detected in the version control system. This is a very common practice and something good. We are able to catch many silly mistakes early. The question is, what should the CI server build? Which artifact should the build produce?


Making life easier with a multi module Maven project

Filed under: Automation, Java, Maven, — Tags: Multi module, Slow tests — Thomas Sundberg — 2014-09-20

Working with slow modules in Maven is a problem. People will not build the module as often as they need and they will therefore not find problems as early as they could.

A solution could be to separate some of the slow stuff to a separate module. One separation can be to have a specific module for slow tests. This will, however, not solve the problem, that the module is too slow.

A solution to the problem could be to only include it in the execution when you invoke a specific Maven profile. This would separate the execution of a slow module from the execution of the rest, fast, modules.

Let me implement a simple example with two modules. There is the first module, the application, that we always want to build. It has fast unit tests and it is therefore not hindering to execute it often. Then there is the second module, the acceptance tests. It requires you to fire up your application before it can be executed. It is therefore dead slow. As a developer you will probably only want to execute the acceptance test module now and then.

Let me show you one way to achieve this.


Use Maven build directory in your plugin

Filed under: Automation, Maven, — Tags: ${}, POJO, mojo — Thomas Sundberg — 2014-05-21

How can you get the build directory in your maven plugin?

The answer to this question may seem simple, just refer to ./target in your plugin and everything should work. This works in the simple case. It does, however, not work when you are using you plugin in a multi module project. Your plugin will not know where it is executed and cannot refer to a subdirectory relative to the directory where Maven is invoked. It may be executed in a multi module build or a single module.


Scripting with Ruby and Maven

Filed under: Automation, Maven, — Tags: Ant, JRuby, Ruby, Scripting — Thomas Sundberg — 2014-02-28

In my assignment as a Configuration Manager, CM, I need to script a lot of things. I also need to automate the execution. Most of the stuff I build is built using Maven. Some is built using Ant. Both Maven and Ant are easy to run from TeamCity. But none of them are very flexible when it comes to scripting. Maven isn't designed for it and Ant is missing some features and get very verbose. The most important feature I am missing in Ant is repetition.

I saw a panel debate a while ago where three guys were discussing their favorite tools. The tools represented were Scala, Ruby and Groovy. One thing that I remembered from that session was that the Scala guy mentioned that he often used Ruby when scripting. My problem with using Ruby is that I don't have control over my execution environment. I can't install tools in it. I am not interested, either, because that wouldn't scale very well since the installation done on our build servers are done manually. I can, however, expect that Maven and Ant will work.

Given that I can expect Maven to work, I decided to try to execute a Ruby script from Maven. It turned out to work very well. I was able to reduce the size of an Ant script with 50% on my first attempt. In my opinion, the readability increased a lot. I was able to write the script more or less as prose.

If you are interested, this is how I did.


Missing ant-jsch.jar

Filed under: Automation, — Tags: Ant, jsch, ssh — Thomas Sundberg — 2012-01-16

The distribution of Ant 1.8.2 is broken on Mac.


ssh from Ant

Filed under: Automation, — Tags: Ant, jsch, ssh, sshexec — Thomas Sundberg — 2012-01-16

You have to patch Ant in order to run ssh from it. It needs a ssh implementation that isn't bundled with the default distribution. If you just define a task like this:

<sshexec host="somehost"
    command="touch somefile"/>

Then you will get the error message below back.


Testing a web application with Selenium 2

Filed under: Automation, Cucumber, Maven, Selenium, Software development, Test automation, — Tags: BDD, Behaviour Driven Development, Behaviour Driven Development - BDD, Cucumber, Cucumber-jvm, Executable specifications, Java, Page Object, Parameterized JUnit, WebDriver — Thomas Sundberg — 2011-10-18

Selenium a great tool for testing web applications. The current version, Selenium 2, is a merge between Selenium and WebDriver. I will walk you through an example where we test a web site using Selenium in a few different ways. This is the same example as I demonstrated at Scandev on tour in Stockholm 18 October 2011.


Maven Java heap space

Filed under: Automation, Java, Maven, — Tags: Java heap space, java.lang.OutOfMemoryError, maven-failsafe-plugin, maven-surefire-plugin — Thomas Sundberg — 2011-10-14

I just had test in a Maven build fail with

java.lang.OutOfMemoryError: Java heap space

Why should you use different technical practises when you develop software?

Filed under: Automation, Software craftsmanship, Software development, — Tags: Automated deployment, Automated testing, Automated un-deployment, Code review, Continuous integration, Feedback loop, Long feedback loops, Pair programming, Small releases, Test driven development — Thomas Sundberg — 2011-04-14

Why not hack away as usual and hope for the best?


Stating the obvious

Filed under: Automation, — Tags: Ant, Manual, scp — Thomas Sundberg — 2011-02-14

Today I got a call. Somebody couldn't get scp work from Ant.





Clean code
Continuous delivery
Continuous deployment
Continuous integration
Executable specification
Load testing
New developers
Pair programming
Public speaking
Software craftsmanship
Software development
Technical debt
Test automation
eXtreme Programming


Thomas Sundberg
Adrian Bolboaca



rss RSS