๐Ÿ› ๏ธDay 23 - Jenkins Freestyle Project for DevOps Engineers

ยท

3 min read

๐Ÿ› ๏ธDay 23 - Jenkins Freestyle Project for DevOps Engineers

Welcome back to another exciting day of your DevOps journey! In today's session, we'll dive into Jenkins Freestyle Projects and how they play a crucial role in Continuous Integration/Continuous Deployment (CI/CD) pipelines. Specifically, we'll focus on orchestrating Dockerized applications using Jenkins and Docker-compose.

What is CI/CD? ๐Ÿš€

CI/CD stands for Continuous Integration/Continuous Deployment. It's a set of practices and principles used by development and operations teams to automate the process of building, testing, and deploying software applications. CI/CD aims to increase the speed, reliability, and quality of software delivery by automating repetitive tasks and providing rapid feedback to developers.

What Is a Build Job? ๐Ÿ—๏ธ

A build job is a task performed by a CI/CD system, such as Jenkins, to build, test, and package software applications. It typically involves compiling source code, running unit tests, and generating artifacts for deployment. Build jobs are essential components of CI/CD pipelines, as they enable automation and ensure that software changes are consistently built and validated.

What is Freestyle Projects? ๐Ÿ”„

Freestyle Projects in Jenkins are flexible, customizable build jobs that allow you to define build steps using a simple, point-and-click interface. With Freestyle Projects, you can execute shell commands, trigger builds based on events, and configure various build parameters. Freestyle Projects offer a wide range of options for building and deploying software, making them suitable for diverse CI/CD workflows.

Task-01: Creating an Agent and Freestyle Project for Dockerized Apps

Step 1: Create an Agent for Your App

agent {
    docker {
        image 'your_docker_image'
        args '-v /var/run/docker.sock:/var/run/docker.sock'
    }
}

Step 2: Create a Freestyle Project

Navigate to Jenkins dashboard -> New Item -> Enter item name -> Freestyle project.

Step 3: Add Build Steps for Docker Operations

Build Step 1: Docker Build

docker build -t your_image_name .

Build Step 2: Docker Run

docker run -d --name your_container_name your_image_name

Task-02: Orchestrating Containers with Docker-Compose

Step 1: Create Jenkins Project for Docker-Compose

agent any

stages {
    stage('Docker-Compose Up') {
        steps {
            sh 'docker-compose up -d'
        }
    }
    stage('Cleanup with Docker-Compose Down') {
        steps {
            sh 'docker-compose down'
        }
    }
}

Step 2: Add Build Steps for Docker-Compose Operations

Build Step 1: Docker-Compose Up

docker-compose up -d

Build Step 2: Cleanup with Docker-Compose Down

docker-compose down

With these tasks, you'll be able to create Jenkins Freestyle Projects for Dockerized applications and orchestrate containers using Docker-compose seamlessly. Keep exploring and experimenting with Jenkins to unleash its full potential in your CI/CD pipelines. Happy building! ๐Ÿ› ๏ธ

I think this blog will be quite valuable, offering unique viewpoints and introducing new and engaging ideas. ๐Ÿ™

๐Ÿ˜Š Happy learning!

ย