SlideShare a Scribd company logo
Steve Grunwell - stevegrunwell.com/slides/intro-to-ci-cd
php[tek] 2023
Build & Release Confidently with
Continuous Integration & Delivery
Steve Grunwell - stevegrunwell.com/slides/intro-to-ci-cd
What is CI/CD?
Steve Grunwell - stevegrunwell.com/slides/intro-to-ci-cd
Continuous Integration
• Run a series of scripts automatically, any time changes are pushed
• Continuously Integrate our changes
• Automated tests
• Coding standards
• Static code analysis
• ...et cetera
Steve Grunwell - stevegrunwell.com/slides/intro-to-ci-cd
Steve Grunwell - stevegrunwell.com/slides/intro-to-ci-cd
Dependencies & Artifacts
• Dependency management
• Anything that's generated for your app:
• Compiled and/or mini
fi
ed
fi
les
• Binaries
• Remember: source control should only worry about the source
Steve Grunwell - stevegrunwell.com/slides/intro-to-ci-cd
• Being able to deploy on-demand
• One-click deployments
• You can't forget a step if
everything's automatic!
Continuous Delivery
Steve Grunwell - stevegrunwell.com/slides/intro-to-ci-cd
Delivery
Some manual step to deploy
Deployment
Always Be Deployin'
Continuous Delivery v Deployment
Steve Grunwell - stevegrunwell.com/slides/intro-to-ci-cd
Steve Grunwell - stevegrunwell.com/slides/intro-to-ci-cd
Deploy with Confidence!
In order to deploy con
fi
dently,
we must have con
fi
dence in our tools.
Steve Grunwell - stevegrunwell.com/slides/intro-to-ci-cd
Setting up a CI/CD Pipeline
Steve Grunwell - stevegrunwell.com/slides/intro-to-ci-cd
• A route from development to
production
• Triggered by di
ff
erent events
(push, merge, etc.)
• Di
ff
erent branches may take
di
ff
erent paths
What is a Pipeline?
Photo by Christian Bass
Steve Grunwell - stevegrunwell.com/slides/intro-to-ci-cd
Popular CI/CD Providers
GitHub Jenkins
Deploybot
GitLab
Travis CI CircleCI Codeship
TeamCity
Steve Grunwell - stevegrunwell.com/slides/intro-to-ci-cd
Welcome to GitLab!
• Source code management tool
• Hosted platform or available for private installation
• Includes CI/CD tools!
Hi, Fatima!
Steve Grunwell - stevegrunwell.com/slides/intro-to-ci-cd
GitLab CI/CD Tools
• De
fi
ne multiple stages (build, test, deploy, etc.)
• Each stage has one or more jobs
• Multiple runners == run jobs in parallel!
Steve Grunwell - stevegrunwell.com/slides/intro-to-ci-cd
A Typical Pipeline
Con
fi
gured in .gitlab-ci.yml
Steve Grunwell - stevegrunwell.com/slides/intro-to-ci-cd
Install npm dependencies:
stage: build
script:
- npm install --no-progress
- npm run prod
artifacts:
paths:
- public
cache:
key:
files:
- package-lock.json
paths:
- node_modules
A Simple Job IT AIN'T MUCH
BUT IT'S HONEST WORK
Steve Grunwell - stevegrunwell.com/slides/intro-to-ci-cd
Highly Configurable
docs.gitlab.com/ee/ci/yaml
• Specify a base Docker image
• Determine conditions under which jobs should run
• De
fi
ne dependencies between jobs
• Pre/post-script hooks
• Dynamic environments
• Automatically tag new releases
Steve Grunwell - stevegrunwell.com/slides/intro-to-ci-cd
Environment Variables
Steve Grunwell - stevegrunwell.com/slides/intro-to-ci-cd
Simple Deployments
Steve Grunwell - stevegrunwell.com/slides/intro-to-ci-cd
What Does our Deployment Process
Look Like Right Now?
• (S)FTP?
• SSH + git pull?
• rsync?
• Docker?
Steve Grunwell - stevegrunwell.com/slides/intro-to-ci-cd
A Bare-Bones Deployment Method
1. Build the app
2. scp a tarball to production
3. rsync the
fi
les into the web root
Steve Grunwell - stevegrunwell.com/slides/intro-to-ci-cd
Archive, scp, and rsync
ship_to_production:
stage: deploy
script:
- tar -czf release.tgz dist/*
- scp release.tgz "${SSH_USER}@${PRODUCTION_SERVER}:/tmp"
- ssh "${SSH_USER}@${PRODUCTION_SERVER}" "cd /tmp 
&& tar -xzf release.tgz 
&& rsync release/ /var/www/html/"
Steve Grunwell - stevegrunwell.com/slides/intro-to-ci-cd
Atomic Deployments
releases/
Contains multiple, timestamped deployments
shared/
Data that should persist between deployments
current
Symlink to the current release in releases/, part of web root
Steve Grunwell - stevegrunwell.com/slides/intro-to-ci-cd
Atomic Deployments
# /var/www
releases/
+ 1563759801/ # Oldest
+ 1563759802/
+ 1563759803/ # Newest
shared/
+ logs/
+ uploads/
- .env
<= current symlink
Steve Grunwell - stevegrunwell.com/slides/intro-to-ci-cd
Atomic Deployments
stevegrunwell.com/blog/atomic-deployments-from-scratch
ship_to_production:
stage: deploy
script:
# 1. Create + scp tarball
# 2. Extract to /var/www/releases/{TIMESTAMP}
# 3. Symlink shared assets
# 4. Update the `current` symlink
# 5. Reload the web server
# 6. (Optional) Roll off older releases
Steve Grunwell - stevegrunwell.com/slides/intro-to-ci-cd
Extending Our Pipelines
Steve Grunwell - stevegrunwell.com/slides/intro-to-ci-cd
• Run multiple production
environments/servers
• Some active (blue), some idle
(green)
• Deploy to green
• Once ready, route tra
ffi
c to green
• Blue becomes idle
• In case of issues, re-route to blue
Blue-Green Deployments
Steve Grunwell - stevegrunwell.com/slides/intro-to-ci-cd
Automate Release Chores
Make your pipeline work for you!
• Automatically build Docker images for your app
• Generate + publish API documentation
• Code coverage reporting
• Webhooks
• If you can script it, you can do it!
Steve Grunwell - stevegrunwell.com/slides/intro-to-ci-cd
Remember: This Isn't Magic!
Steve Grunwell - stevegrunwell.com/slides/intro-to-ci-cd
Questions?
Steve Grunwell - stevegrunwell.com/slides/intro-to-ci-cd
Thank You!
Steve Grunwell
Sta
ff
Software Engineer, Mailchimp
joind.in/talk/8f583

More Related Content

PDF
Introduction to CICD
PDF
PDF
CI CD Pipeline Interview Questions PDF By ScholarHat
PPTX
introductiontocicdknolx-220210084710.pptx
PPTX
Build it, Test it, Ship it: Continuous Delivery at Turner Broadcasting System...
PPTX
Michigan IT Symposium 2017 - CI/CD Workflow Tutorial
PDF
Continuous Everything
PPTX
CI_CD_Pipelines_java_---Presentation.pptx
Introduction to CICD
CI CD Pipeline Interview Questions PDF By ScholarHat
introductiontocicdknolx-220210084710.pptx
Build it, Test it, Ship it: Continuous Delivery at Turner Broadcasting System...
Michigan IT Symposium 2017 - CI/CD Workflow Tutorial
Continuous Everything
CI_CD_Pipelines_java_---Presentation.pptx

Similar to ci cd presentation What is CI/CD?Continuous Integration (20)

PPTX
The eBay-Way Meetup IL - CI/CD with Microservices
PDF
Constant Contact SF's Road to CD
PPTX
Implementing-Continuous-Integration-and-Deployment-CICD-Pipelines.pptx
PDF
Continuous delivery @wcap 5-09-2013
PDF
Getting to Walk with DevOps
PDF
Top CI/CD Tools Every QA Automation Engineer Should Use
PDF
Dipping Your Toes Into Cloud Native Application Development
ODP
Continous Delivery of your Infrastructure
PPTX
CI CD OPS WHATHAVEYOU
PPTX
Webinar: “Continuous Delivery: il tuo primo passo verso il DevOps”
PPTX
RubyDay-Turin13_Nov_15
PPTX
CI-CD and DevOps with Ruby
PDF
Hyd virtual meetupslides11jul
PPTX
CI/CD
PDF
We thought we were doing continuous delivery and then...
ODP
Continuous Delivery of (y)our infrastructure.
PDF
Continuous Delivery
PDF
CI/CD (DevOps) 101
PDF
Pipeline as code for your infrastructure as Code
PDF
Always ready for release by Bogdan Costea
The eBay-Way Meetup IL - CI/CD with Microservices
Constant Contact SF's Road to CD
Implementing-Continuous-Integration-and-Deployment-CICD-Pipelines.pptx
Continuous delivery @wcap 5-09-2013
Getting to Walk with DevOps
Top CI/CD Tools Every QA Automation Engineer Should Use
Dipping Your Toes Into Cloud Native Application Development
Continous Delivery of your Infrastructure
CI CD OPS WHATHAVEYOU
Webinar: “Continuous Delivery: il tuo primo passo verso il DevOps”
RubyDay-Turin13_Nov_15
CI-CD and DevOps with Ruby
Hyd virtual meetupslides11jul
CI/CD
We thought we were doing continuous delivery and then...
Continuous Delivery of (y)our infrastructure.
Continuous Delivery
CI/CD (DevOps) 101
Pipeline as code for your infrastructure as Code
Always ready for release by Bogdan Costea
Ad

Recently uploaded (20)

PDF
O7-L3 Supply Chain Operations - ICLT Program
PPTX
Cell Types and Its function , kingdom of life
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PPTX
Cell Structure & Organelles in detailed.
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
Classroom Observation Tools for Teachers
PPTX
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
PDF
Pre independence Education in Inndia.pdf
PDF
Complications of Minimal Access Surgery at WLH
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PPTX
Institutional Correction lecture only . . .
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PPTX
Week 4 Term 3 Study Techniques revisited.pptx
PDF
RMMM.pdf make it easy to upload and study
PPTX
Final Presentation General Medicine 03-08-2024.pptx
O7-L3 Supply Chain Operations - ICLT Program
Cell Types and Its function , kingdom of life
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
Microbial diseases, their pathogenesis and prophylaxis
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
Cell Structure & Organelles in detailed.
Abdominal Access Techniques with Prof. Dr. R K Mishra
Classroom Observation Tools for Teachers
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
Pre independence Education in Inndia.pdf
Complications of Minimal Access Surgery at WLH
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
Institutional Correction lecture only . . .
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
102 student loan defaulters named and shamed – Is someone you know on the list?
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
Week 4 Term 3 Study Techniques revisited.pptx
RMMM.pdf make it easy to upload and study
Final Presentation General Medicine 03-08-2024.pptx
Ad

ci cd presentation What is CI/CD?Continuous Integration

  • 1. Steve Grunwell - stevegrunwell.com/slides/intro-to-ci-cd php[tek] 2023 Build & Release Confidently with Continuous Integration & Delivery
  • 2. Steve Grunwell - stevegrunwell.com/slides/intro-to-ci-cd What is CI/CD?
  • 3. Steve Grunwell - stevegrunwell.com/slides/intro-to-ci-cd Continuous Integration • Run a series of scripts automatically, any time changes are pushed • Continuously Integrate our changes • Automated tests • Coding standards • Static code analysis • ...et cetera
  • 4. Steve Grunwell - stevegrunwell.com/slides/intro-to-ci-cd
  • 5. Steve Grunwell - stevegrunwell.com/slides/intro-to-ci-cd Dependencies & Artifacts • Dependency management • Anything that's generated for your app: • Compiled and/or mini fi ed fi les • Binaries • Remember: source control should only worry about the source
  • 6. Steve Grunwell - stevegrunwell.com/slides/intro-to-ci-cd • Being able to deploy on-demand • One-click deployments • You can't forget a step if everything's automatic! Continuous Delivery
  • 7. Steve Grunwell - stevegrunwell.com/slides/intro-to-ci-cd Delivery Some manual step to deploy Deployment Always Be Deployin' Continuous Delivery v Deployment
  • 8. Steve Grunwell - stevegrunwell.com/slides/intro-to-ci-cd
  • 9. Steve Grunwell - stevegrunwell.com/slides/intro-to-ci-cd Deploy with Confidence! In order to deploy con fi dently, we must have con fi dence in our tools.
  • 10. Steve Grunwell - stevegrunwell.com/slides/intro-to-ci-cd Setting up a CI/CD Pipeline
  • 11. Steve Grunwell - stevegrunwell.com/slides/intro-to-ci-cd • A route from development to production • Triggered by di ff erent events (push, merge, etc.) • Di ff erent branches may take di ff erent paths What is a Pipeline? Photo by Christian Bass
  • 12. Steve Grunwell - stevegrunwell.com/slides/intro-to-ci-cd Popular CI/CD Providers GitHub Jenkins Deploybot GitLab Travis CI CircleCI Codeship TeamCity
  • 13. Steve Grunwell - stevegrunwell.com/slides/intro-to-ci-cd Welcome to GitLab! • Source code management tool • Hosted platform or available for private installation • Includes CI/CD tools! Hi, Fatima!
  • 14. Steve Grunwell - stevegrunwell.com/slides/intro-to-ci-cd GitLab CI/CD Tools • De fi ne multiple stages (build, test, deploy, etc.) • Each stage has one or more jobs • Multiple runners == run jobs in parallel!
  • 15. Steve Grunwell - stevegrunwell.com/slides/intro-to-ci-cd A Typical Pipeline Con fi gured in .gitlab-ci.yml
  • 16. Steve Grunwell - stevegrunwell.com/slides/intro-to-ci-cd Install npm dependencies: stage: build script: - npm install --no-progress - npm run prod artifacts: paths: - public cache: key: files: - package-lock.json paths: - node_modules A Simple Job IT AIN'T MUCH BUT IT'S HONEST WORK
  • 17. Steve Grunwell - stevegrunwell.com/slides/intro-to-ci-cd Highly Configurable docs.gitlab.com/ee/ci/yaml • Specify a base Docker image • Determine conditions under which jobs should run • De fi ne dependencies between jobs • Pre/post-script hooks • Dynamic environments • Automatically tag new releases
  • 18. Steve Grunwell - stevegrunwell.com/slides/intro-to-ci-cd Environment Variables
  • 19. Steve Grunwell - stevegrunwell.com/slides/intro-to-ci-cd Simple Deployments
  • 20. Steve Grunwell - stevegrunwell.com/slides/intro-to-ci-cd What Does our Deployment Process Look Like Right Now? • (S)FTP? • SSH + git pull? • rsync? • Docker?
  • 21. Steve Grunwell - stevegrunwell.com/slides/intro-to-ci-cd A Bare-Bones Deployment Method 1. Build the app 2. scp a tarball to production 3. rsync the fi les into the web root
  • 22. Steve Grunwell - stevegrunwell.com/slides/intro-to-ci-cd Archive, scp, and rsync ship_to_production: stage: deploy script: - tar -czf release.tgz dist/* - scp release.tgz "${SSH_USER}@${PRODUCTION_SERVER}:/tmp" - ssh "${SSH_USER}@${PRODUCTION_SERVER}" "cd /tmp && tar -xzf release.tgz && rsync release/ /var/www/html/"
  • 23. Steve Grunwell - stevegrunwell.com/slides/intro-to-ci-cd Atomic Deployments releases/ Contains multiple, timestamped deployments shared/ Data that should persist between deployments current Symlink to the current release in releases/, part of web root
  • 24. Steve Grunwell - stevegrunwell.com/slides/intro-to-ci-cd Atomic Deployments # /var/www releases/ + 1563759801/ # Oldest + 1563759802/ + 1563759803/ # Newest shared/ + logs/ + uploads/ - .env <= current symlink
  • 25. Steve Grunwell - stevegrunwell.com/slides/intro-to-ci-cd Atomic Deployments stevegrunwell.com/blog/atomic-deployments-from-scratch ship_to_production: stage: deploy script: # 1. Create + scp tarball # 2. Extract to /var/www/releases/{TIMESTAMP} # 3. Symlink shared assets # 4. Update the `current` symlink # 5. Reload the web server # 6. (Optional) Roll off older releases
  • 26. Steve Grunwell - stevegrunwell.com/slides/intro-to-ci-cd Extending Our Pipelines
  • 27. Steve Grunwell - stevegrunwell.com/slides/intro-to-ci-cd • Run multiple production environments/servers • Some active (blue), some idle (green) • Deploy to green • Once ready, route tra ffi c to green • Blue becomes idle • In case of issues, re-route to blue Blue-Green Deployments
  • 28. Steve Grunwell - stevegrunwell.com/slides/intro-to-ci-cd Automate Release Chores Make your pipeline work for you! • Automatically build Docker images for your app • Generate + publish API documentation • Code coverage reporting • Webhooks • If you can script it, you can do it!
  • 29. Steve Grunwell - stevegrunwell.com/slides/intro-to-ci-cd Remember: This Isn't Magic!
  • 30. Steve Grunwell - stevegrunwell.com/slides/intro-to-ci-cd Questions?
  • 31. Steve Grunwell - stevegrunwell.com/slides/intro-to-ci-cd Thank You! Steve Grunwell Sta ff Software Engineer, Mailchimp joind.in/talk/8f583