INF397 Full Stack Technologies View Schedule Print

Continuous Integration

Process Overview

Process Overview

  1. Commit code changes
  2. Run build & test locally
  3. Push code to team repository
  4. CI runs build & tests
  5. CI reports outcomes
  6. CI triggers deployment on success

Benefits

  • Automatically running tests
  • Automatically running builds
  • Infrastructure as code
  • Seamless integraton with Source Control

Hosted vs SaaS

  • Hosted: more control
  • SaaS: less management

Many existing tools

  • Drone.io
  • TravisCI
  • CircleCI
  • SnapCI
  • Codeship
  • Jenkins
  • TeamCity
  • Many others

Common settings

  • Build environment
  • Build variables
  • Encrypted secrets
  • Test commands
  • Notification
  • Deployment

Example .drone.yml


    build:
      frontend:
        image: node:4.4
        commands:
          - npm install
          - npm run test
      backend:
        image: python:3.5
        commands:
          - pip install -r requirments.txt
          - pytest tests/
    notify:
      email:
        from: noreply@github.com
        host: smtp.mailgun.org
        username: USER
        password: PASS
        recipients:
          - m.mikoff@gmail.com
    deploy:
      rsync:
        user: m_mikoff
        host: 104.199.157.108
        port: 22
        source: path/to/repo/artifacts
        target: path/on/server
        recursive: true
        commands:
          - service nginx restart 
  

Example .travis.yml


    language: node_js
    node_js: '6'
    env:
      global:
        secure: ENCRYPTED-GIT-KEY
    before_install:
      - openssl aes-256-cbc -K $encrypted_033b91806de4_key -iv $encrypted_033b91806de4_iv 
        -in .deploy_key.pem.enc -out .deploy_key.pem -d
    install:
      - npm install
    script:
      - npm run lint
      - npm run build
      - npm run test
    after_success:
      - eval "$(ssh-agent -s)"
      - chmod 600 .deploy_key.pem
      - ssh-add .deploy_key.pem
      - ssh-keyscan 104.199.157.108 >> ~/.ssh/known_hosts
      - git remote add deploy m_mikoff@104.199.157.108:~/node-todo-example
      - git push deploy master -f
    notifications:
      slack:
        secure: ENCRYPTED-SLACK-KEY
  

Links

Course Schedule:

week 1 03.02.2017 History of the web Fullstack Principles Development Processes Agile Processes DevOps Basics Git
week 2 10.02.2017 Frontend Overview Backend Overview Network Overview Testing JavaScript Overview JavaScript Tooling
week 3 17.02.2017 Web Architectures RESTful principles SOLID principles Web Components Continuous Integration
week 4 24.02.2017 Databases basics Using APIs Deployment Automation Monitoring In-class project consultations
week 5 17.03.2017 Project presentations
Final Test
Course Retrospective and Q&A