Giter Site home page Giter Site logo

salmanspice / bluegreendeploymentusingjenkins Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nashtech-labs/bluegreendeploymentusingjenkins

0.0 0.0 0.0 2 KB

It is a Parameterised Jenkinsfile that enables us to implement Blue/Green deployment using Kubernetes.

bluegreendeploymentusingjenkins's Introduction

Jenkins Pipeline for Blue-Green Deployment

This repository contains a Jenkinsfile that defines a Jenkins pipeline for blue-green deployment of a Dockerized application to a Kubernetes cluster.

Pipeline Stages

The pipeline consists of the following stages:

  1. Checkout Code: This stage checks out the source code from the version control system.

  2. Build and Push Docker Image: This stage builds a Docker image of the application and pushes it to Docker Hub. The image is tagged with the selected deployment environment (blue or green) and the build number.

  3. Deploy to Kubernetes: This stage applies the Kubernetes deployment file for the selected environment. This deploys the new version of the application to the inactive environment.

  4. Swap Environments: This stage updates the Kubernetes service to point to the new environment, effectively switching traffic from the old environment to the new environment.

Parameters

The pipeline has one parameter:

  • DEPLOY_ENV: The deployment environment (blue or green). This determines which environment the new version of the application is deployed to.

Environment Variables

The pipeline uses the following environment variables:

  • KUBECONFIG: The ID of the Jenkins credential that contains the kubeconfig file for the Kubernetes cluster.

  • DOCKERHUB_CREDENTIALS: The ID of the Jenkins credential that contains the Docker Hub username and password.

Usage

To use this pipeline, you need to have Jenkins installed and configured with the necessary plugins (Pipeline, Docker Pipeline, etc.). You also need to have a Kubernetes cluster and Docker Hub account.

To run the pipeline, follow these steps:

  1. Create a new Jenkins job and select 'Pipeline' as the job type.

  2. In the job configuration, select 'Pipeline script from SCM' and enter the URL of your Git repository.

  3. In the 'Script Path' field, enter the path to the Jenkinsfile in your repository.

  4. Save the job configuration and click 'Build with Parameters' to run the pipeline.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.