This document describes the continuous integration process used at Startup Labs, Inc. It discusses using a single branch development model with feature flags instead of feature branches. Automated tests are run on every commit, with the goal of fast builds. Tests are run in parallel across multiple agents. Manual testing is done after automated testing. Load and migration tests are run before production deployments. The goals are agile development with small changes and frequent releases through continuous integration and deployment.
2. Who I Am
● Anton Serdyuk
● Technical Leader at Startup Labs, Inc.
● anton.serdyuk@gmail.com
● anton.serdyuk@itstartuplabs.com
● @anton_serdyuk
● Skype: serdyuk.anton
8. Who We Are
Project
● b2b system
● Unexpected downtime is very expensive
● Bugs in production are also very expensive because of
the reputation loss
● Small amount of traffic (But expensive)
● 1.5 years
● 4-15 developers (+ layout, + qa)
● 15 Gb Database (Grows not very fast)
23. What IS Our Way
Branch by Abstraction
● Commit switch-off for this feature
● Develop, integrate
● … your code in production now, but switched-off
● Develop, integrate
● Test
● Switch-on this feature in production
24. What IS Our Way
Autotests
● QAs write behat scenarios
● Developers implement
● Every feature covered by behat scenarios
● Great regression tests suite - easy refactoring, less
bugs
● + ~100% development cost
25. What IS Our Way
Every Build Is Release Candidate
● Do not push if state after commit is not suitable for
production
26. What IS Our Way
Some Numbers
● ~1000 behat scenarios (unit tests are not counted)
● ~15 minutes build duration
● 2 build servers (Intel Xeon, 32 Gb RAM, SSD)
● 5-6 build agents for tests (VMs)
● 3 build agents for build phase (VMs)
● ~15 builds per day
● 2 releases per week
30. Build Process
Use The Same Artifacts
build
build
agent
agents
artifacts
apt
repository
test
test
test
agents
test
agents
agents
agents
QA
server
pre
prod
prod
31. Build Process
Autoconfigure All Environments
test
test
test
agents
test
agents
agents
agents
QA
server
puppet
master
pre
prod
prod
tune
release engineer
(architect/admin)
32. Build Process
Deploy by Pressing a Button
bamboo
test
test
test
agents
test
agents
agents
agents
QA
server
pre
prod
prod
40. Automatic Test Phase
Run Tests in Parallel
agent 1
behat process 1
application 1
agent 2
behat process 2
application 2
...
agent 5
behat process 5
application 5
43. Automatic Test Phase
Write Fast Tests
● Continuously speed-up your tests
● Use curl instead of Selenium
● Put initial data directly to DB
● etc
44. Automatic Test Phase
Write Fast Tests
Merge scenarios which do not modify data
Feature: Posts pagination
Feature: Posts pagination
Background:
Background:
Given I am logged in as admin
Given I am logged in as admin
And there is many posts
And there is many posts
Scenario: Pagination works
Scenario: All pagination tests
Given I am at the posts list
# Scenario: Pagination works
Then I should see pagination
Given I am at the posts list
Then I should see pagination
Scenario: Link “last” works
Given I am at the posts list
# Scenario: Link “last” works
When I click at the “last” link
When I click at the “last” link
Then I should see last page
Then I should see last page
45. Automatic Test Phase
Write Fast Tests
Translate outline to single scenarios with TableNode
Feature: Post validation
Feature: Post validation
Background:
Background:
Given I am logged in as admin
Given I am logged in as admin
And I am on post add page
And I am on post add page
Scenario Outline: Validation works
Scenario: Validation works
When I enter <value> into <field>
Then I should see such errors with such
input
Then I should see error <error>
| field | value | error
Examples:
| field | value | error
|
| title |
| Can not be empty
|
| tags
| Should be letters |
| %%%%
|
| title |
|
| Can not be empty
| tags | %%%% | Should be letters |
46. Automatic Test Phase
Write Fast Tests
Parallel test execution
@parallel
Feature: Login
server
behat process 1
Background:
Given I am registered user
alex = alex1
alex = alex2
application
behat process 2
| username | alex |
| password | 123 |
Scenario: I can login
Given I am at the login page
When I fill form with
● Many problems with race
conditions
| username | alex |
| password | 123 |
Then I should be logged in
● Not worked for us :(
57. Problems
Red Builds for a Long Time
● QA can not deploy new version to staging
● New commits make new tests red like a snowball
● Nobody knows who are responsible for all those failed
tests
Solutions:
● If build can not be fixed in 15 minutes - revert commit
● Autoreverts on red builds (?)
58. Problems
Long Builds
● Nobody wants to wait green build
● Nobody cares about green build after commit
● Red builds for a long time
Solutions:
● Speedup tests
● Parallel build
● Add more build servers
59. Problems
Blinking Failures
● Failures are trustless - “it is not my fault - it is blinking,
just do rebuild”
● Time consuming
Solutions:
● Eliminate them ASAP
● Do not just run “Rebuild failed jobs”