Download - CI and CD
![Page 1: CI and CD](https://reader031.vdocument.in/reader031/viewer/2022030302/587e0a021a28abe11a8b6923/html5/thumbnails/1.jpg)
CI and CDNette Camp 27.8.2016
![Page 2: CI and CD](https://reader031.vdocument.in/reader031/viewer/2022030302/587e0a021a28abe11a8b6923/html5/thumbnails/2.jpg)
Key concepts4 Continuous Delivery (CD)
4 Continuous Integration (CI)
4 Continuous Deployment
![Page 3: CI and CD](https://reader031.vdocument.in/reader031/viewer/2022030302/587e0a021a28abe11a8b6923/html5/thumbnails/3.jpg)
Continuous Integration
![Page 4: CI and CD](https://reader031.vdocument.in/reader031/viewer/2022030302/587e0a021a28abe11a8b6923/html5/thumbnails/4.jpg)
Continuous Integration (CI)4 is a development practice that requires developers to integrate code into a shared repository several times a day. Each check-in is then verified by an automated build, allowing teams to detect problems early.
![Page 5: CI and CD](https://reader031.vdocument.in/reader031/viewer/2022030302/587e0a021a28abe11a8b6923/html5/thumbnails/5.jpg)
Continuous Delivery
![Page 6: CI and CD](https://reader031.vdocument.in/reader031/viewer/2022030302/587e0a021a28abe11a8b6923/html5/thumbnails/6.jpg)
Continuous Delivery4 is a software development discipline where you build
software in such a way that the software can be released to production at any time.
![Page 7: CI and CD](https://reader031.vdocument.in/reader031/viewer/2022030302/587e0a021a28abe11a8b6923/html5/thumbnails/7.jpg)
Continuous Deployment
![Page 8: CI and CD](https://reader031.vdocument.in/reader031/viewer/2022030302/587e0a021a28abe11a8b6923/html5/thumbnails/8.jpg)
Continuous Deployment4 means that every change goes through the pipeline and automatically gets put into production, resulting in many production deployments every day.
![Page 9: CI and CD](https://reader031.vdocument.in/reader031/viewer/2022030302/587e0a021a28abe11a8b6923/html5/thumbnails/9.jpg)
How we do Continuous Delivery in Apiary
![Page 10: CI and CD](https://reader031.vdocument.in/reader031/viewer/2022030302/587e0a021a28abe11a8b6923/html5/thumbnails/10.jpg)
![Page 11: CI and CD](https://reader031.vdocument.in/reader031/viewer/2022030302/587e0a021a28abe11a8b6923/html5/thumbnails/11.jpg)
![Page 12: CI and CD](https://reader031.vdocument.in/reader031/viewer/2022030302/587e0a021a28abe11a8b6923/html5/thumbnails/12.jpg)
![Page 13: CI and CD](https://reader031.vdocument.in/reader031/viewer/2022030302/587e0a021a28abe11a8b6923/html5/thumbnails/13.jpg)
Continuous Integration Engines
![Page 14: CI and CD](https://reader031.vdocument.in/reader031/viewer/2022030302/587e0a021a28abe11a8b6923/html5/thumbnails/14.jpg)
![Page 15: CI and CD](https://reader031.vdocument.in/reader031/viewer/2022030302/587e0a021a28abe11a8b6923/html5/thumbnails/15.jpg)
Key features from CIE4 job definitions in repository
4 autoscaling on traffic with lowest possible price
4 pipelines
4 caching for installations (apt, npm, gem, composer, docker)
4 docker support (registry, caching layers)
4 matrix builds (OSS)
![Page 16: CI and CD](https://reader031.vdocument.in/reader031/viewer/2022030302/587e0a021a28abe11a8b6923/html5/thumbnails/16.jpg)
Job definitions in repository
![Page 17: CI and CD](https://reader031.vdocument.in/reader031/viewer/2022030302/587e0a021a28abe11a8b6923/html5/thumbnails/17.jpg)
sudo: "required"dist: "trusty"language: "node_js"node_js: - "0.10" - "0.12" - "4" - "6"env: global: # GH_TOKEN and NPM_TOKEN encrypted by 'travis encrypt' utility - secure: "<<<TOKEN>>>"cache: directories: - "node_modules"before_install: - "npm -g install npm@latest" - "gem install travis" - "curl -Lo travis_after_all.py https://raw.githubusercontent.com/dmakhno/travis_after_all/master/travis_after_all.py"before_script: - "npm run lint"script: - "npm test" - "npm run test:hooks-handlers"after_success: # travis_after_all.py is needed due to travis-ci/travis-ci#1548 & travis-ci/travis-ci#929 - "npm run coveralls" - "python travis_after_all.py" - "export $(cat .to_export_back)" - "npm run semantic-release || true"
![Page 18: CI and CD](https://reader031.vdocument.in/reader031/viewer/2022030302/587e0a021a28abe11a8b6923/html5/thumbnails/18.jpg)
node('node') { currentBuild.result = "SUCCESS" try { stage 'Checkout' checkout scm stage 'Test' env.NODE_ENV = "test" print "Environment will be : ${env.NODE_ENV}" sh 'node -v' sh 'npm prune' sh 'npm install' sh 'npm test' stage 'Build Docker' sh './dockerBuild.sh' stage 'Deploy' echo 'Push to Repo' sh './dockerPushToRepo.sh' echo 'ssh to web server and tell it to pull new image' sh 'ssh [email protected] running/xxxxxxx/dockerRun.sh' stage 'Cleanup' echo 'prune and cleanup' sh 'npm prune' sh 'rm node_modules -rf' mail body: 'project build successful', from: '[email protected]', replyTo: '[email protected]', subject: 'project build successful', to: '[email protected]' } catch (err) { currentBuild.result = "FAILURE" mail body: "project build error: ${err}" , from: '[email protected]', replyTo: '[email protected]', subject: 'project build failed', to: '[email protected]' throw err }}
![Page 19: CI and CD](https://reader031.vdocument.in/reader031/viewer/2022030302/587e0a021a28abe11a8b6923/html5/thumbnails/19.jpg)
Autoscaling
![Page 20: CI and CD](https://reader031.vdocument.in/reader031/viewer/2022030302/587e0a021a28abe11a8b6923/html5/thumbnails/20.jpg)
![Page 21: CI and CD](https://reader031.vdocument.in/reader031/viewer/2022030302/587e0a021a28abe11a8b6923/html5/thumbnails/21.jpg)
Pipelines
![Page 22: CI and CD](https://reader031.vdocument.in/reader031/viewer/2022030302/587e0a021a28abe11a8b6923/html5/thumbnails/22.jpg)
![Page 23: CI and CD](https://reader031.vdocument.in/reader031/viewer/2022030302/587e0a021a28abe11a8b6923/html5/thumbnails/23.jpg)
Caching
![Page 24: CI and CD](https://reader031.vdocument.in/reader031/viewer/2022030302/587e0a021a28abe11a8b6923/html5/thumbnails/24.jpg)
![Page 25: CI and CD](https://reader031.vdocument.in/reader031/viewer/2022030302/587e0a021a28abe11a8b6923/html5/thumbnails/25.jpg)
Docker support
![Page 26: CI and CD](https://reader031.vdocument.in/reader031/viewer/2022030302/587e0a021a28abe11a8b6923/html5/thumbnails/26.jpg)
machine: services: - docker
dependencies: override: - docker info - docker build -t circleci/elasticsearch .
test: override: - docker run -d -p 9200:9200 circleci/elasticsearch; sleep 10 - curl --retry 10 --retry-delay 5 -v http://localhost:9200
deployment: hub: branch: master commands: - docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS - docker push circleci/elasticsearch
![Page 27: CI and CD](https://reader031.vdocument.in/reader031/viewer/2022030302/587e0a021a28abe11a8b6923/html5/thumbnails/27.jpg)
Matrix builds
![Page 28: CI and CD](https://reader031.vdocument.in/reader031/viewer/2022030302/587e0a021a28abe11a8b6923/html5/thumbnails/28.jpg)
matrix: GO_VERSION: - 1.4 - 1.3 REDIS_VERSION: - 2.6 - 2.8 - 3.0
![Page 29: CI and CD](https://reader031.vdocument.in/reader031/viewer/2022030302/587e0a021a28abe11a8b6923/html5/thumbnails/29.jpg)
Distributed job across multiple nodes
![Page 30: CI and CD](https://reader031.vdocument.in/reader031/viewer/2022030302/587e0a021a28abe11a8b6923/html5/thumbnails/30.jpg)