Skip to main content

Command Palette

Search for a command to run...

Day 22: Getting Started with Jenkins 😃

DevOps Learning

Updated
3 min read
Day 22: Getting Started with Jenkins 😃

What is Jenkins?

  • Jenkins is an open-source automation server that facilitates continuous integration (CI) and continuous delivery (CD) processes. It helps development teams build, test, and deploy their software efficiently.

  • Here are the key points about Jenkins:

  1. Continuous Integration (CI):

    • CI is a software development practice where code changes are automatically built, tested, and integrated into a shared repository.

    • Jenkins automates this process, ensuring that code changes are continuously validated.

  2. Continuous Delivery (CD):

    • CD extends CI by automating the deployment process.

    • Jenkins can deploy applications to various environments (staging, production) based on predefined rules.

  3. Features of Jenkins:

    • Extensibility: Jenkins has a vast plugin ecosystem, allowing you to customize and extend its functionality.

    • Distributed Builds: Jenkins supports master-slave architecture, enabling parallel execution across multiple nodes.

    • Pipeline as Code: Jenkins Pipeline allows defining build and deployment pipelines using code (Jenkinsfile).

    • Wide Language Support: Jenkins works with various programming languages and tools.

    • Monitoring and Reporting: Jenkins provides logs, test reports, and build statistics.

  4. Getting Started with Jenkins:

    Follow the instructions mentioned on the Jenkins official page to install Jenkins on your system.

  5. Create Basic pipeline on Jenkins:

    1. Log into Jenkins:

      • Open your web browser and navigate to your Jenkins instance (usually at http://localhost:8080 if running locally).
    2. Create a New Pipeline Job:

      • Click on “New Item” on the Jenkins dashboard.

      • Enter a name for your pipeline job (e.g., “My-First-Pipeline”).

      • Select “Pipeline” from the list of item types.

      • Click “OK.”

    3. Configure Your Pipeline:

      • In the configuration screen for your new pipeline job:

        • You can skip the other checkboxes for now since we are creating a very basic pipeline. However, I recommend exploring these options as you build more complex pipelines. 🙂

        • Under the “Pipeline” section, choose the “Pipeline script” option.

        • In the script text area, you can enter your pipeline definition using the Groovy-based DSL (Domain-Specific Language).

        • For a basic example, you can start with a simple script like this:

            pipeline {
                agent any
                stages {
                    stage('Hello') {
                        steps {
                            echo 'Hello, Jenkins!'
                        }
                    }
                }
            }
          
        • Click “Save” to save your pipeline configuration.

    4. Run Your Pipeline:

      • Click on “Build Now” to manually trigger your pipeline.

      • Jenkins will execute the defined stages in your pipeline script.

      • You’ll see the output in the Jenkins console log.

    5. View Pipeline Results:

      • After the pipeline completes, you can view the results, logs, and any errors in the Jenkins UI.

    6. Customize and Extend:

      • As you get more comfortable with Jenkins pipelines, you can add more stages, integrate with version control systems, and automate deployment steps.
  6. Use Cases for Jenkins:

    • Building and testing applications automatically.

    • Deploying applications to various environments.

    • Running scheduled jobs (e.g., backups, data synchronization).

  7. Real-World Impact:

    • Many organizations use Jenkins to improve development efficiency, reduce manual tasks, and enhance software quality.

Remember that Jenkins is a powerful tool, and its flexibility allows you to adapt it to your specific needs. Explore Jenkins, experiment with pipelines, and enjoy the benefits of automated software delivery! 🚀

Thank you for reading😉.