Hello there,

Today i ‘d like to share with you my experience with CI/CD basics. Everyone talks about it, almost everyone uses it.

But as usual Internet has fragmented/incomplete and controversial knowledge about how to actually start.

And this is what i ‘d like to change.

This guide is intended for newcomers that want to start using Continuous Integration and Continuous Delivery but don’t have even distant idea from where to start.

In this manual, we will setup all basic required things to do code’s automated builds.

To achieve our goal, following steps will be performed:

  1. Get Linux machine
  2. Install GIT – Control Version system and provide some code to build
  3. Install Jenkins – CI/CD application
  4. Install Apache Ant tool
  5. Install Checkstyle tool
  6. Create Jenkins project and Ant build task.


Please mind that all apps will reside on single machine in order to show all steps required to complete basic CI deployment.

Therefore some steps can be omitted according to your current situation and available resources.

If you have nothing, you are starting from scratch, follow this guide step-by-step.

PART I : Getting Linux machine

You can use real hardware or create virtual machine on VirtualBox, vMware or Xen, no matter.

In this guide I’ve decided to use AWS which as of 27.09.2015 provides free trial access.

I’ve selected Amazon Linux AMI (“T2.micro” type) as my machine, which is free.

Technically its RHEL6/CENTOS6 with amazon repositories and tools.

And that should fit. Once everything is ready, connect to your machine via any ssh client.

I am using Putty:


PART II: Install GIT and provide some code

Git installation is straightforward:


Next, lets create user git and setup password:

Switch to git account:

Right now we need to download some actual code to test our CI server.

I’ve selected jSudoku:

Made in 2008, written in Java, it will be perfect example in our trials.

Lets download sources and unpack it:

Remove build.xml – we don’t need it in our guide.

At the end you should see this picture:


Once source code is ready, time to initialize your first Git repository:

You are all set. Now we have a repository with jSudoku code.

In order to be able to clone repository via ssh, we have to create ssh key-pair:


And here we are:

“Id_rsa_git “ is your private key.

For sure we would like to know if git cloning works.

Lets return to root account, copy “id_rsa_git” to root’s “.ssh” folder and setup automatic ssh config.

This is how my credentials look like:


Alright! Now root account should be able to connect to git account via ssh-private key w/o passwords.

Let’s test the cloning:


Works like charm! This completes part II.

PART III: Install Jenkins

Installation of Jenkins is also very simple, so there is no necessity of copy-pasting official wiki:


Ensure that you have right Java installed as manual describes.

Now, to access Jenkins UI, you need to connect from browser via 8080 port.
If you are using AWS machine like me, please note, that by default Amazon “Security Groups” are having this port closed.

You will have to open it:


If you have your own firewall or other network security devices – ensure inbound port 8080 is opened for your machine.

Everyone else – skip this step.

Alright, time to open Jenkins UI:


By default, there is no security at all, you will have to set up basic account protection.

This simple guide will show you how to create account (go directly to Step – 2).

Once you ‘ve done with this, you should have at least one administrator account:


Now, lets install Checkstyle plugin, it will be necessary for us in future:



Jenkins will reboot once you hit the “reboot” check-box.

After re-login, plugin should be ready to use.

In our setup Jenkins will require to access to git repository, therefore we have to give him bash access (i know its insecure, but is required in our manual scope):

Copy private key and config from root’s account to jenkins “.ssh” folder:


Alright, lets login as Jenkins and try to clone the repository:


Good, it works!

Part IV: Install Apache Ant

Let us install Apache ant worker – “java library and command-line tool whose mission is to build Java applications” (C).

Ant Installation is even easier than everything we done above.


Aaaannnddd…that’s pretty much it :).

PART V: Checkstyle tool

Next, we have to deploy Checkstyle tool – application that “automates the process of checking Java code to spare humans of this boring (but important) task.” (C)

Grab the latest version here (as for 27.09.2015) latest version is: 6.10.1.

And unzip it:


Frankly speaking, I don’t know what should be the best location for this, therefore I’ve put it to Jenkins’s Home Directory:



Checkstyle requires set of rules to how to actually check code.

We will have to unpack checkfile’s jar to get to required file with those rules:




Now, return to Jenkins home directory and fix ownership:


That’s it! Checkstyle is ready to serve our goals.

PART VI: Create Jenkins project and Ant build task

Alright, we are all set to do actual Project and provide Ant build xml script that will work on Java sources.

Lets create new project in Jenkins:


For now just click [SAVE] button. Then hit [Build Now] button:


This way we will initialize workspace for our project which is by default in /var/lib/Jenkins/workspace/jSudoku folder.


As you can see above, we have “jSudoku” folder, lets navigate there and create Ant builder script which will do all the job:


This Ant script for jSudoku code does the following:

  1. Cleans up the environment
  2. Downloads (clones repository) jSudoku sources from GIT
  3. Runs checkstyle tool on sources
  4. Invokes java compiler to build the project
  5. Finally creates runnable JAR file

You can transfer it via favorite sftp tool or simply copy the content in the ssh client:


Generally, if to make any diagram, the workflow looks somewhat like this (it’s very rough overview, but you should get the idea):


  1. Jenkins runs Ant xml script. From now on all the job is performed by Ant.
  2. Ant xml build script calls GIT for sources.
  3. Git sources get copied to workspace folder.
  4. Ant works on source code now.
  5. Checkstyle app generates the report with code flaws
  6. Source code gets compiled and runnable JAR file is created
  7. Ant reports all the progress to Jenkins to Console Output from start
  8. Jenkins looks up the checkstyle report for the code flaws

NOTE: Ensure you’ve changed “git.link” variable in script to your git repository!!!

Alright, we have script, lets finally configure our Jenkins project and start doing actual work:


Lets add our Ant script:


Also, lets add the checkstyle report and hit [SAVE] button:


Hit [Build Now] button again:


Yay! Your first automated build is now completed! As you can see, build was successful.

Lets see the [Console Output] and [Checkstyle Warnings] reports:


The console output:


And Checkstyle report:


As we can see, code needs some style updates 🙂

This concludes my CI/CD beginner manual.

I know that there is a big scope of improvements. However, please mind that this is an attempt to help rookies to get started.

From beginner for beginners.

Of course, if you have any good advises on improving current manual or simply discuss and get help – feel free to share your thoughts and ideas in respective [ Forum ] topic.

Stay frosty,