Install/Configure Jenkins continuous integration server on Linux.

In this blog post I will describe installing and configuring Jenkins Continuous integration server. This set-up was used for one of  my current project to build Linux Application software.

I used Ubuntu 12.04 virtual machine running inside VirtualBox for this tutorial.

Jenkins is an continuous integration server written Java . Jenkins monitor configuration management ( CVS,SVN,Perforce.. ) servers  for changes , such as source code check-ins. Once it detects changes it will update the local working directory with the source from CM and performs series of build steps defined by the user on the source code. These build steps could be simple as invoking the shell script or  build script such as make,ant .

Jenkins has many plug-ins available to extend its feature set and to integrate with other Software tools ( unit test, code coverage, code analysis ).

Jenkins is Java based software , hence it requires Java Runtime as prerequisite on a system.

Jenkins software is available as Debian package . To Install latest Jenkins software on Ubuntu  execute following steps from command line

image

Once the installation completes make sure that Jenkins server up and running by opening web browser and pointing to http://localhost:8080 .

If Jenkins running you should see following page in the web browser . This completes the installation.

image

Configuring Jenkins  with Perforce Configuration Management.

Jenkins natively support CVS and SVN CM. In my application I use Perforce for configuration management. Since Jenkins natively does not support Perforce CM I need to install Perforce plugin for Jenkins.   Installing plugin is easy, Select “Jenkins->Manage Jenkins” option from the menu , select available tab to list the plugin and select and install perforce plugin. Following picture shows the “Manage Jenkins” page.

Jenkins-inst-4-perforce

You can discover and install additional plug-in similar to perforce plugin from the page.

Configure source code build.

From the Jenkins main page select NewJob to create simple build step.

In the next page enter job name and select “Build free style software project” option . You can read about the various option by selecting help icon next to option.

Jenkins-inst-4-perforce-1

Next page allows user to enter Configuration management specific details, in case Perforce CM, it user name,password and server details as shown below. These options differ based on the selected Configuration management .

Jenkins-inst-4-perforce-2

Other configuration details such as source code depot ( Perforce specific ), workspace details , Poll interval ( how often Jenkins should poll CM for changes ), where to copy the build output   are entered on the same page . Once the Configuration Management specific details are entered next step is provide instruction Jenkins to build software.

For this demo I have selected option to “Execute Shell” option to enter build command. With this option you can enter any Linux shell command . I will Apache ant to build my source code . Jenkins will execute these command once it check-out source code from the CM . I have entered following command to illustrate the build setup

cd projecta-src/

echo “Build started…”

ant BuildRelease

echo “Build Ended”

Jenkins-inst-4-perforce-4

After saving this step Jenkins will start monitoring  Configuration Management for changes, if changes detected it will pull changes to local workspace and  execute the build scripts.

Resources:

1. Jenkins website.

2. Jenkins Plugin repository.

Advertisements

Embedded Linux application development

Currently I am working on project which is uses custom version of embedded Linux built using open embedded framework. This project also uses QT for all the UI development ,googletest for c++ unit test and boost c++ for all threading and asynchronous communication(boost.asio).

As part of development I have explored and collected web resources which helped me to explore ,understand and tryout the samples and tools. I thought  I would share the same in this blog post.

Boost C++ :

  1. The Boost C++ Libraries  : Excellent introduction Boost C++ libraries. It covers many boost libraries such smart pointers,function objects,boost.bind,boost asio,boost threads,boost file system and many more. It includes lot of examples on each topic.
  2. Guide to Boost asynchronous I/O :  Boost.asio is a library to develop responsive applications using  async I/O facilities built into moderns OS. It is built on top of the Operating System specific asynchronous IO facilities such as IO Completion ports on windows and  epoll and similar on UNIX based Operating systems. This tutorials covers  boost asio library in depth . It has numerous examples to illustrate the concepts used in library.
  3. Asio C++ Library : This tutorial is from the developer of boost.asio library. It covers tips and tricks and sample code to illustrate how to use boost.asio to execute arbitrary tasks using thread pool and asynchronous facilities.

QT :

  1. C++ QT training videos on YouTube :  Total 106 videos which cover QT basic to advanced concepts.
  2. QT Videos at QT project site : Collection screencast which covers wide range of QT topics from beginners to advanced presented by top QT training firms such as KDAB and ICSNetwork.

 

Embedded Linux

  1. Free Electrons :  One of best site for Linux and Embedded Linux. Lot of great free training materials.
  2. Embedded Linux conference video archive : Embedded Linux Conference is as vendor-neutral technical conference for companies and developers using Linux in embedded products.  This website has all session recordings of a conference from 2005 to till date .

googletest :

  1. Quick Intro to Google C++ Test framework : This article from IBM developer works technical library, gently introduces google test framework.
  2. Google C++ framework wiki :

C++ IDE

  1. C/C++ Remote development using Netbeans  : This is great article which explains how to setup Netbeans IDE for C/C++ development . It explains how develop/debug application on Windows targeting Linux Box. It uses gcc tools /gnu debugger  over SSH/Telnet.

Build Media Center PC using Raspberry Pi

Raspberry Pi is a credit card sized computer built using Broadcom SOC (system on chip) created by Raspberry Pi foundation. It costs $35 for model B board which has 700 MHz ARM CPU, 512 MB RAM, 2 USB2 ports, 1 HDMI port ,1 RCA video port,Ethernet and audio port. It has SD card for installing Linux distribution.

Here is screenshot of Raspberry Pi board

rasppi

There are number of Linux distribution that target Raspberry Pi , including distribution to run Media Center software.

