Day23- 90DaysOfDevOps

Jenkins Freestyle Project for DevOps Engineers.

Day23- 90DaysOfDevOps

Hey Learners! Welcome back. In a previous blog, we learned about the introduction to Jenkins, How to create a freestyle project, and many more. In this blog, we are creating a Jenkins Freestyle Project with advanced details and trying to clear some advanced concepts of Jenkins. So let's get started.

What is CI/CD?

  • CI or Continuous Integration is a software development practice that focuses on automating the process of integrating code from multiple shared repositories. The key goal of CI is to ensure that code changes are integrated frequently and consistently, allowing teams to detect and address integration issues early in the development process. It sets the stage for other practices like Continuous Delivery or Deployment (CD), which build upon the principles of automating processes, ensuring consistency, and delivering software reliably.

  • CD or Continuous Delivery/Deployment, is a software deployment practice closely related to CI. It extends the principle of CI to automate and streamline the process of deploying code changes from the development environment to production or staging environments reliably and consistently. It ensures to automate the release process so that we have a release-ready product at all times and we can deploy our application at any point in time.

What is a Build Job?

A Jenkins build job contains the configuration for automating a specific task or step in the application building process. These tasks include gathering dependencies, compiling, archiving, or transforming code, and testing and deploying code in different environments.

Jenkins supports several types of build jobs, such as freestyle projects, pipelines, multi-configuration projects, folders, multibranch pipelines, and organization folders.

What is a Jenkins Freestyle Project?

A freestyle project in Jenkins is a type of project that allows us to build, test, and deploy software using a variety of different options and configurations. It can shape build steps, triggers, post-build actions, and deployment mechanisms. Freestyle projects are repeatable and contain both build steps and post-build actions.

Task 1-

Create a new Jenkins freestyle project for your app.

In the previous challenge, we created a simple project to print Hello World directly through a Freestyle project. In this task, we'll create and deploy a static Nginx web page in a docker container. Let's start

  • Access web UI for Jenkins and click on Create a job

  • Enter the name of your project and then select Freestyle Project

  • Give a description as per your requirement, click the check box of GitHub Projects and enter the repo URL from GitHub.

  • Select Git as a Source Code Management and specify the branch name as shown.

  • Go to Build Steps, select Execute shell and enter the following commands to build an image, run a container from that image and save the job.

  • Make sure jenkins user has been added to the docker group If it has not been added below error shows

  • To overcome this use as follows and reboot the system

  • Finally after rebooting system build is successful.

  • Check your application

Task 2-

In this task, we'll run the nginx web page with the help of docker-compose and Jenkins. Let's started

  • Create docker-compose.yml file

  • We have to change the executable shell command as shown below otherwise all the previous steps are the same. To make changes go to dashboard>select project>configure>Build Steps>Execute Shell then make changes as shown below.

  • Build Now

  • Your application is up and running. Access it on port 8000

This is a simple project with Jenkins using docker and docker-compose.

We'll dig in depth into Jebkin's advanced topics in the next challenges. Keep practising......

Thank you so much for taking the time to read till the end! Hope you found this blog informative.

Feel free to explore more of my content, and don't hesitate to reach out if need any assistance from me or in case of you have any questions.

Find me on:- Hashnode LinkedIn Github

Happy Learning!