Jenkins Freestyle Project for DevOps Engineers

Jenkins Freestyle Project for DevOps Engineers

In the dynamic world of software development, Continuous Integration and Continuous Deployment (CI/CD) practices play a pivotal role in streamlining the development process.

What is CI/CD?

CI/CD, or Continuous Integration/Continuous Deployment, is a set of practices and tools used by DevOps teams to automate the process of integrating code changes, testing them, and deploying them to production environments swiftly and efficiently.

What Is a Build Job?

A build job in Jenkins refers to the automated process of compiling, testing, and packaging code changes into a deployable artifact, such as a software application or a container image.

What is Freestyle Projects?

Freestyle projects in Jenkins provide a flexible way to create custom build jobs tailored to specific project requirements. They offer a wide range of configurations and options, allowing developers and DevOps engineers to define build steps, triggers, and post-build actions according to their project needs.


Now, let's delve into the practical aspect of setting up a Jenkins freestyle project for your application.

Task 1: Setting Up a Jenkins Freestyle Project

  1. Create a New Jenkins Freestyle Project: Begin by logging into your Jenkins dashboard and creating a new freestyle project for your application. Name the project and configure basic settings.

  2. Configure Build Steps: In the "Build" section of your project configuration, add build steps to execute necessary tasks. For instance, to build a Docker image for your application, add a build step to run the "docker build" command.

  3. Start Container Using Docker Run Command: After building the Docker image, add a second build step to run the "docker run" command. This command will start a container using the image created in the previous step.

By following these steps, you've successfully configured a Jenkins freestyle project for your application, integrating Docker-based build and deployment processes into your CI/CD pipeline.


Task 2: Configuring Build Steps

Add a build step to execute the "docker-compose up -d" command. In the project configuration, scroll down to the "Build" section and click on "Add build step". Select "Execute shell" and input the command: docker-compose up -d.

This command triggers the deployment process of your containers in detached mode, allowing Jenkins to continue its workflow uninterrupted.