Day 23 Jenkins Freestyle Project for DevOps Engineers.

Day 23 Jenkins Freestyle Project for DevOps Engineers.

Β·

4 min read

Day 23 of #90daysofdevops

Hey Techies! Welcome to this blog

In this blog, we are going to start Jenkins Freestyle Project.

What is CI/CD?

CI stands for Continous Integration: CI is a software development practice in which frequent and isolated changes are immediately tested and reported on when they're added to a larger codebase. In CI, software developers regularly merge small code changes into a central repository, where automated code builds and tests are then run. Newly developed code is sent to a shared repository using a version control system, like Git. CI aims to provide rapid feedback so that, when a defect is introduced into the codebase, it's identified and corrected as soon as possible. Additionally, this practice makes the software development process faster and more predictable by working in small iterations.

CD stands for Continuous Delivery: CD automates the release of validated code to a repository following the automation of builds and unit and integration testing in CI. So, in order to have an effective continuous delivery process, CI must be already built into your development pipeline.

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 Freestyle Projects ?? πŸ€”

A freestyle project in Jenkins is a type of project that allows you to build, test, and deploy software using a variety of different options and configurations. Here are a few tasks that you could complete when working with a freestyle project in Jenkins:

Task-01

  • create an agent for your app. ( which you deployed from docker in the earlier task)

  • Create a new Jenkins freestyle project for your app.

  • In the "Build" section of the project, add a build step to run the "docker build" command to build the image for the container.

  • Add a second step to run the "docker run" command to start a container using the image created in step 3.

Let's start

First setup Jenkins on our server...

We have setup Jenkins in previous blog go checkout.

Now create a freestyle project

I have cloned the GitHub repos GitHub Repo

Gave the branch name correctly..

Click on build now. And now check in the terminal..

Now check whether it's clone or not.

Next we have to run the app using "docker run" command.

Before that make sure docker is installed in your server.

As well as also give the user permission to docker of Jenkins by sudo usermod -aG docker jenkins

Now Build

To check the port number where the container is running use docker ps

Please add a rule in your instance security group port number.

Port-8000

Done πŸŽ‰

Task-02

  • Create Jenkins project to run the "docker-compose up -d" command to start the multiple containers defined in the compose file (Hint- use day-19 Application & Database docker-compose file)

  • Set up a cleanup step in the Jenkins project to run the "docker-compose down" command to stop and remove the containers defined in the compose file.

Now, Build the project.

After a build is completed, you can view the console output.

Before this build make sure you delete the container, image and make the port 8000 empty.

Docker container is created.

Now Browse, publicip:8000

That's it! You've just created your first Jenkins freestyle pipeline. πŸŽ‰

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

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.

Happy Learning!

~kritika :)

Connect with me: linkedin.com/in/kritikashaw

Β