Skip to content

aayushave/jenkins-global

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Jenkins Global Library for Asynchronous CI/CD

Jenkins

Description

This repository contains a Jenkins Global Library designed for creating asynchronous Continuous Integration and Continuous Deployment (CI/CD) pipelines. The library provides reusable functions and tools that streamline the development and deployment processes in Jenkins, promoting best practices and improving workflow efficiency.

Key Features

  • Modular functions for building, testing, and deploying applications.
  • Support for asynchronous execution of pipeline stages.
  • Customizable configuration options for various environments.
  • Comprehensive logging and error handling.

Table of Contents

  1. Getting Started
  2. Installation
  3. Usage
  4. Configuration
  5. Contributing
  6. License
  7. Acknowledgments

Getting Started

Prerequisites

Before you begin, ensure you have the following installed:

  • Jenkins: Version 2.x or higher.
  • Git: For version control.
  • Docker: If using Docker-related functions.
  • Access: Permissions to configure Jenkins and install plugins.

Adding the Global Library to Jenkins

  1. Navigate to Manage Jenkins > Configure System.
  2. Scroll to the Global Pipeline Libraries section.
  3. Click Add:
    • Name: async-cicd-library
    • Retrieval Method: Modern SCM
    • Source Code Management: Select Git.
    • Project Repository: https://github.com/yourusername/your-repo.git
    • Branch: Specify the branch (e.g., main).

Installation

To integrate this library into your Jenkins pipeline, add the following line at the top of your Jenkinsfile:

@Library('async-cicd-library') _

Usage

Example Pipeline

Here’s a simple example of a Jenkins pipeline using the global library:

@Library('async-cicd-library') _

pipeline {
    agent any

    stages {
        stage('Build') {
            steps {
                script {
                    buildImage('my-docker-image')
                }
            }
        }
        stage('Test') {
            steps {
                script {
                    runTests('my-test-suite')
                }
            }
        }
        stage('Deploy') {
            steps {
                script {
                    deployToEnvironment('production')
                }
            }
        }
    }

    post {
        always {
            archiveArtifacts artifacts: '**/target/*.jar', allowEmptyArchive: true
            junit '**/target/test-*.xml'
        }
    }
}

About

Shared Libraries for Jenkins

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages