Blog

Articles in category Automation

Setting execution permission from git

2020-01-31 · Automation DevOps Git Linux · Thomas Sundberg

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

Read more →

Jenkins configuration as code

2019-12-23 · Automation Continuous integration DevOps · Thomas Sundberg

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:

  • Jenkins
  • Docker
  • Java
  • Maven
  • Git

A working example is available at GitHub.

Read more →

Two Jenkins jobs - one Jenkinsfile

2019-11-26 · Automation Continuous integration DevOps · Thomas Sundberg

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:

  • integration-tests-dev
  • integration-tests-sys

Read more →

Zero-downtime deployment with HAProxy as load balancer

2017-03-29 · Automation Continuous deployment Linux Tools · Thomas Sundberg

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.

Read more →

Why should you care about quality?

2016-09-01 · Automation Quality Technical debt Test automation · Thomas Sundberg

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.

Read more →

Continuous deployment - a case study

2015-12-23 · Automation Continuous deployment Gradle · Thomas Sundberg

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.

Read more →

RPM Cheat sheet

2015-09-10 · Automation Linux · Thomas Sundberg

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.

Read more →

YUM Cheat sheet

2015-09-10 · Automation Linux · Thomas Sundberg

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.

Read more →

When is it automated?

2015-02-28 · Automation · Thomas Sundberg

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.

Read more →

Which artifacts do you want when you build a system?

2015-02-16 · Automation Continuous integration · Thomas Sundberg

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?

Read more →

Making life easier with a multi module Maven project

2014-09-20 · Automation Java Maven · Thomas Sundberg

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.

Read more →

Use Maven build directory in your plugin

2014-05-21 · Automation Maven · Thomas Sundberg

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.

Read more →

Scripting with Ruby and Maven

2014-02-28 · Automation Maven · Thomas Sundberg

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.

Read more →

Missing ant-jsch.jar

2012-01-16 · Automation · Thomas Sundberg

The distribution of Ant 1.8.2 is broken on Mac.

Read more →

ssh from Ant

2012-01-16 · Automation · Thomas Sundberg

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"
    username="dude"
    password="yo"
    command="touch somefile"/>

Then you will get the error message below back.

Read more →

Testing a web application with Selenium 2

2011-10-18 · Automation Cucumber Maven Selenium Software development Test automation · Thomas Sundberg

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.

Read more →

Maven Java heap space

2011-10-14 · Automation Java Maven · Thomas Sundberg

I just had test in a Maven build fail with

java.lang.OutOfMemoryError: Java heap space

Read more →

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

2011-04-14 · Automation Software craftsmanship Software development · Thomas Sundberg

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

Read more →

Stating the obvious

2011-02-14 · Automation · Thomas Sundberg

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

Read more →