Software Factory: Continuous Integration

43

Transcript of Software Factory: Continuous Integration

Page 1: Software Factory: Continuous Integration
Page 2: Software Factory: Continuous Integration

Software Factory: Continuous Integration and Delivery, OpenStack-Style

http://softwarefactory-project.io

Freenode: #softwarefactory

Fabien BoucherMatthieu HuinOctober 28, 2015

Page 3: Software Factory: Continuous Integration

Continuous Integration and Continuous Delivery: A State of the Art

Page 4: Software Factory: Continuous Integration

Software Factory: CI and CD, OpenStack-style4

Typical Workflow

Page 5: Software Factory: Continuous Integration

Software Factory: CI and CD, OpenStack-style6

Problems

With the entry price:● Cost of automation● Cost of dedicated CI infrastructure

With the workflow itself:● commits in rapid succession can make CI tests obsolete as they run● It is possible to end up with a broken master temporarily (and not even knowing it)

Page 6: Software Factory: Continuous Integration

Software Factory: CI and CD, OpenStack-style7

Conventional CI workflows don't scale to large open source projectsOpenstack is … [*]

● 43 official projects, each with its own subset of deliverables, and most of them strongly tied to each other in deployment

● More than 2000 contributors● 70K+ patchsets submitted in the last development cycle, or roughly 400 patches a

day• Some patchsets can trigger up to 25 jobs● Some jobs can take more than 30 minutes to execute

[*] Ballpark estimations from the Openstack governance project and stackalytics for the Liberty development cycle

Page 7: Software Factory: Continuous Integration

Software Factory: CI and CD, OpenStack-style8

The OpenStack Way

Page 8: Software Factory: Continuous Integration

Software Factory: CI and CD, OpenStack-style9

The OpenStack Infrastructure

Local changes submitted via

git-review

Gerrit code review Zuul

Jenkins (gearman-plugin)

pipy mirrors & other semi-privileged servers

Git repository

Jenkins01,02...

Github mirror git.openstack.org mirror

Gearman Server

slave nodes managed

by Nodepool

Page 9: Software Factory: Continuous Integration

Software Factory: CI and CD, OpenStack-style10

Problems SolvedAdvantages Drawbacks● Guarantee that the master version is

always OK at any time● Infrastructure costs are reduced with

Nodepool● Gated commits with Zuul ensure that

tests are never obsolete

● Longer workflow● Extra workload on core developers

… and all the deployment recipes for OpenStack's CI infrastructure are freely available !

https://git.openstack.org/cgit/openstack-infra/

Page 10: Software Factory: Continuous Integration

Software Factory: CI and CD, OpenStack-style11

Can I Have One Too ??

Maybe, but with a lot of work to adapt OpenStack's recipes

Page 11: Software Factory: Continuous Integration

Software Factory: CI and CD, OpenStack-style12

Page 12: Software Factory: Continuous Integration

Software Factory, the OpenStack-like CI with batteries included

Page 13: Software Factory: Continuous Integration

Software Factory: CI and CD, OpenStack-style14

Main Features

● All the good stuf from the Openstack CI and more, and ready to use!● Easy to deploy and update● The projects configuration is versioned and follows a Continuous Deployment

workflow● Comes with template jobs, like artifacts export to Swift (object storage)

Page 14: Software Factory: Continuous Integration

Software Factory: CI and CD, OpenStack-style15

Core Elements

ManageSF Dashboard

Cauth SSO

Redmine Ticketing System

& Backlog

Jenkins Job Manager

Etherpad Collaborative

Text Editor

Zuul Master of the Gate

Nodepool Slave Manager

Pastie Quick Text Paste

Gerrit Code Review

GitWeb Code Repository

Slave Nodes

Web UI

REST API

Clone project

Review

Workflow

Hooks

Authentication

Page 15: Software Factory: Continuous Integration

Software Factory: CI and CD, OpenStack-style16

Code Review with Gerrit

● Preconfigured to enable a review workflow inspired by Openstack:● Preconfigured labels (Code Review/Verified/Workflow)● Preconfigured ACLs mapping users to labels types

● Scoring by label generates events and triggers actions along the CI pipeline● Integration with the ticketing system

Page 16: Software Factory: Continuous Integration

Software Factory: CI and CD, OpenStack-style17

Gating with Zuul: Continuous Integration

● Zuul comes preconfigured to work with Gerrit and Jenkins within Software Factory

● Integration pipelines:● check: jobs executed after proposing a patch● gate: jobs executed prior to the merge (Gated commit)

Page 17: Software Factory: Continuous Integration

Software Factory: CI and CD, OpenStack-style18

Gating with Zuul: Continuous Deployment

● Delivery and Deployment pipelines:● post: jobs executed after the merge● tag: jobs executed after pushing a tag● periodic: jobs executed on a daily basis

● Credentials management in Jenkins

Page 18: Software Factory: Continuous Integration

Software Factory: CI and CD, OpenStack-style19

Slave Nodes Management

Two possibilities in Software Factory:

● Managing static, persistent slaves● Letting Nodepool manage a dynamic pool of image-based slaves in an Openstack

Cloud for you

Page 19: Software Factory: Continuous Integration

Software Factory: CI and CD, OpenStack-style20

Benefits of Using Nodepool

● Jobs scalability● Smarter resource usage● Improved Jobs stability and reproducibility compared to long-lived slaves

