20
BUY IT, USE IT, BREAK IT, FIX IT CONTINUOUS INTEGRATION SAMUEL PETOVSKY

BUY IT, USE IT, BREAK IT, FIX IT CONTINUOUS INTEGRATION · • Continuous integration is about communication. ... • Consider an automated rollback. BUILD SERVERS • Tools that

  • Upload
    others

  • View
    8

  • Download
    0

Embed Size (px)

Citation preview

Page 1: BUY IT, USE IT, BREAK IT, FIX IT CONTINUOUS INTEGRATION · • Continuous integration is about communication. ... • Consider an automated rollback. BUILD SERVERS • Tools that

BUY IT, USE IT, BREAK IT, FIX IT

CONTINUOUS INTEGRATION

SAMUEL PETOVSKY

Page 2: BUY IT, USE IT, BREAK IT, FIX IT CONTINUOUS INTEGRATION · • Continuous integration is about communication. ... • Consider an automated rollback. BUILD SERVERS • Tools that

OUTLINE

• Introduction• Overview• Motivation• Best Practices• Build Servers• Real Life Example

Page 3: BUY IT, USE IT, BREAK IT, FIX IT CONTINUOUS INTEGRATION · • Continuous integration is about communication. ... • Consider an automated rollback. BUILD SERVERS • Tools that

INTRODUCTION

• Software development practice where members of a team integrate their work as often as possible, usually several times a day to prevent„integration hell“

• Build automation

• Often combined with automated testing

Page 4: BUY IT, USE IT, BREAK IT, FIX IT CONTINUOUS INTEGRATION · • Continuous integration is about communication. ... • Consider an automated rollback. BUILD SERVERS • Tools that

INTRODUCTION

• Feature toggle instead of branches

• Continuous delivery

• Build servers

Page 5: BUY IT, USE IT, BREAK IT, FIX IT CONTINUOUS INTEGRATION · • Continuous integration is about communication. ... • Consider an automated rollback. BUILD SERVERS • Tools that

OVERVIEW

• Commit it

• Build it

• Test it

• Fix it (if broken)

Page 6: BUY IT, USE IT, BREAK IT, FIX IT CONTINUOUS INTEGRATION · • Continuous integration is about communication. ... • Consider an automated rollback. BUILD SERVERS • Tools that

MOTIVATION

• Switch to continuous deployment has been linked to very concrete and visible financial success (Linkedin)

• Facebook releases to production twice a day

• Amazon makes changes to production every 11.6 seconds

• 8 minutes after you commit code it's live in production (Google Consumer Surveys)

Page 7: BUY IT, USE IT, BREAK IT, FIX IT CONTINUOUS INTEGRATION · • Continuous integration is about communication. ... • Consider an automated rollback. BUILD SERVERS • Tools that

BEST PRACTICES

1. Maintain a Single Source Repository

• Use Source code management tools (SVN, Git, Mercurial)

• Put all project-related files into repository

Page 8: BUY IT, USE IT, BREAK IT, FIX IT CONTINUOUS INTEGRATION · • Continuous integration is about communication. ... • Consider an automated rollback. BUILD SERVERS • Tools that

2. Automate the Build

• Involve everything in the build (running pre-installation scripts, loading database schema, compiling…)

• Ant, MSBuild, Make• Build servers

BEST PRACTICES

Page 9: BUY IT, USE IT, BREAK IT, FIX IT CONTINUOUS INTEGRATION · • Continuous integration is about communication. ... • Consider an automated rollback. BUILD SERVERS • Tools that

3. Make the Build Self-Testing

• Produce self-testing code• xUnit tests, Selenium…

BEST PRACTICES

Page 10: BUY IT, USE IT, BREAK IT, FIX IT CONTINUOUS INTEGRATION · • Continuous integration is about communication. ... • Consider an automated rollback. BUILD SERVERS • Tools that

4. Everyone Commits To the Mainline Every Day

• Break the work into small chunks• It prevents „Integration Hell“• Issues and conflicts are detected sooner and

thus easier to fix

BEST PRACTICES

Page 11: BUY IT, USE IT, BREAK IT, FIX IT CONTINUOUS INTEGRATION · • Continuous integration is about communication. ... • Consider an automated rollback. BUILD SERVERS • Tools that

5. Every Commit Should Build the Mainline on an Integration Machine

• No branches• Commit build

BEST PRACTICES

Page 12: BUY IT, USE IT, BREAK IT, FIX IT CONTINUOUS INTEGRATION · • Continuous integration is about communication. ... • Consider an automated rollback. BUILD SERVERS • Tools that

6. Fix Broken Builds Immediately

• Fixing the broken build has a highest priority• Revert to latest stable state

BEST PRACTICES

Page 13: BUY IT, USE IT, BREAK IT, FIX IT CONTINUOUS INTEGRATION · • Continuous integration is about communication. ... • Consider an automated rollback. BUILD SERVERS • Tools that

7. Keep the Build Fast

• Do not include everything in the commit builds• Use parallelization• Put more time-consuming tasks into nightly

builds instead (static code analysis…)

BEST PRACTICES

Page 14: BUY IT, USE IT, BREAK IT, FIX IT CONTINUOUS INTEGRATION · • Continuous integration is about communication. ... • Consider an automated rollback. BUILD SERVERS • Tools that

8. Test in a Clone of the Production Environment

• The difference between test and production environments can cause troubles.

• Use the same hardware, operating system, database, firewall settings, test on the real data.

BEST PRACTICES

Page 15: BUY IT, USE IT, BREAK IT, FIX IT CONTINUOUS INTEGRATION · • Continuous integration is about communication. ... • Consider an automated rollback. BUILD SERVERS • Tools that

9. Make it Easy for Anyone to Get the Latest Executable

• To help make this work, anyone involved with a software project should be able to get the latest executable and be able to run it

BEST PRACTICES

Page 16: BUY IT, USE IT, BREAK IT, FIX IT CONTINUOUS INTEGRATION · • Continuous integration is about communication. ... • Consider an automated rollback. BUILD SERVERS • Tools that

10. Everyone can see what's happening

• Continuous integration is about communication.• Everyone should know the state of the mainline

build.

BEST PRACTICES

Page 17: BUY IT, USE IT, BREAK IT, FIX IT CONTINUOUS INTEGRATION · • Continuous integration is about communication. ... • Consider an automated rollback. BUILD SERVERS • Tools that

12. Automate Deployment

• CI makes deployment boring.• Consider an automated rollback.

BUILD SERVERS

Page 18: BUY IT, USE IT, BREAK IT, FIX IT CONTINUOUS INTEGRATION · • Continuous integration is about communication. ... • Consider an automated rollback. BUILD SERVERS • Tools that

• Tools that help with CI• Build and deployment automation• Advanced setting of CI cycle (pre and post-build

steps, build stages, task parallelization)• Often offer scalability• Bamboo, Jenkins, Travis

BEST PRACTICES

Page 19: BUY IT, USE IT, BREAK IT, FIX IT CONTINUOUS INTEGRATION · • Continuous integration is about communication. ... • Consider an automated rollback. BUILD SERVERS • Tools that

REAL LIFE EXAMPLE

Page 20: BUY IT, USE IT, BREAK IT, FIX IT CONTINUOUS INTEGRATION · • Continuous integration is about communication. ... • Consider an automated rollback. BUILD SERVERS • Tools that

Q&A

SAMUEL PETOVSKY