Akom's Tech Ruminations

Various tech outbursts - code and solutions to practical problems

DevOps Linux Linux

Docker: Automatically remove containers that have been running too long Why Because my Jenkins setup sometimes starts containers and forgets about them. Either it thinks it failed to start one, or the container itself has trouble starting. Either way, I'm left with containers that are running, trying to connect to Jenkins in vain, forever. The proper way to fix this is probably to have the containers timeout at some point, but that mechanism is broken.

Anyway, the fix I have is a true hack: find containers that have been up more than 2 days and kill them. None of our jobs should run for more than about a day, so this is a safe limit. Here is a bash script to do this: Continue reading "Docker: Automatically remove containers that have been running too long"

Automotive Automotive Hardware Hacks Hardware Hacks

Odometer Reprogramming - Nissan Sentra»
Disclaimer : It is perfectly legal to program an odometer to represent the correct mileage for the car. Problem: The car is a 2006 Nissan Sentra 1.8S . The instrument cluster is probably at fault for the intermittent overdrive flipping (on and off) that I've been experiencing. I ruled out the rest (switch, TCM). Thus, the cheapest option is to swap in another one , but that ...

DevOps Linux Linux

Jenkins command line ssh: Host key verification failed despite ssh-agent»
After hours of "Why does it work locally but not in Jenkins", this error boils down to StrictHostKeyChecking... In other words, since the job runs as a user on a random slave, and this user most likely doesn't have a known hosts file with an entry for the target system, this fails rather cryptically. You think that the user's keys don't work, but that's not the problem. The whole ...

Low Tech Hacks Low Tech Hacks

Replacing batteries in a Philips Norelco T980 Turbo Vacuum Trimmer»
I bought this trimmer in 2008 and the NiCd batteries finally died in 2016 - not bad. Still, no reason to trash a working trimmer and contribute to the landfill problem. As it turns out, it's fairly easy to disassemble, and even easier to reassemble. So here are the steps, which probably apply to many similar models.

Low Tech Hacks Low Tech Hacks

Replacing batteries in a Sonicare Elite toothbrush»
I've had this toothbrush for over a decade, and the batteries finally died. I suppose that's a long time for NiCd cells to last. For the last year or so the toothbrush would not complete the 2 minute cycle but would instead stop sometime earlier. The batteries are clearly still alive but simply don't have enough capacity. The toothbrush is not designed to be opened (it is ...

Linux Linux

Ubuntu 15.10: Handling Dell Latitude laptop dock events to reconfigure displays»
Couldn't find any good solutions out there. I have a Dell Latitutde E6410 running Ubuntu 15.10 with XFCE (no Gnome or KDE). I use a physical docking station that allows me to use two external monitors. Ubuntu doesn't seem to understand that if these external monitors vanish, it should switch to the monitor that remains (built-in LCD), and vice versa, so I have to automate it myself. ...

Code and Hacks Code and Hacks DevOps

Marking Jenkins build UNSTABLE from environment inject groovy script»
The way we use the Jenkins "Prepare an environment for the run" feature of the Environment Inject Plugin is this: we use the "Evaluated Groovy Script" to retrieve some info from a successful run of some other job (svn revisions, environment vars, whatever) in order to make it available to the environment of the current build. But what if that other job hasn't run successfully (yet)? I'd ...

DevOps Linux Linux

Migrating Maven Jenkins jobs to FreeStyleJobs due to JDK 1.6 incompatibility»
Soon after Jenkins 1.609.1 support for JDK 1.6 was dropped altogether. This means that you can run jobs with whatever JDK you want as long as you are not using the Maven job type . Maven jobs require JDK 1.7 or higher (actually they run on whatever version the master is using, ignoring the JDK setting in the job configuration). This is a big deal for a shop that does extensive ...

DevOps Java Java Linux Linux

Jenkins: Bulk editing jobs to remove a trigger»
I have about 200 jobs that have the HudsonStartupTrigger (this is a plugin) turned on. This makes all of them run every time the master is restarted, causing the build queue to go crazy. I don't know why people turned this on in so many jobs (probably blindly copying jobs) over the years, but I'd like it gone. I don't want to restart the master or uninstall the plugin. Here is a ...

DevOps Linux Linux

Suse11 cannot mount NFS share»
This is a recent issue on Suse 11.3. I have hundreds of machines mounting the same share fine - Centos, RedHat, even AIX. mount -v /mountpoint mount.nfs: timeout set for Wed Dec 9 11:09:27 2015 mount.nfs: trying text-based options ...


Puppet: recursively delete a Windows Registry key»
Puppet forge has a registry provider that allows one to manage a key or value. What it cannot do is delete a whole tree starting at a particular key. So, hacks to the rescue:   # deletes the whole tree if it exists   define registry_wipe_tree ( $key = $title ) {     exec { "Purge registry $key" :       ...

DevOps Linux Linux

Jenkins Swarm Slaves on Windows using Puppet»
Jenkins Swarm plugin is great, and instrumentation for Linux is fairly well-known, but what about Windows? Here is one approach for setting it up as a windows sevice (what we want Puppet to do): Download Swarm jar Download winsw from Kohsuke Rename winsw to jenkins_swarm.exe Create jenkins_swarm.xml Run jenkins_swarm.exe install Start service Now for the details

DevOps Linux Linux

Jenkins Windows Slaves cannot install JDK»
Despite making the jenkins slave user a local administrator. The slave runs tools\hudson.model.JDK\JDK_1.7\jdk.exe (or 1.6), and fails (see the extended post body for the log). If you're seeing Error 1722.There is a problem with this Windows Installer package , then most likely you have another (newer?) version of this JDK installed system-wide. Uninstall from Control Panel, try again.