I have a problem. I keep constantly committing (and pushing) to wrong branches and then keep searching for how to move those commits to the right place. So I decided that bash prompt should remind me, what branch I am currently on. I need a scm tool name (because I use several) and a branch.
Yesterday I have released version 1.0.0 of my jenkins2 gem. It’s a API client and a command line application at the same time, that allows you to manage your Jenkins. And to be honest I am proud of the code I have pushed. Here is why:
Imagine you write a driver for Test Kitchen. It’s reasonable, if you want to check, if your driver is working before publishing it. But which approach to take? Building the gem and installing it locally, then manually trying to launch Test Kitchen with your driver, does not really feel the way to do it.
Having big Jenkins cluster requires monitoring many things. Lately we started saving information about what build ran on which machine and when. Jenkins actually provides that feature, this is called “Build history” and can be seen for the whole cluster or for some particular node. Unfortunately, when cluster is quite big (ours has more than 300 executors serving more than 10000 builds per day) Jenkins is not able to show the graph.
I gave a talk lately at DevClub about vim autocompletion out of the box and registers. Sorry, english-speaking friends, the talk is in Russian.
Lately as a process of joining different Postgres databases with 1 schema each into 1 database with different schemas, I had to export a schema from a database and to import it into another database with a different schema name.
Ruby standard library provides a good solution for parsing command line options passed to the script or application. It’s called OptionParser. It’s powerful and very easy to use. The code you have to write is easy to read and modify. It also supports different kind of options: short and long flags, required or optional arguments, also different types of arguments including dates, lists and so on.
My work involvs writing many small command line applications (scripts) in ruby. One of the common things among them is logging. The application should produce adequate log messages, so that one could follow the application flow. Ruby has a very good logger in standard library. You can use it like that:
Testing your cookbooks with unit tests will help you not to break existing functionality. But how can you be sure that the recipe will successfully run on production node? The only answer to that is running this recipe on some other/similar machine and checking if everything is actually configured the way it must be. Don’t worry we will not need some additional hardware for testing cookbooks, it can comfortably be done in virtual machine or container.
Before going further to running integration tests on your cookbooks and roles we need to prepare a bit by creating an Lxd container, where we would run our tests. This is a script that creats an Lxd container with Chef installed and a running ssh server (required for Test Kitchen transport).