c# development workflow @ criteo

18
Copyright © 2016 Criteo C# development workflow @ Criteo Patrick Bruneton Lead of DevTools 2016-06-08

Upload: ibrahim-abubakari

Post on 13-Apr-2017

171 views

Category:

Engineering


0 download

TRANSCRIPT

Page 1: C# development workflow @ criteo

Copyright © 2016 Criteo

C# development workflow @ Criteo

Patrick BrunetonLead of DevTools

2016-06-08

Page 2: C# development workflow @ criteo

Copyright © 2016 Criteo

C# at Criteo

• 1000 .NET projects (C# and SQL server)• 100 Git repositories• 200 developers touching the C# codebase• Complex dependency graph

Creating an efficient development workflow has been a challenge.

Page 3: C# development workflow @ criteo

Copyright © 2016 Criteo

Early days: open source model

• Code splited into many C# Nugets• Each team responsible of a few Nugets (/ repositories)

Team A

Repo A

A 1.0build Repo

Bbuild B 1.1

1.2

Team BMerge Requests

1.1

Page 4: C# development workflow @ criteo

Copyright © 2016 Criteo

Issue #1: change propagation

A B C

• Changes in C are long to propagate• High “Commit to Prod” lag• Many versions of each component to maintain• High integration cost• Late feedback

1.1 1.3

Page 5: C# development workflow @ criteo

Copyright © 2016 Criteo

Issue #2: Nuget Dependency Hell

A

B

D

C

1.0

1.0

1.1

1.2

Page 6: C# development workflow @ criteo

Copyright © 2016 Criteo

New workflow

Goal: integrate early (Continous Delivery)

A

B

D

C

HEAD

HEAD

HEAD

HEAD (for internal components)

Page 7: C# development workflow @ criteo

Copyright © 2016 Criteo

Trunk Based Development

All commits in master branchNo feature branches, no internal versioningRequires a good test coverage

Benefits:• Very early integration of commits• Allows true Continuous Delivery

Drawbacks:• A commit can break all builds• Harder to do large changes (you’re not allowed to break anything)

Page 8: C# development workflow @ criteo

Copyright © 2016 Criteo

Trunk Based Development with C# at Criteo

Challenges• Multiple git repositories• Lots of projects

• Use cases• Build on the CI servers• Build on the dev machines• Pre-merge tests

Page 9: C# development workflow @ criteo

Copyright © 2016 Criteo

Trunk Based Development with C# at Criteo

Jenkins

CBS+ + +

Page 10: C# development workflow @ criteo

Copyright © 2016 Criteo

Build in Jenkins: the MOAB

A job that continuously builds all C# code from latest commits

Lib1 Lib2 App

MOAB #11

MOAB #10

Page 11: C# development workflow @ criteo

Copyright © 2016 Criteo

Build in Jenkins: the MOAB

$ cbs checkout$ cbs build$ cbs test$ cbs export

Full build:

- Uses Microsoft.Build API

- Manages the build queue itself

- 24 builds in parallel

- CreateHardLinksFor* = true

A full build every 20 minutes

Page 12: C# development workflow @ criteo

Copyright © 2016 Criteo

Build in Jenkins: the MOAB

$ cbs checkout$ cbs build$ cbs test$ cbs export

Full build:

Runs Unit tests in //

Page 13: C# development workflow @ criteo

Copyright © 2016 Criteo

Build in Jenkins: the MOAB

$ cbs checkout$ cbs build$ cbs test$ cbs export

Full build:List of SHA1 usedDependency graphDeployable packagesAssemblies (dll + pdb)

Filer

Page 14: C# development workflow @ criteo

Copyright © 2016 Criteo

Build on the Dev machine: using all sources

$ cbs checkout app --with-dependencies

$ ls

app/app.csprojlib1/lib1.csprojlib2/lib2.csprojdefault.sln

$ cbs build

App

Lib1 Lib2

Page 15: C# development workflow @ criteo

Copyright © 2016 Criteo

Build on the Dev machine: using MOAB snapshots

$ cbs checkout app

$ ls

app/app.csprojdefault.sln

bin/moab/lib1.dllbin/moab/lib2.dll

<Reference Include="Lib1">

<Reference Include="Lib2">

<Import Project="cbs.targets">

App

Lib1 Lib2

Page 16: C# development workflow @ criteo

Copyright © 2016 Criteo

Pre-submit tests

cbs checkout changed-repo --with-clients

cherry-pick changecbs buildcbs test [--with-clients]

MOAB

Page 17: C# development workflow @ criteo

Copyright © 2016 Criteo

Conclusion

• Trunk Based Development is powerful

• It’s a pre-requisite for Continuous Delivery, which allows agility

• TBD can be implemented with C#, but we needed some tooling

Page 18: C# development workflow @ criteo

Copyright © 2016 Criteo

Questions ?