c# development workflow @ criteo
TRANSCRIPT
Copyright © 2016 Criteo
C# development workflow @ Criteo
Patrick BrunetonLead of DevTools
2016-06-08
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.
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
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
Copyright © 2016 Criteo
Issue #2: Nuget Dependency Hell
A
B
D
C
1.0
1.0
1.1
1.2
Copyright © 2016 Criteo
New workflow
Goal: integrate early (Continous Delivery)
A
B
D
C
HEAD
HEAD
HEAD
HEAD (for internal components)
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)
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
Copyright © 2016 Criteo
Trunk Based Development with C# at Criteo
Jenkins
CBS+ + +
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
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
Copyright © 2016 Criteo
Build in Jenkins: the MOAB
$ cbs checkout$ cbs build$ cbs test$ cbs export
Full build:
Runs Unit tests in //
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
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
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
Copyright © 2016 Criteo
Pre-submit tests
cbs checkout changed-repo --with-clients
cherry-pick changecbs buildcbs test [--with-clients]
MOAB
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
Copyright © 2016 Criteo
Questions ?