Monday, June 9, 2014

... I had Jenkins Build Steps Fail Just Because Grep Returned Nothing

All I wanted to do was check if a docker container was running and if it was, stop it.

Simples.

Apparently not :(

Every time the Shell Execution Step with the following code ran, it marked the job as failed, if the docker container wasn't running.

docker ps|grep appserver || true
if [ $? -eq 0 ]; then #appserver container is running - stop it
 docker stop appserver
fi
What isn't immediately obvious with Jenkins' Execute Shell build step is that it is run with -xe arguments.

The -e causes the step to fail for any part of the script that has a return status that isn't 0.

To override the the default behavior, one must add a shebang to the step's code as follows:

#!/bin/sh
docker ps|grep appserver || true
if [ $? -eq 0 ]; then #appserver container is running - stop it
 docker stop appserver
fi
Very annoying, but easily fixed.

Saturday, January 18, 2014

... I hit a wall when trying to use right click to paste with putty into a tmux window

Not an issue I'd ever thought I'd come up against, but not being able to paste from my browser into a tmux window is quite the show stopper.

Googled for a while and found all sorts of scripts to aid me in my quest to get a line of text from the browser into a file I'd opened in vim running inside tmux.

Along came this post and the damn SHIFT key.

Hold shift while right clicking to paste into a tmux window.
The joy!