DEVOPS CI-CD
PIPELINE WITH
CONTAINERS
Priyanka Dive
WHO AM I ?
➤ Devops Engineer currently working at PCCW Solutions Singapore
➤ Have 4+ years experience
➤ Author of “Devops for Salesforce”
➤ Someone who like to learn something new everyday
➤ Linkedin : https://www.linkedin.com/in/priyanka-dive23/
CONTENT
➤ What is Devops ?
➤ Can “Dev & Ops” work together ?
➤ Docker & Kubernetes
➤ Devops Practices & Technologies
➤ Source code management with Gitlab
➤ Continuous Integration & Continuous
Deployment
➤ Example of Jenkins Pipeline
➤ Pipeline concepts
➤ Code Analysis
➤ Demo of Sample CI-CD
WHAT IS DEVOPS ?
➤ “DevOps (development and operations) is an enterprise software
development phrase used to mean a type of agile relationship between
development and IT operations.
➤ The goal of DevOps is to change and improve the relationship by advocating
better communication and collaboration between these two business units.”
➤ Cultural change in organization
➤ Developers & Operations Team working together with responsibility
CAN “DEV & OPS” WORK TOGETHER ?
➤ Developer Team: It’s working on my local
➤ Operations Team : Build/deployment failed in production
➤ Can we work together (Dev+Ops)
Devops :
1. Similar environments for all (Dev, Test, Stage, Production)
2. Can we automate everything (integration, code analysis,
deployment, infrastructure)
3. Extend helping hand to each other
DOCKER & KUBERNETES…
➤ “Docker is a set of platform-as-a-service products that use
operating-system-level virtualisation to deliver software in
packages called containers.”
➤ Build : Building and deploying new applications is faster with
containers.
➤ Ship : Push it to container registry
➤ Run Anywhere : Different environments dev, test, stage, prod
➤ Docker containers: Code + Dependancies/libraries to run
code
KUBERNETES
➤ “Kubernetes (K8s) is an open-source system for automating
deployment, scaling, and management of containerised
applications.”
➤ Containers + Orchestration = Docker + Kubernetes
➤ Run Anywhere : on-premises, hybrid, or public cloud
infrastructure
➤ There are multiple orchestrators available like Mesos, Docker
Swarm, etc
Devops Practices & Technologies
➤ Automate Provisioning with Infrastructure as a Code
➤ Continuous Build : build for every commit
➤ Continuous Integration
➤ Code Analysis
➤ Continuous Testing
➤ Continuous Delivery
➤ Automated Release Management
➤ Monitoring / Log management
SOURCE CODE MANAGEMENT WITH
GITLAB➤ Why versioning ?
➤ Source Code Management : “Source code management
enables coordination, sharing and collaboration across the
entire software development team. Track and merge
branches, audit changes and enable concurrent work, to
accelerate software delivery.”
➤ Tracking changes looks like finding “a needle in a haystack”
➤ Branching Strategy : development, test ,stage, master
➤ Feature branches & Hot-Fixes
➤ Link : http://localhost
CONTINUOUS INTEGRATION &
CONTINUOUS DELIVERY …➤ “continuous integration (CI) is the practice of merging all
developers' working copies to a shared mainline several times
a day”
➤ Integration with version control (Git)
➤ Build automation (Jenkins, gitlab-ci, Drone-ci, etc) : Build for
every code commit
➤ Run Tests :
➤ Unit Tests, Integration tests (selenium)
➤ Test code in similar environment like production
CONTINUOUS INTEGRATION &
CONTINUOUS DELIVERY➤ “A continuous delivery (CD) pipeline is an automated
expression of your process for getting software from version
control right through to your users and customers.”
➤ Jenkins Pipeline helps us in implementing and
integrating continuous delivery pipelines into Jenkins.
➤ Automating Deployments
➤ See results per Commit (Track errors in code, test,
deployment, security, etc)
➤ Delivery pipelines "as code” : Jenkinsfile
➤ Link: http://localhost/root/devops-ci-cd-demo/blob/master/Jenkinsfile
EXAMPLE OF JENKINS PIPELINE
Pipeline concepts
➤ Pipeline : A Pipeline is a user-defined model of a CD pipeline.
Definition of your build with multiple stages of your application
like build ,test, deliver.
➤ Node : A node is where all stages of your pipeline will run.
➤ Stage : A Stage is set of tasks which we need to run for entire
pipeline (e.g. "Build", "Test" and "Deploy" stages). Also used for
showing progress of individual.
➤ Step : A single task. Fundamentally, a step tells Jenkins what to
do at a particular point in time (or "step" in the process).
➤ For example, to execute the shell command make use
the sh step: sh 'make'.
CODE ANALYSIS
➤ SonarQube is an open-source tool for continuous inspection of
code quality.
➤ What it Does:
1. Static analysis of code
2. Detect bugs, code smells
3. Security vulnerabilities
4. Report duplicate code , unit test, code coverage ,
etc
➤ Can be integrated with multiple CI tools like Jenkins, gitlab-ci ,
etc
DEMO OF SAMPLE CI-CD
➤ Deploying sample nodejs application with CI-CD using Gitlab ,
Jenkins (CI-CD) on Kubernetes
➤ Everything is on local machine
➤ Gitlab: http://localhost/
➤ Jenkins: http://localhost:8080
➤ Sonarqube: http://localhost:9000
“Continuous Improvement …
REFERENCE
➤ https://www.webopedia.com/TERM/D/devops_development_operations.html
➤ https://www.docker.com/
➤ https://kubernetes.io/
➤ https://jenkins.io/doc/tutorials/build-a-node-js-and-react-app-with-npm/
➤ https://docs.sonarqube.org/latest/
THANK YOU…

