Moving a Jenkins Instance From one Server to Another

During my time converting ZDirect’s SVN repo to Git, we decided to move our code from a server in Florida to a server in Ottawa. The same server also hosts our Jenkins build server. To keep bandwidth bills and build latency down we’re moving the Jenkins server over as well.

Trial and error led me to copying the entire Jenkins directory, which is either at the JENKINS_HOME environment variable or ~/.jenkins as the default. Launching the Jenkins executable while setting the JENKINS_HOME environment variable will bring up an almost perfectly configured instance of Jenkins. I say almost because the Jenkins configuration should be looked over for any settings that are wrong for this new system. Some Jenkins configuration options that I had to change was the JDK home, Ant home and the external url of the server. An example launch script looks as follows:

$ JENKINS_HOME=/path/to/jenkins/home/folder
$ java -jar jenkins.war

The Jenkins Wiki outlines how to move specific jobs as well.

Svn to Git Migration

At my workplace ZDirect, we have a decade old SVN repository hosting about twenty projects and totalling about 13 000 commits. Recently, we’ve decided to switch over to using Git from SVN because of SVN slowly becoming antiquated and its various productivity slowdowns that are not seen in new version control systems.

Some immediate goals
  • Speed up the time it takes to clone a repo
  • Simple branching and conflict handling
  • More code reviews

That last point about pull requests is actually a feature of the web-based software hosting system. We chose GitLab as our solution, but more on that will come in a later post.

Some long-term goals
  • Move towards continuous integration
  • Use advanced Git workflows

Since being the most comfortable with Git, I volunteered myself as the “Migration Lead”, where I coordinated both the technical side and the human side. There is an incredible amount of articles out on the web talking about how company X or average Joe Y moved their SVN codebase to Git. What has really helped me along the way so far is Atlassian’s Git articles and tutorials; outlining a standard workflow for the process really makes it trivial for anyone else to do the same.

Hacking Banshee

Since syncing music to my Samsung Galaxy S3 doesn’t work with Linux (for the most part), I’ve constructed a method of transferring the music over ssh from my laptop to my phone using a cool little program called Unison. The solution is flawless and allows two-way syncing.

One problem, (or challenge depending on how you think about it), is that the playlists that are managed inside of Banshee Media Player on my laptop have to be exported individually and manually to a file when I want to transfer them over to my phone. Having a way to automatically export all of your playlists to some predefined directory would be very helpful for automating my music syncing. After some Googling it seems like no one has solved this problem yet.

I grabbed the Banshee source and started looking over its files associated with playlist exporting. Bingo! Shortly thereafter I found in the file Banshee.ThickClient - Banshee.Gui.SourceActions.cs the method OnExportPlaylist() which has the user interaction for exporting a playlist and the holy grail, the playlist.Save() method call.

The next logical step for me would be to figure out whether this functionality can be encapsulated into an extension, or if that’s not possible, a patch. I’ll definitely be following up on this.

Job Update and a Concurrency Rant

Well, it looks like the early bird catches the worm. After my roommates and I took this inconvenient online course introducing us to Carleton Universities Co-op program and multiple presentations and resume workshops later, I’ve finally done it. I’ve landed myself a prestigious 8-month co-op at ZDirect, a global company that produces hotel marketing automation software. Development is exclusively done in their downtown Ottawa site and sales offices are around the world.

Since Carleton’s Career and Co-op department uses a web-based job portal by Orbis Communications, and the fact that students like to procrastinate and leave everything to the last day that things are due, the résumé and cover letter uploading process has a flaw where if there are many users trying to concurrently upload their documents, this “document converter” would stall and not let you progress through the application process. My roommates and I started panicking and thinking of ways to fix it. One of my suggestions was to call up Carleton’s Computing Services (CCS) and order them a pizza in exchange for having them reboot the server. Unfortunately after giving CCS a call, they said the servers were managed by the Careers and Co-op department. Dead end there since it was already 9:30 pm and no one would be at the office.

I decided to compromise and find emails of hiring managers for my top 10 choices. Long story short, I emailed ZDirect that night, had an interview with them the very next day (that went very well), and got a phone call the day after with a job offer.

