Jenkins is an open-source automation server that facilitates continuous integration and continuous deployment (CI/CD) of applications.

What is Jenkins?

Jenkins is an automation tool that allows building, testing, and deploying applications continuously, integrating multiple development tools.

Jenkins Architecture

Main Components

  • Master Node: Main control node
  • Agent Nodes: Executor nodes
  • Jobs: Automated tasks
  • Pipelines: Complex workflows
  • Plugins: Functionality extensions

Job Types

  • Freestyle Projects: Free projects
  • Pipeline Projects: Pipeline projects
  • Multibranch Pipelines: Multi-branch pipelines
  • Folder Projects: Project organization

Pipeline as Code

Declarative Pipeline

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
pipeline {
    agent any
    stages {
        stage('Build') {
            steps {
                sh 'mvn clean compile'
            }
        }
        stage('Test') {
            steps {
                sh 'mvn test'
            }
        }
        stage('Deploy') {
            steps {
                sh 'mvn deploy'
            }
        }
    }
}

Scripted Pipeline

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
node {
    stage('Build') {
        sh 'mvn clean compile'
    }
    stage('Test') {
        sh 'mvn test'
    }
    stage('Deploy') {
        sh 'mvn deploy'
    }
}

Integration with Tools

Version Control

  • Git: Integration with Git repositories
  • GitHub: Integration with GitHub
  • GitLab: Integration with GitLab
  • Bitbucket: Integration with Bitbucket

Containers

  • Docker: Image building
  • Kubernetes: Deployment in K8s
  • Docker Compose: Local orchestration

Cloud Platforms

  • AWS: Deployment in AWS
  • Azure: Deployment in Azure
  • GCP: Deployment in Google Cloud

References