Devops CI-CD pipeline with Containers

  • 1.
  • 2.
    WHO AM I? ➤ Devops Engineer currently working at PCCW Solutions Singapore ➤ Have 4+ years experience ➤ Author of “Devops for Salesforce” ➤ Someone who like to learn something new everyday ➤ Linkedin : https://www.linkedin.com/in/priyanka-dive23/
  • 3.
    CONTENT ➤ What isDevops ? ➤ Can “Dev & Ops” work together ? ➤ Docker & Kubernetes ➤ Devops Practices & Technologies ➤ Source code management with Gitlab ➤ Continuous Integration & Continuous Deployment ➤ Example of Jenkins Pipeline ➤ Pipeline concepts ➤ Code Analysis ➤ Demo of Sample CI-CD
  • 4.
    WHAT IS DEVOPS? ➤ “DevOps (development and operations) is an enterprise software development phrase used to mean a type of agile relationship between development and IT operations. ➤ The goal of DevOps is to change and improve the relationship by advocating better communication and collaboration between these two business units.” ➤ Cultural change in organization ➤ Developers & Operations Team working together with responsibility
  • 5.
    CAN “DEV &OPS” WORK TOGETHER ? ➤ Developer Team: It’s working on my local ➤ Operations Team : Build/deployment failed in production ➤ Can we work together (Dev+Ops) Devops : 1. Similar environments for all (Dev, Test, Stage, Production) 2. Can we automate everything (integration, code analysis, deployment, infrastructure) 3. Extend helping hand to each other
  • 6.
    DOCKER & KUBERNETES… ➤“Docker is a set of platform-as-a-service products that use operating-system-level virtualisation to deliver software in packages called containers.” ➤ Build : Building and deploying new applications is faster with containers. ➤ Ship : Push it to container registry ➤ Run Anywhere : Different environments dev, test, stage, prod ➤ Docker containers: Code + Dependancies/libraries to run code
  • 7.
    KUBERNETES ➤ “Kubernetes (K8s)is an open-source system for automating deployment, scaling, and management of containerised applications.” ➤ Containers + Orchestration = Docker + Kubernetes ➤ Run Anywhere : on-premises, hybrid, or public cloud infrastructure ➤ There are multiple orchestrators available like Mesos, Docker Swarm, etc
  • 8.
    Devops Practices &Technologies ➤ Automate Provisioning with Infrastructure as a Code ➤ Continuous Build : build for every commit ➤ Continuous Integration ➤ Code Analysis ➤ Continuous Testing ➤ Continuous Delivery ➤ Automated Release Management ➤ Monitoring / Log management
  • 9.
    SOURCE CODE MANAGEMENTWITH GITLAB➤ Why versioning ? ➤ Source Code Management : “Source code management enables coordination, sharing and collaboration across the entire software development team. Track and merge branches, audit changes and enable concurrent work, to accelerate software delivery.” ➤ Tracking changes looks like finding “a needle in a haystack” ➤ Branching Strategy : development, test ,stage, master ➤ Feature branches & Hot-Fixes ➤ Link : http://localhost
  • 10.
    CONTINUOUS INTEGRATION & CONTINUOUSDELIVERY …➤ “continuous integration (CI) is the practice of merging all developers' working copies to a shared mainline several times a day” ➤ Integration with version control (Git) ➤ Build automation (Jenkins, gitlab-ci, Drone-ci, etc) : Build for every code commit ➤ Run Tests : ➤ Unit Tests, Integration tests (selenium) ➤ Test code in similar environment like production
  • 11.
    CONTINUOUS INTEGRATION & CONTINUOUSDELIVERY➤ “A continuous delivery (CD) pipeline is an automated expression of your process for getting software from version control right through to your users and customers.” ➤ Jenkins Pipeline helps us in implementing and integrating continuous delivery pipelines into Jenkins. ➤ Automating Deployments ➤ See results per Commit (Track errors in code, test, deployment, security, etc) ➤ Delivery pipelines "as code” : Jenkinsfile ➤ Link: http://localhost/root/devops-ci-cd-demo/blob/master/Jenkinsfile
  • 12.
  • 13.
    Pipeline concepts ➤ Pipeline: A Pipeline is a user-defined model of a CD pipeline. Definition of your build with multiple stages of your application like build ,test, deliver. ➤ Node : A node is where all stages of your pipeline will run. ➤ Stage : A Stage is set of tasks which we need to run for entire pipeline (e.g. "Build", "Test" and "Deploy" stages). Also used for showing progress of individual. ➤ Step : A single task. Fundamentally, a step tells Jenkins what to do at a particular point in time (or "step" in the process). ➤ For example, to execute the shell command make use the sh step: sh 'make'.
  • 15.
    CODE ANALYSIS ➤ SonarQubeis an open-source tool for continuous inspection of code quality. ➤ What it Does: 1. Static analysis of code 2. Detect bugs, code smells 3. Security vulnerabilities 4. Report duplicate code , unit test, code coverage , etc ➤ Can be integrated with multiple CI tools like Jenkins, gitlab-ci , etc
  • 16.
    DEMO OF SAMPLECI-CD ➤ Deploying sample nodejs application with CI-CD using Gitlab , Jenkins (CI-CD) on Kubernetes ➤ Everything is on local machine ➤ Gitlab: http://localhost/ ➤ Jenkins: http://localhost:8080 ➤ Sonarqube: http://localhost:9000
  • 17.
  • 18.
    REFERENCE ➤ https://www.webopedia.com/TERM/D/devops_development_operations.html ➤ https://www.docker.com/ ➤https://kubernetes.io/ ➤ https://jenkins.io/doc/tutorials/build-a-node-js-and-react-app-with-npm/ ➤ https://docs.sonarqube.org/latest/
  • 19.