Continuous Integration: Hi-Framework Java Web Project and GitLab Ci— Part I

Edgêncio da Calista
3 min readJan 12, 2018

--

Hi folks, Today we'll be talking about this interesting topic (actually, it's only interesting for geeks, lazy guys like me 😎 and…) for those who really care and appreciate the beauty of automated builds, tests and the consistence of their "deployable" piece of software, specially when it comes to teamwork.

Since it's intended to demonstrate the simplicity in which we can achieve the implementation of CI in our Java EE project (built using Hi-Framework), let's take a look at the concepts behind and a brief explanation of the tools involved. Let's start with the following:

Continuous Integration

https://docs.gitlab.com/ce/ci/img/cicd_pipeline_infograph.png

Continuous integration (CI)- is about a software engineering practice that allows developers to integrate the source code into a repository , so each integration can then be verified by an automated build and automated tests. Note that automated testing is not scrupulously a part of CI but it is frequently implied.

Because CI has the ability of detecting deficiencies earlier in development, defects are typically smaller, less complex and easier to resolve.

"Continuous Integration doesn’t get rid of bugs, but it does make them dramatically easier to find and remove." Martin Fowler

According to another CI “Sensei” 😎 , best practices of CI include committing code frequently, categorizing developer tests, using an isolated/dedicated build machine, using continuous feedback mechanisms and staging builds, the combination of this practices will allow the team to move fast and bring high quality standards in their deployments.

Now that we know what Continuous integration is all about, let’s take a look to the tools we’ll be using in the next section:

  1. Hi-Framework

As we are going to create a sample app so that we can deploy it to glassfish using Gitlab CI, we will be using Hi-Framework for this purpose. You may ask: what is Hi-Framework ?

"Hi Framework is a light Java Framework that allows developers to write fully Ajax web applications combining the power of a Java back-end to a rich client-side powered by AngularJS." — Hi-Framework Docs

This amazing framework is open and it is maintained by Emerjoin. Get more details clicking here.

2. Docker

Docker is a tool a bit similar to a virtual machine, but rather than creating the whole virtual operating system, it uses the same kernel as the host machine operating system it is commonly used to create, deploy and run applications using container. I will not stretch the explanation of this topic as i'll later bring a Full Docker post.. We'll be using a docker image to run our builds, tests and finally deploy the app to staging.

3. Gitlab Ci

I believe you already know GitLab Community Edition is a git repository provider and bla bla bla bla… Therefore, let me add to your knowledge base the following: Gitlab has some additional features to help with project management and software development and one of them is the builtin continuous integration tool named Gitlab Ci. It supports docker and allows executing parallel builds, versioned tests and provides realtime logging. You can define multiples jobs per stage and trigger other builds through pipelines.

Summarizing things

Basically, CI is the process of generating automated builds every time changes are committed to version control.

There is a wide range of concepts and tools behind CI implementation, however some are encapsulated. Since the main idea is to implement CI with a Java EE web application, you can build it with the tools and frameworks of your choice. I chose Hi Framework because it's a powerful framework and because I am familiar with it.

Well, friends, this is all I had reserved for this section, I’ll be back soon with our Hands On section.

I wanna take the opportunity to address my special thanks to the Java EE and CI "Sensei’s" R. Cumbe and I. Vilanculo! Hugs

If you like the post, don't forget to clap 😃 ! See you later….

--

--