DevOps lifecycle; CI/CD with Jenkins(Intro)

Alex Izuka
5 min readJan 17, 2022

--

Built to be shipped

Having looked at Linux and Git commands in our last article https://aleqxan.medium.com/what-every-newbie-in-devops-need-to-know-2-61aefb91162b we would explain further some DevOps operations. We did an introduction earlier https://aleqxan.medium.com/what-every-newbie-in-devops-need-to-know-e27faa019a2d.

DevOps

DevOps is a combination of two words — development and operation, it’s a set of practices that combines the development aspect of programming and the operations aspect of programming. It is a combination of software development and IT operations. DevOps was introduced to make the deployment of software applications easy. The DevOps lifecycle consists of the following; Continuous development, Continuous Integration, Continuous Testing, Continuous Monitoring, and Continuous Deployment.

Continuous development

This phase is where planning and software coding takes place. Planning involves understanding the project. Software coding involves the plan implemented on various software applications with various programming languages such as Java, Python, Ruby, Golang, JavaScript e.t.c. The process of maintaining the code is what we call Source Code Management (SCM). This is done with the aid of Git, Gitlab.

CI/CD pipeline

The CI/CD pipeline automates your software delivery process. The pipeline enables building codes, testing, and deployment. The automation provides a standard feedback loop and enables fast production.

→ Continuous integration: the new code or the changes made are integrated into the existing code. The changes in the developer's code bring about continuous integration. These changes are made at the source code. Whenever a code is committed, a build is triggered. The advantage of continuous integration is you are able to monitor your codebase, the quality of the codes, and their health.

→ Continuous delivery: the continuous delivery process is manual, there would have to be an appointed time to carry out changes on the software. it follows the continuous integration process.

→ Continuous deployment: It deploys all the changes in the source code to production automatically. It is a strategy whereby each commit that passes the automated testing is sent to production immediately.

CI/CD with Jenkins

Jenkins is an open-source automation server that enables developers to reliably build, test, and deploy their software remotely. It allows you to carry out a series of operations to achieve continuous integration and delivery of your applications. It is written in Java. It has a rich plugin library, is highly portable, and can easily be configured.

When your commits have been built, Jenkins CI would check the builds, if the build is fine, the executable code will prepare it for deployment, and all developers who will commit the changes are notified.

Setting up Jenkins

You must have java running on your system. To verify java installation in your system use java --version on your terminal. To download and install Jenkins click https://www.jenkins.io/doc/book/installing/windows/. After installation use the following command on your terminal;

To add Jenkins public key wget -q -o -https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add-

To add Jenkins repository to your system sudo sh -c 'echo deb http://pkg.jenkins.io/debian -stable binary/>/etc/apt/sources.list.d/jenkins.list

To download package information for all your config resources sudo apt-get update

Install Jenkins with the following command; sudo apt-get install jenkins

To check status of Jenkins; sudo service jenkins status

To start Jenkins; sudo systemctl start Jenkins

Open your web browser and type localhost:8080

Jenkins usually put password to protect your file, to get the password, navigate to your terminal and enter this command; wsudo cat /var/lib/jenkins/secrets/initial AdminPassword

Copy the password and paste on your web browsers Administrator password

Building a project on Jenkins

  1. Login to your Jenkins account with localhost:8080, we would be building a freestyle project.

2. Create new item; After inputting your details, you’ll have access to the Jenkins dashboard, click new item

3. Input the details of your project; For this project, we would be using Hello World (We use Freestyle Project because it's a repeatable build job, script, or pipeline that contains steps and post-build actions)

4. Input project description; describes the kind of project you’re doing.

5. Input your repository URL from your Github account; this URL is the project you built and want to test on Jenkins. If your Github repository is private, Jenkins would ask for your Github login details. This would be done in your source code management section.

6. Settings: In your build section, you can set the parameters to suit your project or specification. Under build, click on Add build step”, click on “Execute Windows batch command” and add the commands you want to execute during the build process, e.g java HelloWorld Click Apply and Save the project

7. Build project: After saving the project, you would be taking to your Jenkins dashboard, on your dashboard click Build now

8. Status; You can check the status of the build at the left bottom section of your dashboard

9. Console output: Click on the build number and then Click on console output to see the status of the build you run. At the console output, you get to see how your project was built and tested, if it failed or succeeded, you’ll see the result at the bottom of your console output page.

If you have carried out all this then you should have successfully built your project on Jenkins.

We have looked at CI/CD, knowing the difference between integration, delivery, and deployment, looked at CI/CD with Jenkins; how to install and configure Jenkins, and finally did an illustration explaining building on Jenkins.

--

--

Alex Izuka
Alex Izuka

No responses yet