Page 20: Software Factory: Continuous Integration

Software Factory: CI and CD, OpenStack-style21

Collaborative Tools

ManageSF Dashboard

Cauth SSO

Redmine Ticketing System

& Backlog

Jenkins Job Manager

Etherpad Collaborative

Text Editor

Zuul Master of the Gate

Nodepool Slave Manager

Pastie Quick Text Paste

Gerrit Code Review

GitWeb Code Repository

Slave Nodes

Web UI

REST API

Clone project

Review

Workflow

Hooks

Authentication

Page 21: Software Factory: Continuous Integration

Software Factory: CI and CD, OpenStack-style22

Keeping it all together

ManageSF Dashboard

Cauth SSO

Redmine Ticketing System

& Backlog

Jenkins Job Manager

Etherpad Collaborative

Text Editor

Zuul Master of the Gate

Nodepool Slave Manager

Pastie Quick Text Paste

Gerrit Code Review

GitWeb Code Repository

Slave Nodes

Web UI

REST API

Clone project

Review

Workflow

Hooks

Authentication

Page 22: Software Factory: Continuous Integration

Software Factory: CI and CD, OpenStack-style23

Deployment as easy as 1, 2, 3 ... 4

1. Fetch the pre-built QCOW2 image2. Adapt the unified configuration file sfconfig.yaml3. Run the configuration script4. And you are ready to host projects and perform CI/CD on them "à la OpenStack"

Page 23: Software Factory: Continuous Integration

Software Factory: CI and CD, OpenStack-style24

The Config Repository

● Manages Jenkins jobs, Zuul layout, Nodepool images/labels/scripts● Users can propose changes via Gerrit● Follows the CI/CD workflow● Any proposed changes are validated then merged by pre-defined jobs "config-

check" and "config-update"

Page 24: Software Factory: Continuous Integration

Development Workflow within Software Factory

Page 25: Software Factory: Continuous Integration

Software Factory: CI and CD, OpenStack-style26

A View of the Dashboard

Page 26: Software Factory: Continuous Integration

Software Factory: CI and CD, OpenStack-style27

Creating a Project

Page 27: Software Factory: Continuous Integration

Software Factory: CI and CD, OpenStack-style28

Adding Users to the Project

Page 28: Software Factory: Continuous Integration

Software Factory: CI and CD, OpenStack-style29

Adding Users to the Project

Page 29: Software Factory: Continuous Integration

Software Factory: CI and CD, OpenStack-style30

Configuring Slaves with Nodepool (1)Images configuration by users, stored in the config repository

- provider: defaultimages: - name: bare-centos-7 base-image: CentOS-7-cloud username: centos private-key: /var/lib/jenkins/.ssh/id_rsa setup: base.sh min-ram: 2048

Page 30: Software Factory: Continuous Integration

Software Factory: CI and CD, OpenStack-style31

Configuring Slaves with Nodepool (2)Labels configuration in the config repository

labels:- name: bare-centos-7 image: bare-centos-7 min-ready: 1 providers: - name: default

Page 31: Software Factory: Continuous Integration

Software Factory: CI and CD, OpenStack-style32

Configuring Jobs for a ProjectJenkins Job Builder template language

- job: name: 'myproject-functional-tests' defaults: global builders: - prepare-workspace - shell: cd $ZUUL_PROJECT && DEBUG=1 ./run_functional-tests.sh triggers: - zuul publishers: - fetch-my-artifacts - zuul-swift-upload node: bare-centos-7

Page 32: Software Factory: Continuous Integration

Software Factory: CI and CD, OpenStack-style33

Configuring Jobs for a ProjectZuul Pipelines Configuration

- name: myproject check: - myproject-functional-tests gate: - myproject-functional-tests - myproject-upgrade-tests

Page 33: Software Factory: Continuous Integration

Software Factory: CI and CD, OpenStack-style34

Issue Tracking

Page 34: Software Factory: Continuous Integration

Software Factory: CI and CD, OpenStack-style35

Code Review

Page 35: Software Factory: Continuous Integration

Software Factory: CI and CD, OpenStack-style36

Gating and Job Parallelization

Page 36: Software Factory: Continuous Integration

Software Factory: CI and CD, OpenStack-style37

Checking Tests Results (1)

Page 37: Software Factory: Continuous Integration

Software Factory: CI and CD, OpenStack-style38

Checking Tests Results (2)

Page 38: Software Factory: Continuous Integration

Software Factory: CI and CD, OpenStack-style39

Delivering the GoodsDeployment job requiring credentials

- job: name: 'myproject-publisher' defaults: global builders: - prepare-workspace - shell: | rsync -a --delete -e "ssh -i $key" $ZUUL_PROJECT [email protected]:. ssh -i $key [email protected] $ZUUL_PROJECT/deploy.py triggers: - zuul wrappers: - credentials-binding: - file: credential-id: 0f3ff035-90df-4f6e-84fb-e924c26e4ab0 variable: key node: 'publisher'

- name: myproject post: - myproject-publisher

Page 39: Software Factory: Continuous Integration

THANK YOUhttp://softwarefactory-project.io

Freenode: #softwarefactory

ML: [email protected] / [email protected]

Page 41: Software Factory: Continuous Integration
Page 42: Software Factory: Continuous Integration
Page 43: Software Factory: Continuous Integration