In this post I will talked about how I built my media center pc using Raspberry Pi and OpenELEC ( open embedded Linux entertainment center ) Linux distribution.

OpenELEC is a small Linux distribution with complete XBMC media center software. Compared to Raspbmc which is another Linux based media center distribution , OpenELEC is very small around 80MB in size. Because OpenELEC distribution  packages only software necessary for media center it is small and fast compared to Raspbmc.

Here is the screenshot of my Raspberry Pi board with all necessary connection .(HDMI connection to monitor, micro usb power connection, Ethernet connection and USB keyboard and mouse).

2012-12-27 19.55.18

Creating bootable SD image

Before powering up the board , you need download OpenELEC distribution from the OpenELEC website. Make sure that you download image which as RPi-arm name in it,  example : OpenELEC-RPi.arm-devel-20121124031454-r12577.tar.bz2

To create bootable OpenELEC image on SD card you can Windows/Mac/Linux OS workstation with SD card reader. Here are the steps to create SD image on Ubuntu 12.10 .

1. Unzip and un-tar OpenELEC to some folder ,

2. Insert 2GB blank SD card to your machine.

3. Execute create_sdcard shell script from OpenELEC folder with device path of the SD card.

Example

linux-vm:~/OpenELEC-RPi.arm$ ./create_sdcard  /dev/sdb

4. Once step 3  completes without any errors, SD card will have bootable OpenELEC image.

5. Now insert SD card to Raspberry Pi board and power up.

6. You will see the boot screen with OpenELEC and Raspberry Pi logo.

2012-12-28 11.34.03

7. After while you see familiar XBMC media center interface.

2012-12-28 11.35.00

8. Now you navigate the menu using keyboard and add your data source where you stored your media collection.

OpenELEC supports UPnP, DLNA,NFS,CIFS,SMB,FTP,SFTP and others file sharing protocols. Using these you should be able to browse the media collection stored on your PC , MAC, Linux or NAS box.

You can also connect your USB2 hard drive to Raspberry Pi and browse media collection from OpenELEC.  OpenELEC supports hard drive formatted using NTFS ,FAT/FAT32 and other Linux file system formats.

Once you have contents you play any audio/video/photo formats.

OpenELEC also supports Apple AirPlay as target. You can enable this from settings menu. Once enabled , you can stream photo and video from you IOS device( iPhone ,iPad ,iPod touch and MAC computers )  to OpenELEC connected device ( TV or monitor )

In the next blog post I will explore installing Java 8 on Raspberry Pi and running Java FX application.

Resource

1. Raspberry Pi : Main Raspberry Pi website.

2. OpenELEC : Open Embedded  Linux media center website.

3. OpenELEC on Raspberry Pi :  Instructions to install OpenELEC on Raspberry Pi

4. XBMC : XBMC wiki page .

5. Raspbmc :  Raspberry Pi media center distribution based with XBMC software.

6. Run Java Application on Raspberry Pi. Oracle TechNet article for installing Java on Raspberry Pi

7. Raspberry Pi accessories :  Collection of Raspberry Pi compatible accessories.

Simple way to share files from between Linux to windows

I often use both Windows and Linux environment at work. Sometimes I need to share files between Linux & windows workstation.

There are couples of ways to share files between Linux & Windows.

  1. Setup Samba server (CIFS share) on your Linux box, which can be accessed from any windows machine. Because In many of the Linux distros Samba server is not installed by default. It requires installing package and setting up configuration file to share folder.
  2. Run Ftp server on you Linux box and use ftp client from windows box to access it. Again this solution may require starting the ftp server on the Linux machine and configuring it to allow access to shares.
  3. Run SSH server on Linux machine and on windows box you use secure copy(scp) or similar SSH client to do file transfer. You can download scp client for windows putty download page.This also requires installing SSH server on Linux box ( for Ubuntu by default SSH server is not installed)

Even though many of the option listed are simple , it requires some effort to setup. You need to repeat the same when you re-install Linux.

Recently I discovered simple and elegant way to achive the same using python built in SimpleHTTPServer module.Advantage of this approach is python is by default installed on all Linux distributions. No need to install any additional package.

Here is how to do it

    1. From the command shell, go to the directory you want to share. For example if you want to share “/usr/home/john/files” .                                                                                                                                                                       $ cd /usr/home/john/files
    2. Run following command to share files. This command starts the webserver on port 8080 with directory browsing enabled .                                                                                                                                                                             $ python -m SimpleHTTPServer 8080
    3. On your windows box point your any Webrowser to http://<linux_machine_ip&gt;:8080 . This will list all the files present on the Linux box . Now select any files download to windows.

Resource

Weekly resource for developer

  • Reactive Extension Release and 6 part video series. : The Reactive Extensions (Rx) is a library for composing asynchronous and event-based programs using observable sequences and LINQ-style query operator.
  • Choosing right collection in .Net : This article explains the data structures ( collections ) available in .NET and how to choose right collection .
  • Articles on parallel programming with .NET framework 4. : .NET 4 introduces number of new API/collection to help developer take advantage of cpu hardware resource using parallel programming technique. This link gives whitepapers published by Microsoft on these technologies.
  • Silverlight spy : Silverlight Spy is a runtime inspector tool providing unprecedented access to all aspects of any Silverlight in-browser, out-of-browser and Windows Phone 7 application. Explore the UI element tree, monitor events, extract XAML, interactively execute DLR code, view statistics and more.
  • http://beej.us/guide/ : Unix IPC, Gnu Debugger, Networking
  • Functional Programming: A Pragmatic Introduction : This presentation talks about advantages of functional programming over OO . Good presentation with examples in java. It shows how functional decomposition will help in solving programming task elegantly.