Giter Club home page Giter Club logo

jenkins's Introduction

What is CICD? and why we need CICD and introduction to CICD. some standard steps that every organization follows are: Unit testing Static code analysis Code qality/vulnerability Automation Reports deployments

code pushesh to github and after that rest will proceed like building the code testing and deploying. Jenkins have a feature or custome like way to delpoy code in multiple environments Dev,Stg and Prod.

We have github actions that is advance as we don't need to keep running infrastructe always.

How to explain the CI/CD process implementation

user-> git->git trigger webhook to jenkins pipeline->jenkins->Continuous integration will start here-> code checkout,build & UT, code scan,sonar or any other solutons,image build,image scan,image registry,after that we can update the manifest files or helm chart with new image-> can use argocd to deploy in the kubernetes platform.

Jenkins live project to implement above cicd flow.

follow the github repo for more. So the latest approach for using jenkins is one jenkins master and agent as docker container as containers are ephemeral in nature.

whenever you install any plugin jenkins will run jobs in the configured agent and it is always recommended to restart jenkins whenever plugin is installed.

Simple pipeline to check the docker images: pipeline{ agent { docker { image 'Hello-World' } } stages{ stage ('Verify docker agent'){ steps{ sh 'node --version' }

    }
}

}

This is multi-tier pipeline script

pipeline { agent none stages { stage('Back-end') { agent { docker { image 'maven:3.8.1-adoptopenjdk-11' } } steps { sh 'mvn --version' } } stage('Front-end') { agent { docker { image 'node:16-alpine' } } steps { sh 'node --version' } } } }

for deployinig to kubernetes cluster

pipeline {

agent any 

environment {
    IMAGE_TAG = "${BUILD_NUMBER}"
}

stages {
    
    stage('Checkout'){
       steps {
            git credentialsId: 'f87a34a8-0e09-45e7-b9cf-6dc68feac670', 
            url: 'https://github.com/iam-veeramalla/cicd-end-to-end',
            branch: 'main'
       }
    }

    stage('Build Docker'){
        steps{
            script{
                sh '''
                echo 'Buid Docker Image'
                docker build -t abhishekf5/cicd-e2e:${BUILD_NUMBER} .
                '''
            }
        }
    }

    stage('Push the artifacts'){
       steps{
            script{
                sh '''
                echo 'Push to Repo'
                docker push abhishekf5/cicd-e2e:${BUILD_NUMBER}
                '''
            }
        }
    }
    
    stage('Checkout K8S manifest SCM'){
        steps {
            git credentialsId: 'f87a34a8-0e09-45e7-b9cf-6dc68feac670', 
            url: 'https://github.com/iam-veeramalla/cicd-demo-manifests-repo.git',
            branch: 'main'
        }
    }
    
    stage('Update K8S manifest & push to Repo'){
        steps {
            script{
                withCredentials([usernamePassword(credentialsId: 'f87a34a8-0e09-45e7-b9cf-6dc68feac670', passwordVariable: 'GIT_PASSWORD', usernameVariable: 'GIT_USERNAME')]) {
                    sh '''
                    cat deploy.yaml
                    sed -i '' "s/32/${BUILD_NUMBER}/g" deploy.yaml
                    cat deploy.yaml
                    git add deploy.yaml
                    git commit -m 'Updated the deploy yaml | Jenkins Pipeline'
                    git remote -v
                    git push https://github.com/iam-veeramalla/cicd-demo-manifests-repo.git HEAD:main
                    '''                        
                }
            }
        }
    }
}

}

jenkins's People

Contributors

bikennepal avatar

Watchers

James Cloos avatar  avatar

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.