Exploring Jenkins

Jenkins was one of the most popular CI tools used to build and test different kinds of projects. It’s now also used for CD and is a very important part in DevOps practices.

Firstly, we need to understand what CI is. CI is one of the most popular application development practice in recent time. Developers integrate new features, bug fixes in a code repository. Then CI tool verifies automatically, builds and tests to detect any problem with current sources and provides quick feedback to the development team.

“Jenkins is an open source automation server written in Java. It helps to automate the non-human part of the software development process, with continuous integration and facilitating technical aspects of continuous delivery. It is a server-based system that runs in servlet containers such as Apache Tomcat”–Wikipedia

 

Plugins

Plugins make Jenkins easier to learn, easier to use. There are various categories of plugins available for it, such as:

  1. Source code management
  2. Slave launchers and controllers
  3. Build triggers
  4. Build tools
  5. Build notifiers
  6. Build report
  7. Post-build actions
  8. UI plugins
  9. Library plugins

In this article, I’m using Laravel project with Git repo and Java e2e automation test for example build. So there are should-have plugins:

  1. Jenkins Pipeline plugin
  2. SonarQube
  3. Github Integration plugin
  4. Allure Jenkins Plugin
  5. Default suggestion plugin from Jenkins

 

The pipeline as code concept

The default interaction model with Jenkins, historically, has been very web UI driven, requiring users to manually create jobs, then manually filling in the details through a web browser. This requires additional effort to create and manage work to test and build multiple projects, it also keeps the configuration of a job to build, test or deploy separately from the actual code being built, tested or deployed. This prevents users from applying their existing CI/CD best practices to the job configurations themselves.

With Jenkins pipeline plugin as I listed in should-have plugins, users can implement a project’s entire build-test-deploy pipeline in a Jenkins file and store that alongside their code.

Building on the core Jenkins value of extensibility, Pipeline is also extensible both by users with Pipeline Shared Libraries and by plugin developers. 

The flowchart below is an example of one CD scenario easily modeled in Jenkins Pipeline:

Pipeline syntax overview:

There are 2 kinds of pipeline code:

1.Declarative Pipeline (New concept):

Declarative Pipeline replaces Groovy variable assignments, control structures, loops, and exception handling with a predefined structure and model to allow users of all experience levels to quickly create consistent, concise Pipelines without learning Groovy.

All valid Declarative Pipelines must be enclosed within a pipeline block

2.Scripted Pipeline (Advance):

Scripted Pipeline, like Declarative Pipeline, is built on top of the underlying Pipeline sub-system. Unlike Declarative, Scripted Pipeline is effectively a general-purpose DSL built with Groovy. Most functionality provided by the Groovy language is made available to users of Scripted Pipeline, which means it can be a very expressive and flexible tool with which one can author continuous delivery pipelines.

In this article, I can’t give you a full introduction to Pipeline syntax. If you want to get deeper with this, this docs contains fully syntax and examples for both ways of pipeline code.

 

Jenkins in Actions

There are a lot of ways to approach Jenkins. You still can get your job done perfectly even you are using Web UI driven or Pipeline as Code. Base on your organization, projects, and skills, you can choose what is most suitable for yourself.

In this section, I’m introducing how did I implement CI/CD server for my organization.

1.Requirements:

a. Implement CI for automated build Laravel, Rails projects

b. PHP code should be following PS-R2 coding standard.

c. Execute e2e test written in Java

2.Actions

a. For building project, I prefer using docker container and execute bash script inside.

b. For checking Code quality, SonaQube is my best choice

c. Following requirements, I create a skeleton for the project:

d. Then I filled up actions for each defined stage in Jenkins file for a Laravel project:

From these codes, we can see BRANCH_NAME and CREDENTIAL_GITHUB are input variable from Jenkins project, so we need to configure some more things:

3.Refactor

Let’s do some refactor for this:

