CI and CD processes like Continuous Integration (CI), Continuous Delivery (CD), and Continuous Deployment (CD) help software teams integrate code changes frequently and release software quickly. CI involves integrating code into a shared repository multiple times daily and automatically verifying each change. Continuous Delivery sets up software to be released to production at any time. Continuous Deployment means every code change is automatically deployed to production, allowing for many releases per day. Key aspects of CI include job definitions in repositories, autoscaling infrastructure, caching dependencies, using Docker for builds, and matrix builds across different environments and versions.
4. 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.
6. Continuous Delivery
4 is a software development discipline where you build
software in such a way that the software can be
released to production at any time.
8. Continuous Deployment
4 means that every change goes through the pipeline
and automatically gets put into production,
resulting in many production deployments every day.
15. Key features from CIE
4 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)
17. 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"
18. 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 deploy@xxxxx.xxxxx.com running/xxxxxxx/dockerRun.sh'
stage 'Cleanup'
echo 'prune and cleanup'
sh 'npm prune'
sh 'rm node_modules -rf'
mail body: 'project build successful',
from: 'xxxx@yyyyy.com',
replyTo: 'xxxx@yyyy.com',
subject: 'project build successful',
to: 'yyyyy@yyyy.com'
}
catch (err) {
currentBuild.result = "FAILURE"
mail body: "project build error: ${err}" ,
from: 'xxxx@yyyy.com',
replyTo: 'yyyy@yyyy.com',
subject: 'project build failed',
to: 'zzzz@yyyyy.com'
throw err
}
}