Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Sergiy Byelozyorov - Recipes, Python-based DSL ...

Sergiy Byelozyorov - Recipes, Python-based DSL for specifying build/test instructions in Chromium/V8

PyConWeb

July 17, 2018
Tweet

More Decks by PyConWeb

Other Decks in Programming

Transcript

  1. Overview • Buildbot • Recipes ◦ How they work? ◦

    Examples & Features • Current State • Q&A
  2. Buildbot • “It runs the waterfalls” • All-in-one opinionated CI

    framework ◦ Promises to be ‘batteries included’, and yet ‘flexible’ ◦ Spoiler: it lies
  3. Buildbot What is it good for? • Simple build dependencies

    • Linear build execution • Small number of build configurations As it turns out, this doesn’t fit the Chromium/V8 projects these days.
  4. • Centralized configuration ◦ Static builder configurations ◦ Unversionable on

    a per-build basis ▪ Not tryable ◦ Requires master restart to change • Iron-fisted RPC control of the slave ◦ Restarting master kills all running jobs. • Callback-passing style (twistd) ◦ Difficult to debug ◦ Difficult to test Problems?
  5. How Recipes Work • Master triggers a single command on

    the slave ◦ recipes.py --recipe chromium.py • The recipe executes and generates commands to build/test your project ◦ git clone ◦ python compile.py ◦ ... • Recipe framework executes them and sends logs back to master • Master will parse the logs and extract annotations to generate steps ◦ @@@SEED_STEP@setup_build@@@ ◦ @@@STEP_STARTED@@@
  6. DEPS = ['chromium', 'gclient', 'properties', 'platform'] def RunSteps(api): # 100%

    working example! api.gclient.set_config('chromium') api.gclient.checkout(revision=api.properties[ 'revision']) api.gclient.runhooks() api.chromium.cleanup_temp() api.chromium.compile(targets=['all']) def GenTests(api): yield api.test('basic') yield api.test('tryserver') + api.properties.tryserver() yield api.test('mac_32') + api.platform('mac', 32) Simple Recipe
  7. DEPS = ['chromium', 'gclient', 'tryserver'] def compile_and_test(api): api.gclient.runhooks() api.chromium.compile() return

    api.chromium.runtest('v8/test262').json.failed_tests def RunSteps(api): api.gclient.set_config('chromium_with_v8_tot') api.gclient.checkout() api.tryserver.apply_patch() failed_tests_with_patch = compile_and_test() if not failed_tests_with_patch: return # patch is OK api.tryserver.deapply_patch() failed_tests_without_patch = compile_and_test() # patch is OK iff failed_tests_with_patch == failed_tests_without_patch Try a Test With and Without a Patch
  8. --- a/scripts/slave/recipes/chromium.py +++ b/scripts/slave/recipes/chromium.py @@ -122,7 +122,7 @@ BUILDERS =

    { 'recipe_config': 'official', 'chromium_config_kwargs': { 'BUILD_CONFIG': 'Release', 'TARGET_BITS': 64,32, }, 'testing': { 'platform': 'win', Automatic Simulation / Tests
  9. --- a/.../chromium_chrome_Google_Chrome_Win.json +++ b/.../chromium_chrome_Google_Chrome_Win.json @@ -71,8 +71,8 @@ "runhooks" ],

    "env": { "GYP_DEFINES": "branding=Chrome buildtype=Official chromium_win_pch=0 component=static_library fastbuild=1 target_arch=x64",target_arch=ia32", "GYP_MSVS_VERSION": "2012""2010" }, "name": "gclient runhooks" }, Automatic Simulation / Tests --- a/.../chromium_chrome_Google_Chrome_Win.json +++ b/.../chromium_chrome_Google_Chrome_Win.json @@ -91,7 +91,7 @@ "-u", "[BUILD]\\scripts\\slave\\compile.py", "--target", "Release_x64","Release", "--src-dir", "[SLAVE_BUILD]\\src", "--build-tool",
  10. Mocking Command Outputs & Unit Tests DEPS = ['gpu', 'gclient',

    'properties', 'platform'] def GenTests(api): yield ( api.test('failed_gpu_test_keeps_build_green' ) + api.override_step_data( 'gpu_process_launch_tests on NVIDIA GPU on Windows' , api.gpu.example_test_failure( 'GpuProcessIntegrationTest.GpuProcess_css3d' ), retcode=1) + api.post_process(post_process .StatusCodeIn, 0) + api.post_process(post_process .DropExpectation) )
  11. Today • We’ve replaced Buildbot with LUCI ◦ A set

    of micro-services that work in Cloud to provide a scalable CI system. • Most services are implemented in Go • Yet, all build/test logic is still implemented as recipes! ◦ And works seamlessly with a completely different underlying architecture. • Mature and reliable system ◦ Tested on dozens of projects ◦ Users wrote hundreds of recipes It’s fully open source! Try it out for your projects.