Tags

, ,

Since we will use Git as repository, if not already present, install Git Plugin for Jenkins,

jenkins job creation - manage plugins

jenkins job creation - git plugin installing

We will use Jenkins to automate a cross platform software that is built from a single repository. In order to use Jenkins, we will install Jenkins Slave  in build machines, and a Jenkins master (regular Jenkins instance) will orchestrate these. First let’s prepare a Debian build system. We assume all necessary build tools (make, g++) and libraries (libpcap, libpq) are already present. Install Jenkins slave agent to build machine,

First obtain keys,

jenkins slave - get keys

Then add package source of Jenkins to /etc/apt/sources.list

jenkins slave - add jenkins package source

Then perform an update ( apt-get update) and install Jenkins.

jenkins slave - install jenkins

We also should generate ssh keys

jenkins master - generating build key to use in git

Public keys should be added to git side so that build systerm can connect to Git repository. First if not already created, create a git server, install git (apt-get install git). Create a new user called ‘git’

git server - adding new user git

Create an authorized_keys file, which will be container of public keys of git clients,

jenkins job creation - authorized_keys folder

Then this public key should be appended to  authorized_keys file.

jenkins job creation - appending public keys to authprized keys

Create an empty git repository

git server - creating an empty repository

After populating repository, start with configuring Jenkins master side. If not already installed, install ssh plugin through plugin manager. Master will connect remote through this ssh plugin,

jenkins slave - install ssh plugin

Now create a new job that will be used, this may be done through “Manage Jenkins” and “Manage Nodes” section

jenkins master - manage jenkins jenkins master - manage nodes

Create a new dump slave node, name it “capturer debian”, which will be our debian build system to prepare capturer in this os.

jenkins master - creating new dump slave node

Configure host, working directory and credentials for slave connection,

jenkins master - configuring dump slave node

We should see slave and, the connection should be established,

jenkins master - slave node status

Since we will use remote ssh in order to build, define a remote ssh agent using global configuration menu,

jenkins master - configuring ssh agent

Then create a new freestyle item,

jenkins master - creating new item

And configure newly created item. We schedule it to be daily executed, only in remote slave “capturer debian” and through ssh shell commands as given below.

jenkins master - job configuration part I

jenkins master - job configuration part II

jenkins master - job configuration part III

If everything is as expected, we may start a build which will execute successfully.

jenkins master - starting a manual build

To see process details, we may refer to console output as,

jenkins master - console output I

Next may be configuring git repository so that it should trigger a build when there is a change, rather than polling or using scheduled builds.

Advertisements