Labs ICT
⭐ Pro Login

Jenkins

Automating builds and pipelines with the leading open-source CI server

Jenkins

Jenkins is the most widely used open-source automation server. It enables building, testing, and deploying through plugins and pipeline-as-code with Jenkinsfile.

Jenkins Architecture


  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
  β”‚   Jenkins    │────▢│   Build      β”‚
  β”‚   Master     β”‚     β”‚   Agent 1    β”‚
  β”‚              │────▢│   Agent 2    β”‚
  β”‚  - Schedules β”‚     β”‚   Agent 3    β”‚
  β”‚  - Dashboard β”‚     β”‚              β”‚
  β”‚  - Config    β”‚     β”‚  (Workers)   β”‚
  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
       Master-Agent architecture for scalability

Jenkinsfile (Declarative Pipeline)


  pipeline {
      agent any

      stages {
          stage('Checkout') {
              steps {
                  git 'https://github.com/user/app.git'
              }
          }

          stage('Build') {
              steps {
                  sh 'npm install'
                  sh 'npm run build'
              }
          }

          stage('Test') {
              steps {
                  sh 'npm test'
              }
          }

          stage('Deploy') {
              steps {
                  sh 'docker build -t myapp:latest .'
                  sh 'docker push myapp:latest'
                  sh 'kubectl apply -f k8s/'
              }
          }
      }

      post {
          failure {
              mail to: 'team@example.com',
                   subject: "Build Failed: ${currentBuild.fullDisplayName}"
          }
      }
  }

Key Jenkins Concepts

  • Pipeline β€” Automated workflow defined as code (Jenkinsfile)
  • Stages β€” Logical divisions of the pipeline (Build, Test, Deploy)
  • Steps β€” Individual tasks within a stage
  • Agents β€” Machines that execute the pipeline
  • Plugins β€” 1800+ plugins for integrations (GitHub, Docker, Slack, etc.)

πŸ§ͺ Quick Quiz

What is a Jenkinsfile?