Lesson of the day: have a backup plan and design and test your concurrent systems very well!

A recent essay I read

Surveillance is the business model of the Internet, after all — and [the NSA] simply got copies for itself.

After multiple years of listening to Security Now mention Bruce Schneier for his security insights, I’ve finally subscribed to his Crypto-Gram newsletter. This is one of his many thought-provoking essays.

A Fraying of the Public/Private Surveillance Partnership

Building Eclipse C/C++ projects for 32-bit on a 64-bit system

In my systems programming course we learn various techniques of the C programming language. On multiple assignments we are provided code that only runs on 32-bit. I run Linux Mint 64-bit on my laptop, using Eclipse for my C/C++ development and the GNU toolchain to compile, which is an issue when the 32-bit C/C++ code is compiled by default for 64-bit. Valgrind is also unhappy since it cannot run the cross compiled 32-bit code (probably many other profiling tools encounter this as well).

This guide should work flawlessly on Ubuntu and its derivatives since Linux Mint is based upon Ubuntu and uses its packages.

I solved this problem by adding the -m32 tag to the eclipse compiler and linker settings, and installing the required 32-bit packages for my operating system.

Method

In eclipse

  1. Go to Project->Properties then click on Settings, which is under C/C++ Build
  2. Make sure that the current configuration that is selected is All Configurations
  3. Select the Tool Settings tab, select GCC C Compiler, if it isn’t selected already, and in the Command form change gcc to gcc -m32 to enable 32-bit compiling with GCC
    gcc compiler
  4. Do the same change of gcc to gcc -m32 on the GCC C Linker page, then click OK to save the settings
    gcc linker
  5. Make sure to clean the project so that previously created object files compiled with 64-bit GCC are removed, otherwise the build will fail. Go to Project->Clean… and either select Clean all projects or select Clean projects selected below, then selecting the current project (In my case it is comp2401a3). Click OK
    eclipse clean project

Required Packages

Installing the following packages enabled standard C/C++ library calls to work. If other libraries are used within the code, additional 32-bit packages might have to be installed. Installation via Linux Mint, based on Ubuntu, is via the standard apt-get install command.

apt-get install g++-multilib lib32gcc1 libc6-i386 lib32z1 lib32stdc++6
apt-get install lib32asound2 lib32ncurses5 lib32gomp1 lib32z1-dev lib32bz2-dev

This might also be required if the code still does not compile:

apt-get install ia32-libs-gtk

 Package for Valgrind

When running Valgrind on the 32-bit code the following error occurred.

valgrind: Fatal error at startup: a function redirection
valgrind: which is mandatory for this platform-tool combination
valgrind: cannot be set up. Details of the redirection are:
valgrind:
valgrind: A must-be-redirected function
valgrind: whose name matches the pattern: strlen
valgrind: in an object with soname matching: ld-linux.so.2
valgrind: was not found whilst processing
valgrind: symbols from the object with soname: ld-linux.so.2
valgrind:
valgrind: Possible fixes: (1, short term): install glibc’s debuginfo
valgrind: package on this machine. (2, longer term): ask the packagers
valgrind: for your Linux distribution to please in future ship a non-
valgrind: stripped ld.so (or whatever the dynamic linker .so is called)
valgrind: that exports the above-named function using the standard
valgrind: calling conventions for this platform. The package you need
valgrind: to install for fix (1) is called
valgrind:
valgrind: On Debian, Ubuntu: libc6-dbg
valgrind: On SuSE, openSuSE, Fedora, RHEL: glibc-debuginfo
valgrind:
valgrind: Cannot continue — exiting now. Sorry.

After adding the suggested package libc6-dbg, the error still occurred. Installing the 32-bit version of the package fixed the error:

apt-get install libc6-dbg:i386

Conclusion

As shown above, it can be troublesome to set up cross compiling of 32-bit C/C++ code on a 64-bit machine, but if the reward of programming in the native operating system is worth more than programming in a virtual machine or on another computer, then it is a worthy cause.


 Sources