diff options
author | Ravi Mistry <rmistry@google.com> | 2018-01-02 14:54:43 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-01-02 20:49:31 +0000 |
commit | d4731e995c9ca3d4dc9e1e5dd35d026cd1a0ea4f (patch) | |
tree | e1176d78c31960d7a46804dcc9b2916f43a98a94 /infra | |
parent | c6fd7cf83b0a86684f2f27d97fe744ff8961532a (diff) |
Housekeeper-PerCommit-Bookmaker bot to verify that docs match includes
Example failure- https://chromium-swarm.appspot.com/task?id=3a97e6c00ff78010
Example success- https://chromium-swarm.appspot.com/task?id=3a9814b474fcf910
Bug: skia:7432
Change-Id: I2459b7568ac2d12a0ed81b1eec9ddd61cff5b643
Reviewed-on: https://skia-review.googlesource.com/87767
Commit-Queue: Ravi Mistry <rmistry@google.com>
Reviewed-by: Eric Boren <borenet@google.com>
Diffstat (limited to 'infra')
11 files changed, 485 insertions, 65 deletions
diff --git a/infra/bots/gen_tasks.go b/infra/bots/gen_tasks.go index 53f0f0ec70..7c4a80ffb4 100644 --- a/infra/bots/gen_tasks.go +++ b/infra/bots/gen_tasks.go @@ -118,7 +118,7 @@ func linuxGceDimensions() []string { // deriveCompileTaskName returns the name of a compile task based on the given // job name. func deriveCompileTaskName(jobName string, parts map[string]string) string { - if jobName == "Housekeeper-Nightly-Bookmaker" { + if strings.Contains(jobName, "Bookmaker") { return "Build-Debian9-GCC-x86_64-Release" } else if parts["role"] == "Housekeeper" { return "Build-Debian9-GCC-x86_64-Release-Shared" @@ -1174,7 +1174,7 @@ func process(b *specs.TasksCfgBuilder, name string) { if name == "Housekeeper-PerCommit-CheckGeneratedFiles" { deps = append(deps, checkGeneratedFiles(b, name)) } - if name == "Housekeeper-Nightly-Bookmaker" { + if strings.Contains(name, "Bookmaker") { deps = append(deps, bookmaker(b, name, compileTaskName)) } diff --git a/infra/bots/jobs.json b/infra/bots/jobs.json index 620a9622d5..9d3db0ba2f 100644 --- a/infra/bots/jobs.json +++ b/infra/bots/jobs.json @@ -91,6 +91,7 @@ "Housekeeper-Nightly-RecreateSKPs_Canary", "Housekeeper-Nightly-UpdateMetaConfig", "Housekeeper-PerCommit", + "Housekeeper-PerCommit-Bookmaker", "Housekeeper-PerCommit-BundleRecipes", "Housekeeper-PerCommit-CheckGeneratedFiles", "Housekeeper-PerCommit-InfraTests", diff --git a/infra/bots/recipes/bookmaker.expected/bookmaker.json b/infra/bots/recipes/bookmaker.expected/nightly_bookmaker.json index 8b6809bd26..8b6809bd26 100644 --- a/infra/bots/recipes/bookmaker.expected/bookmaker.json +++ b/infra/bots/recipes/bookmaker.expected/nightly_bookmaker.json diff --git a/infra/bots/recipes/bookmaker.expected/failed_extract_fiddles.json b/infra/bots/recipes/bookmaker.expected/nightly_failed_extract_fiddles.json index 05ef73d2b4..05ef73d2b4 100644 --- a/infra/bots/recipes/bookmaker.expected/failed_extract_fiddles.json +++ b/infra/bots/recipes/bookmaker.expected/nightly_failed_extract_fiddles.json diff --git a/infra/bots/recipes/bookmaker.expected/failed_fiddlecli.json b/infra/bots/recipes/bookmaker.expected/nightly_failed_fiddlecli.json index 51e7ad93e4..51e7ad93e4 100644 --- a/infra/bots/recipes/bookmaker.expected/failed_fiddlecli.json +++ b/infra/bots/recipes/bookmaker.expected/nightly_failed_fiddlecli.json diff --git a/infra/bots/recipes/bookmaker.expected/failed_fiddles.json b/infra/bots/recipes/bookmaker.expected/nightly_failed_fiddles.json index 30f6b19892..30f6b19892 100644 --- a/infra/bots/recipes/bookmaker.expected/failed_fiddles.json +++ b/infra/bots/recipes/bookmaker.expected/nightly_failed_fiddles.json diff --git a/infra/bots/recipes/bookmaker.expected/failed_upload.json b/infra/bots/recipes/bookmaker.expected/nightly_failed_upload.json index 521c65df97..521c65df97 100644 --- a/infra/bots/recipes/bookmaker.expected/failed_upload.json +++ b/infra/bots/recipes/bookmaker.expected/nightly_failed_upload.json diff --git a/infra/bots/recipes/bookmaker.expected/percommit_bookmaker.json b/infra/bots/recipes/bookmaker.expected/percommit_bookmaker.json new file mode 100644 index 0000000000..1e8959e1cf --- /dev/null +++ b/infra/bots/recipes/bookmaker.expected/percommit_bookmaker.json @@ -0,0 +1,167 @@ +[ + { + "cmd": [ + "python", + "-u", + "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py", + "--json-output", + "/path/to/tmp/json", + "ensure-directory", + "--mode", + "0777", + "[CUSTOM_/_B_WORK]" + ], + "infra_step": true, + "name": "makedirs checkout_path" + }, + { + "cmd": [ + "python", + "-u", + "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py", + "--json-output", + "/path/to/tmp/json", + "remove", + "[CUSTOM_/_B_WORK]/.gclient_entries" + ], + "infra_step": true, + "name": "remove [CUSTOM_/_B_WORK]/.gclient_entries" + }, + { + "cmd": [ + "python", + "-u", + "RECIPE_MODULE[depot_tools::bot_update]/resources/bot_update.py", + "--spec-path", + "cache_dir = '[CUSTOM_/_B_CACHE]'\nsolutions = [{'deps_file': '.DEPS.git', 'managed': False, 'name': 'skia', 'url': 'https://skia.googlesource.com/skia.git'}]", + "--patch_root", + "skia", + "--revision_mapping_file", + "{\"got_revision\": \"skia\"}", + "--git-cache-dir", + "[CUSTOM_/_B_CACHE]", + "--cleanup-dir", + "[CLEANUP]/bot_update", + "--output_json", + "/path/to/tmp/json", + "--revision", + "skia@abc123" + ], + "cwd": "[CUSTOM_/_B_WORK]", + "env_prefixes": { + "PATH": [ + "RECIPE_PACKAGE_REPO[depot_tools]" + ] + }, + "infra_step": true, + "name": "bot_update", + "~followup_annotations": [ + "@@@STEP_TEXT@Some step text@@@", + "@@@STEP_LOG_LINE@json.output@{@@@", + "@@@STEP_LOG_LINE@json.output@ \"did_run\": true, @@@", + "@@@STEP_LOG_LINE@json.output@ \"fixed_revisions\": {@@@", + "@@@STEP_LOG_LINE@json.output@ \"skia\": \"abc123\"@@@", + "@@@STEP_LOG_LINE@json.output@ }, @@@", + "@@@STEP_LOG_LINE@json.output@ \"manifest\": {@@@", + "@@@STEP_LOG_LINE@json.output@ \"skia\": {@@@", + "@@@STEP_LOG_LINE@json.output@ \"repository\": \"https://fake.org/skia.git\", @@@", + "@@@STEP_LOG_LINE@json.output@ \"revision\": \"9046e2e693bb92a76e972b694580e5d17ad10748\"@@@", + "@@@STEP_LOG_LINE@json.output@ }@@@", + "@@@STEP_LOG_LINE@json.output@ }, @@@", + "@@@STEP_LOG_LINE@json.output@ \"patch_failure\": false, @@@", + "@@@STEP_LOG_LINE@json.output@ \"patch_root\": \"skia\", @@@", + "@@@STEP_LOG_LINE@json.output@ \"properties\": {@@@", + "@@@STEP_LOG_LINE@json.output@ \"got_revision\": \"9046e2e693bb92a76e972b694580e5d17ad10748\", @@@", + "@@@STEP_LOG_LINE@json.output@ \"got_revision_cp\": \"refs/heads/master@{#164710}\"@@@", + "@@@STEP_LOG_LINE@json.output@ }, @@@", + "@@@STEP_LOG_LINE@json.output@ \"root\": \"skia\", @@@", + "@@@STEP_LOG_LINE@json.output@ \"source_manifest\": {@@@", + "@@@STEP_LOG_LINE@json.output@ \"directories\": {@@@", + "@@@STEP_LOG_LINE@json.output@ \"skia\": {@@@", + "@@@STEP_LOG_LINE@json.output@ \"git_checkout\": {@@@", + "@@@STEP_LOG_LINE@json.output@ \"repo_url\": \"https://fake.org/skia.git\", @@@", + "@@@STEP_LOG_LINE@json.output@ \"revision\": \"9046e2e693bb92a76e972b694580e5d17ad10748\"@@@", + "@@@STEP_LOG_LINE@json.output@ }@@@", + "@@@STEP_LOG_LINE@json.output@ }@@@", + "@@@STEP_LOG_LINE@json.output@ }, @@@", + "@@@STEP_LOG_LINE@json.output@ \"version\": 0@@@", + "@@@STEP_LOG_LINE@json.output@ }, @@@", + "@@@STEP_LOG_LINE@json.output@ \"step_text\": \"Some step text\"@@@", + "@@@STEP_LOG_LINE@json.output@}@@@", + "@@@STEP_LOG_END@json.output@@@", + "@@@SET_BUILD_PROPERTY@got_revision@\"9046e2e693bb92a76e972b694580e5d17ad10748\"@@@", + "@@@SET_BUILD_PROPERTY@got_revision_cp@\"refs/heads/master@{#164710}\"@@@" + ] + }, + { + "cmd": [ + "[START_DIR]/go/go/bin/go", + "version" + ], + "env": { + "BUILDTYPE": "Release", + "CHROME_HEADLESS": "1", + "GOPATH": "[START_DIR]/gopath", + "GOROOT": "[START_DIR]/go/go", + "PATH": "[START_DIR]/go/go/bin:[START_DIR]/gopath:<PATH>:RECIPE_PACKAGE_REPO[depot_tools]", + "SKIA_OUT": "[START_DIR]/out" + }, + "name": "go version" + }, + { + "cmd": [ + "go", + "version" + ], + "env": { + "BUILDTYPE": "Release", + "CHROME_HEADLESS": "1", + "GOPATH": "[START_DIR]/gopath", + "GOROOT": "[START_DIR]/go/go", + "PATH": "[START_DIR]/go/go/bin:[START_DIR]/gopath:<PATH>:RECIPE_PACKAGE_REPO[depot_tools]", + "SKIA_OUT": "[START_DIR]/out" + }, + "name": "env go version" + }, + { + "cmd": [ + "[START_DIR]/go/go/bin/go", + "get", + "-u", + "-t", + "go.skia.org/infra/fiddle/go/fiddlecli" + ], + "env": { + "BUILDTYPE": "Release", + "CHROME_HEADLESS": "1", + "GOPATH": "[START_DIR]/gopath", + "GOROOT": "[START_DIR]/go/go", + "PATH": "[START_DIR]/go/go/bin:[START_DIR]/gopath:<PATH>:RECIPE_PACKAGE_REPO[depot_tools]", + "SKIA_OUT": "[START_DIR]/out" + }, + "name": "go get fiddlecli" + }, + { + "cmd": [ + "[START_DIR]/out/Release/bookmaker", + "-a", + "docs/status.json", + "-x" + ], + "cwd": "[CUSTOM_/_B_WORK]/skia", + "env": { + "BUILDTYPE": "Release", + "CHROME_HEADLESS": "1", + "GOPATH": "[START_DIR]/gopath", + "GOROOT": "[START_DIR]/go/go", + "PATH": "[START_DIR]/go/go/bin:[START_DIR]/gopath:<PATH>:RECIPE_PACKAGE_REPO[depot_tools]", + "SKIA_OUT": "[START_DIR]/out" + }, + "name": "Validate docs match include/core/*.h" + }, + { + "name": "$result", + "recipe_result": null, + "status_code": 0 + } +]
\ No newline at end of file diff --git a/infra/bots/recipes/bookmaker.expected/percommit_failed_validation.json b/infra/bots/recipes/bookmaker.expected/percommit_failed_validation.json new file mode 100644 index 0000000000..ca2b369349 --- /dev/null +++ b/infra/bots/recipes/bookmaker.expected/percommit_failed_validation.json @@ -0,0 +1,172 @@ +[ + { + "cmd": [ + "python", + "-u", + "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py", + "--json-output", + "/path/to/tmp/json", + "ensure-directory", + "--mode", + "0777", + "[CUSTOM_/_B_WORK]" + ], + "infra_step": true, + "name": "makedirs checkout_path" + }, + { + "cmd": [ + "python", + "-u", + "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py", + "--json-output", + "/path/to/tmp/json", + "remove", + "[CUSTOM_/_B_WORK]/.gclient_entries" + ], + "infra_step": true, + "name": "remove [CUSTOM_/_B_WORK]/.gclient_entries" + }, + { + "cmd": [ + "python", + "-u", + "RECIPE_MODULE[depot_tools::bot_update]/resources/bot_update.py", + "--spec-path", + "cache_dir = '[CUSTOM_/_B_CACHE]'\nsolutions = [{'deps_file': '.DEPS.git', 'managed': False, 'name': 'skia', 'url': 'https://skia.googlesource.com/skia.git'}]", + "--patch_root", + "skia", + "--revision_mapping_file", + "{\"got_revision\": \"skia\"}", + "--git-cache-dir", + "[CUSTOM_/_B_CACHE]", + "--cleanup-dir", + "[CLEANUP]/bot_update", + "--output_json", + "/path/to/tmp/json", + "--revision", + "skia@abc123" + ], + "cwd": "[CUSTOM_/_B_WORK]", + "env_prefixes": { + "PATH": [ + "RECIPE_PACKAGE_REPO[depot_tools]" + ] + }, + "infra_step": true, + "name": "bot_update", + "~followup_annotations": [ + "@@@STEP_TEXT@Some step text@@@", + "@@@STEP_LOG_LINE@json.output@{@@@", + "@@@STEP_LOG_LINE@json.output@ \"did_run\": true, @@@", + "@@@STEP_LOG_LINE@json.output@ \"fixed_revisions\": {@@@", + "@@@STEP_LOG_LINE@json.output@ \"skia\": \"abc123\"@@@", + "@@@STEP_LOG_LINE@json.output@ }, @@@", + "@@@STEP_LOG_LINE@json.output@ \"manifest\": {@@@", + "@@@STEP_LOG_LINE@json.output@ \"skia\": {@@@", + "@@@STEP_LOG_LINE@json.output@ \"repository\": \"https://fake.org/skia.git\", @@@", + "@@@STEP_LOG_LINE@json.output@ \"revision\": \"9046e2e693bb92a76e972b694580e5d17ad10748\"@@@", + "@@@STEP_LOG_LINE@json.output@ }@@@", + "@@@STEP_LOG_LINE@json.output@ }, @@@", + "@@@STEP_LOG_LINE@json.output@ \"patch_failure\": false, @@@", + "@@@STEP_LOG_LINE@json.output@ \"patch_root\": \"skia\", @@@", + "@@@STEP_LOG_LINE@json.output@ \"properties\": {@@@", + "@@@STEP_LOG_LINE@json.output@ \"got_revision\": \"9046e2e693bb92a76e972b694580e5d17ad10748\", @@@", + "@@@STEP_LOG_LINE@json.output@ \"got_revision_cp\": \"refs/heads/master@{#164710}\"@@@", + "@@@STEP_LOG_LINE@json.output@ }, @@@", + "@@@STEP_LOG_LINE@json.output@ \"root\": \"skia\", @@@", + "@@@STEP_LOG_LINE@json.output@ \"source_manifest\": {@@@", + "@@@STEP_LOG_LINE@json.output@ \"directories\": {@@@", + "@@@STEP_LOG_LINE@json.output@ \"skia\": {@@@", + "@@@STEP_LOG_LINE@json.output@ \"git_checkout\": {@@@", + "@@@STEP_LOG_LINE@json.output@ \"repo_url\": \"https://fake.org/skia.git\", @@@", + "@@@STEP_LOG_LINE@json.output@ \"revision\": \"9046e2e693bb92a76e972b694580e5d17ad10748\"@@@", + "@@@STEP_LOG_LINE@json.output@ }@@@", + "@@@STEP_LOG_LINE@json.output@ }@@@", + "@@@STEP_LOG_LINE@json.output@ }, @@@", + "@@@STEP_LOG_LINE@json.output@ \"version\": 0@@@", + "@@@STEP_LOG_LINE@json.output@ }, @@@", + "@@@STEP_LOG_LINE@json.output@ \"step_text\": \"Some step text\"@@@", + "@@@STEP_LOG_LINE@json.output@}@@@", + "@@@STEP_LOG_END@json.output@@@", + "@@@SET_BUILD_PROPERTY@got_revision@\"9046e2e693bb92a76e972b694580e5d17ad10748\"@@@", + "@@@SET_BUILD_PROPERTY@got_revision_cp@\"refs/heads/master@{#164710}\"@@@" + ] + }, + { + "cmd": [ + "[START_DIR]/go/go/bin/go", + "version" + ], + "env": { + "BUILDTYPE": "Release", + "CHROME_HEADLESS": "1", + "GOPATH": "[START_DIR]/gopath", + "GOROOT": "[START_DIR]/go/go", + "PATH": "[START_DIR]/go/go/bin:[START_DIR]/gopath:<PATH>:RECIPE_PACKAGE_REPO[depot_tools]", + "SKIA_OUT": "[START_DIR]/out" + }, + "name": "go version" + }, + { + "cmd": [ + "go", + "version" + ], + "env": { + "BUILDTYPE": "Release", + "CHROME_HEADLESS": "1", + "GOPATH": "[START_DIR]/gopath", + "GOROOT": "[START_DIR]/go/go", + "PATH": "[START_DIR]/go/go/bin:[START_DIR]/gopath:<PATH>:RECIPE_PACKAGE_REPO[depot_tools]", + "SKIA_OUT": "[START_DIR]/out" + }, + "name": "env go version" + }, + { + "cmd": [ + "[START_DIR]/go/go/bin/go", + "get", + "-u", + "-t", + "go.skia.org/infra/fiddle/go/fiddlecli" + ], + "env": { + "BUILDTYPE": "Release", + "CHROME_HEADLESS": "1", + "GOPATH": "[START_DIR]/gopath", + "GOROOT": "[START_DIR]/go/go", + "PATH": "[START_DIR]/go/go/bin:[START_DIR]/gopath:<PATH>:RECIPE_PACKAGE_REPO[depot_tools]", + "SKIA_OUT": "[START_DIR]/out" + }, + "name": "go get fiddlecli" + }, + { + "cmd": [ + "[START_DIR]/out/Release/bookmaker", + "-a", + "docs/status.json", + "-x" + ], + "cwd": "[CUSTOM_/_B_WORK]/skia", + "env": { + "BUILDTYPE": "Release", + "CHROME_HEADLESS": "1", + "GOPATH": "[START_DIR]/gopath", + "GOROOT": "[START_DIR]/go/go", + "PATH": "[START_DIR]/go/go/bin:[START_DIR]/gopath:<PATH>:RECIPE_PACKAGE_REPO[depot_tools]", + "SKIA_OUT": "[START_DIR]/out" + }, + "name": "Validate docs match include/core/*.h", + "~followup_annotations": [ + "step returned non-zero exit code: 1", + "@@@STEP_FAILURE@@@" + ] + }, + { + "name": "$result", + "reason": "Step('Validate docs match include/core/*.h') failed with return_code 1\n\nView the output of the \"Validate docs match include/core/*.h\" step to see how to get this bot green.\n\nhttps://skia.org/user/api/usingBookmaker details how to build and run the bookmaker utility locally if needed.", + "recipe_result": null, + "status_code": 1 + } +]
\ No newline at end of file diff --git a/infra/bots/recipes/bookmaker.py b/infra/bots/recipes/bookmaker.py index bc8b7e72cf..6b9d56424d 100644 --- a/infra/bots/recipes/bookmaker.py +++ b/infra/bots/recipes/bookmaker.py @@ -50,64 +50,84 @@ def RunSteps(api): with api.context(cwd=api.vars.skia_dir, env=api.infra.go_env): bookmaker_binary = api.path.join(api.vars.skia_out, api.vars.configuration, 'bookmaker') - fiddlecli_binary = api.path.join(api.infra.gopath, 'bin', 'fiddlecli') - fiddlecli_input = api.path.join(api.path['start_dir'], 'fiddle.json') - fiddlecli_output = api.path.join(api.path['start_dir'], 'fiddleout.json') - - # Step 1: Extract all fiddles out of markdown files. - cmd = [bookmaker_binary, - '-a', 'docs/status.json', # File containing status of documentation. - '-e', fiddlecli_input, # Fiddle cli input. - ] - api.run(api.step, 'Extract all fiddles out of md files', cmd=cmd) - - # Step 2: Forces fiddle.skia.org to compile all fiddles extracted out of - # markdown files and get output in JSON. - cmd = [fiddlecli_binary, - '--input', fiddlecli_input, - '--output', fiddlecli_output, - '--logtostderr', - '--force', - ] - api.run(api.step, 'Force fiddle to compile all examples', cmd=cmd) - - # Step 3: Scan the output of fiddlecli for any compiletime/runtime errors. - # Fail the recipe is there are any errors and summarize results at - # the end. - if api.path.exists(fiddlecli_output): - test_data = api.properties.get('fiddleout_test_data', '{}') - content = api.file.read_text('Read fiddleout.json', - fiddlecli_output, test_data=test_data) - out = json.loads(content) - # Do a dump of fiddlecli_output. Will be useful for debugging. - print 'Dump of %s:' % fiddlecli_output - print json.dumps(out, indent=4) - - failing_fiddles = [] - for fiddle_name in out: - props = out[fiddle_name] - if props['compile_errors'] or props['runtime_error']: - failing_fiddles.append(props['fiddleHash']) - if failing_fiddles: - # create an eror message and fail the bot! - failure_msg = 'The following fiddles failed:\n\n' - for fiddle_hash in failing_fiddles: - failure_msg += 'https://fiddle.skia.org/c/%s\n' % fiddle_hash - raise api.step.StepFailure(failure_msg) - - # Step 4: Update docs in site/user/api/ with the output of fiddlecli. - # If there are any new changes then upload and commit the changes. - update_docs_gitcookies = api.path['start_dir'].join( - UPDATE_DOCS_GITCOOKIES_FILE) - cmd = ['python', - api.vars.skia_dir.join('infra', 'bots', 'upload_md.py'), - '--bookmaker_binary', bookmaker_binary, - '--fiddlecli_output', fiddlecli_output, - '--gitcookies', str(update_docs_gitcookies)] - with api.infra.DownloadGitCookies( - UPDATE_DOCS_GITCOOKIES_GS_PATH, update_docs_gitcookies, api): - with api.context(cwd=api.vars.skia_dir, env=api.infra.go_env): - api.run(api.step, 'Generate and Upload Markdown files', cmd=cmd) + buildername = api.vars.builder_name + + if 'PerCommit' in buildername: + # Check to see if docs matches include/core. + cmd = [bookmaker_binary, + '-a', 'docs/status.json', # File containing status of docs. + '-x', # Check bmh against includes. + ] + try: + api.run(api.step, 'Validate docs match include/core/*.h', cmd=cmd) + except api.step.StepFailure as e: + # Display what needs to be fixed. + e.reason += ( + '\n\nView the output of the "Validate docs match include/core/*.h" ' + 'step to see how to get this bot green.' + '\n\nhttps://skia.org/user/api/usingBookmaker details how to build ' + 'and run the bookmaker utility locally if needed.') + raise e + + elif 'Nightly' in buildername: + fiddlecli_binary = api.path.join(api.infra.gopath, 'bin', 'fiddlecli') + fiddlecli_input = api.path.join(api.path['start_dir'], 'fiddle.json') + fiddlecli_output = api.path.join(api.path['start_dir'], 'fiddleout.json') + + # Step 1: Extract all fiddles out of markdown files. + cmd = [bookmaker_binary, + '-a', 'docs/status.json', # File containing status of docs. + '-e', fiddlecli_input, # Fiddle cli input. + ] + api.run(api.step, 'Extract all fiddles out of md files', cmd=cmd) + + # Step 2: Forces fiddle.skia.org to compile all fiddles extracted out of + # markdown files and get output in JSON. + cmd = [fiddlecli_binary, + '--input', fiddlecli_input, + '--output', fiddlecli_output, + '--logtostderr', + '--force', + ] + api.run(api.step, 'Force fiddle to compile all examples', cmd=cmd) + + # Step 3: Scan the output of fiddlecli for any compiletime/runtime errors. + # Fail the recipe is there are any errors and summarize results at + # the end. + if api.path.exists(fiddlecli_output): + test_data = api.properties.get('fiddleout_test_data', '{}') + content = api.file.read_text('Read fiddleout.json', + fiddlecli_output, test_data=test_data) + out = json.loads(content) + # Do a dump of fiddlecli_output. Will be useful for debugging. + print 'Dump of %s:' % fiddlecli_output + print json.dumps(out, indent=4) + + failing_fiddles = [] + for fiddle_name in out: + props = out[fiddle_name] + if props['compile_errors'] or props['runtime_error']: + failing_fiddles.append(props['fiddleHash']) + if failing_fiddles: + # create an eror message and fail the bot! + failure_msg = 'The following fiddles failed:\n\n' + for fiddle_hash in failing_fiddles: + failure_msg += 'https://fiddle.skia.org/c/%s\n' % fiddle_hash + raise api.step.StepFailure(failure_msg) + + # Step 4: Update docs in site/user/api/ with the output of fiddlecli. + # If there are any new changes then upload and commit the changes. + update_docs_gitcookies = api.path['start_dir'].join( + UPDATE_DOCS_GITCOOKIES_FILE) + cmd = ['python', + api.vars.skia_dir.join('infra', 'bots', 'upload_md.py'), + '--bookmaker_binary', bookmaker_binary, + '--fiddlecli_output', fiddlecli_output, + '--gitcookies', str(update_docs_gitcookies)] + with api.infra.DownloadGitCookies( + UPDATE_DOCS_GITCOOKIES_GS_PATH, update_docs_gitcookies, api): + with api.context(cwd=api.vars.skia_dir, env=api.infra.go_env): + api.run(api.step, 'Generate and Upload Markdown files', cmd=cmd) def GenTests(api): @@ -122,7 +142,26 @@ def GenTests(api): "runtime_error": "runtime error"}} """ yield ( - api.test('bookmaker') + + api.test('percommit_bookmaker') + + api.properties(buildername='Housekeeper-PerCommit-Bookmaker', + repository='https://skia.googlesource.com/skia.git', + revision='abc123', + path_config='kitchen', + swarm_out_dir='[SWARM_OUT_DIR]') + ) + + yield ( + api.test('percommit_failed_validation') + + api.properties(buildername='Housekeeper-PerCommit-Bookmaker', + repository='https://skia.googlesource.com/skia.git', + revision='abc123', + path_config='kitchen', + swarm_out_dir='[SWARM_OUT_DIR]') + + api.step_data('Validate docs match include/core/*.h', retcode=1) + ) + + yield ( + api.test('nightly_bookmaker') + api.properties(buildername='Housekeeper-Nightly-Bookmaker', repository='https://skia.googlesource.com/skia.git', revision='abc123', @@ -134,7 +173,7 @@ def GenTests(api): ) yield ( - api.test('failed_fiddles') + + api.test('nightly_failed_fiddles') + api.properties(buildername='Housekeeper-Nightly-Bookmaker', repository='https://skia.googlesource.com/skia.git', revision='abc123', @@ -145,7 +184,7 @@ def GenTests(api): ) yield ( - api.test('failed_extract_fiddles') + + api.test('nightly_failed_extract_fiddles') + api.properties(buildername='Housekeeper-Nightly-Bookmaker', repository='https://skia.googlesource.com/skia.git', revision='abc123', @@ -155,7 +194,7 @@ def GenTests(api): ) yield ( - api.test('failed_fiddlecli') + + api.test('nightly_failed_fiddlecli') + api.properties(buildername='Housekeeper-Nightly-Bookmaker', repository='https://skia.googlesource.com/skia.git', revision='abc123', @@ -165,7 +204,7 @@ def GenTests(api): ) yield ( - api.test('failed_upload') + + api.test('nightly_failed_upload') + api.properties(buildername='Housekeeper-Nightly-Bookmaker', repository='https://skia.googlesource.com/skia.git', revision='abc123', diff --git a/infra/bots/tasks.json b/infra/bots/tasks.json index 53bcfade31..18750396a6 100644 --- a/infra/bots/tasks.json +++ b/infra/bots/tasks.json @@ -560,6 +560,12 @@ "Housekeeper-PerCommit" ] }, + "Housekeeper-PerCommit-Bookmaker": { + "priority": 0.8, + "tasks": [ + "Housekeeper-PerCommit-Bookmaker" + ] + }, "Housekeeper-PerCommit-BundleRecipes": { "priority": 0.8, "tasks": [ @@ -5629,6 +5635,41 @@ "isolate": "housekeeper_skia.isolate", "priority": 0.8 }, + "Housekeeper-PerCommit-Bookmaker": { + "cipd_packages": [ + { + "name": "skia/bots/go", + "path": "go", + "version": "version:3" + } + ], + "dependencies": [ + "Build-Debian9-GCC-x86_64-Release" + ], + "dimensions": [ + "cpu:x86-64-Haswell_GCE", + "gpu:none", + "os:Debian-9.2", + "pool:Skia" + ], + "execution_timeout_ns": 7200000000000, + "extra_args": [ + "--workdir", + "../../..", + "bookmaker", + "repository=<(REPO)", + "buildername=Housekeeper-PerCommit-Bookmaker", + "swarm_out_dir=${ISOLATED_OUTDIR}", + "revision=<(REVISION)", + "patch_repo=<(PATCH_REPO)", + "patch_storage=<(PATCH_STORAGE)", + "patch_issue=<(ISSUE)", + "patch_set=<(PATCHSET)" + ], + "io_timeout_ns": 7200000000000, + "isolate": "compile_skia.isolate", + "priority": 0.8 + }, "Housekeeper-PerCommit-BundleRecipes": { "cipd_packages": [ { |