Firstly, we need to implement this pipeline for more than one project, so reuse pipeline code and keep it D.R.Y should be a good way for saving development time.

The pipeline has supported for creating “Shared Libraries” which can be defined in external source control repositories and loaded into existing Pipelines.

a. Defining Shared Library structure:

b. Phppipeline.groovy file:

 

Conclusion

There are some important things that we should remember:

I hope that I’ve shown you the most common tasks for implementing CI/CD with Jenkins. Please feel free to leave your comments below if you have any question or contact us via email for free consultation. Don’t forget to share & subscribe to our blog!


The definition of Internet of Things (IoT) was first introduced for supply chain management (Ashton, 2009). However, in recent years, it has been more inclusive covering other sectors like healthcare, utilities, transport, real estate as well (Gubbi et al., 2013). It became a “buzz” word and most people might have heard about the term by now. But what do people know about it? In fact, the Internet of Things is all about connection. It is the interconnection of sensing device objects to share information across platforms.

Impacts of the Internet of Things in near future

According to a report from International Data Corporation (2017), global spending for the IoT will experience a growth rate of 15.6% annually, and by 2020 it will reach $1.29 trillion. The forecast for the most valuable IoT investments in 2016 is $178 billion in manufacturing, $78 billion in transportation, and $69 billion utilities. And real estate sector is not excluded from the trend. The IoT will change the real estate industry drastically in a way we never imagine before. In the innovation age, outdated ways of real estate management are costing business owners and consumers a massive amount of money and hindering business growth. The IoT has made a significant impact on both sides.

The IoT’s smart sensors help to analyze, monitor and control such as home devices, security, elevators, parking garage, … in the property (Ibarra-Esquer et al., 2017; White, 2018). With the IoT, data is gathered and generated from every single activity. It provides the managers with data-driven insights and improves the performance. As a result, the IoT will change how buildings and cites will be managed in the near future (Rathore et al., 2016).

How does the IoT specifically affect Real Estate?

For the commercial real estate industry, the IoT aid in gathering data to optimize sale and processes. The connections from IoT with big data processing allows business owners to keep track of consumers routines and information. From there, they can offer secondary services such as home-moving, house maintenance at the point of property purchases. In another view, the IoT can offer data to help managers and owners create differentiation immediately from the development stage. Behavior data from tenants can make it easier for developers to change and adopt new construction design. Population habits can also be collected to help management companies improve living space for their residences.

In other words, the IoT has slowly become an essential part of our life, and it will change the real estate sector for the better. If business owners want to remain competitive in the industry in this innovation age, they will have to modify and adapt to the new standard.

What is your opinion of the impact of the IoT on Real Estate? Or the impact of IoT in general? Please share with us in the comment below or contact us via email contact@twentyci.asia for free consultation.

Mia Tran                          

Reference

Ashton, K. (2009). That ‘internet of things’ thing. RFID journal, 22(7), 97-114

Gubbi, J., Buyya, R., Marusic, S. and Palaniswami, M. (2013). Internet of Things (IoT): A vision, architectural elements, and future directions. Future Generation Computer Systems, 29(7), pp.1645-1660.

Ibarra-Esquer, J. E., González-Navarro, F. F., Flores-Rios, B. L., Burtseva, L., & 1, M. A.-V. (2017). Tracking the Evolution of the Internet of Things Concept Across Different Application Domains. Sensors, 17.

International Data Corporation. (2017). Worldwide Semiannual Internet of Things Spending Guide.

Rathore, M., Ahmad, A., Paul, A. and Rho, S. (2016). Urban planning and building smart cities based on the Internet of Things using Big Data analytics. Computer Networks, 101, pp.63-80.

White, M. (2018). Real Estate and the Internet of Things. [online] Realtor Magazine. Available at: http://realtormag.realtor.org/technology/feature/article/2015/03/real-estate-and-internet-things [Accessed 6 Jun. 2018].