Skip to content

this repo is to practice my jenkins knowledge as well as to automate pipelines.

License

Notifications You must be signed in to change notification settings

kovendhan5/jenkins

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Jenkins Repository

Welcome to the Jenkins repository! This project focuses on setting up, managing, and demonstrating the capabilities of Jenkins for Continuous Integration and Continuous Deployment (CI/CD) pipelines.

Table of Contents

Introduction

Jenkins is an open-source automation server that helps automate parts of the software development process. This repository demonstrates how to:

  • Set up Jenkins on various environments.
  • Configure jobs for building, testing, and deploying applications.
  • Secure and optimize Jenkins.

About Me the Author

Hi, I'm Kovendhan! I am currently learning about Jenkins and exploring its real-time applications. As part of my journey, I created this repository to document my learning process and share practical examples and setups with others. I hope this helps anyone looking to get started with Jenkins.

Pipeline Overview The pipeline is configured with the following stages:

  1. Clone Repository: Clones the GitHub repository to the Jenkins workspace.
  2. Build: Uses Maven to clean and install the project.
  3. Test: Runs Maven tests to ensure the application works as expected.
  4. Build Docker Image: Builds a Docker image from the project using the Dockerfile.
  5. Deploy to Staging: Deploys the Docker container in a staging environment on port 8081.
  6. Deploy to Production: Deploys the Docker container in the production environment on port 8080 after manual approval.

Achievements

  • First Successful Pipeline: This is my first pipeline that has successfully completed all stages, with the output displayed as "Hello, World!" in the logs. The container runs correctly and can be accessed on the specified ports.
  • Production-Ready: The same pipeline configuration can now be used to deploy the application to production.

Features

  • Setup Instructions: Detailed steps to install and configure Jenkins.
  • Pipeline Examples: Ready-to-use Jenkins pipeline scripts (Declarative and Scripted).
  • Integration: Examples of integrations with GitHub, Docker, Kubernetes, and other tools.
  • Security Guidelines: Steps to secure your Jenkins instance.

Prerequisites

Ensure you have the following before proceeding:

  • Java Development Kit (JDK): Version 8 or higher.
  • Jenkins War File or Installer: Download here.
  • Supported Browser: For accessing the Jenkins UI.
  • Admin Access: Permissions to install software and configure Jenkins on your machine/server.

Installation

  1. Install Java

    sudo apt update
    sudo apt install openjdk-11-jdk
  2. Download Jenkins

    wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add -
    sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
    sudo apt update
    sudo apt install jenkins
  3. Start Jenkins

    sudo systemctl start jenkins
  4. Access Jenkins Open your browser and navigate to http://<your-server-ip>:8080.

Usage

Creating Your First Pipeline

  1. Open Jenkins and navigate to New Item.
  2. Select Pipeline and name your project.
  3. Configure the pipeline using a Jenkinsfile or by writing inline pipeline code.
  4. Save and run the pipeline.

Sample Declarative Pipeline

pipeline {
    agent any
    stages {
        stage('Build') {
            steps {
                echo 'Building...'
            }
        }
        stage('Test') {
            steps {
                echo 'Testing...'
            }
        }
        stage('Deploy') {
            steps {
                echo 'Deploying...'
            }
        }
    }
}

Configuration

  • Plugins: Add plugins based on your requirements (e.g., GitHub, Docker, Kubernetes).
  • Security: Set up an admin user, configure authentication and authorization, and enable CSRF protection.
  • Backup: Use the thinBackup plugin or manually back up Jenkins configurations and job directories.

Contributing

Contributions are welcome! Follow these steps:

  1. Fork this repository.
  2. Create a new branch for your feature/bug fix.
  3. Commit your changes and push to your fork.
  4. Submit a pull request.

License

This repository is licensed under the MIT License. See the LICENSE file for details.

About

this repo is to practice my jenkins knowledge as well as to automate pipelines.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published