skia2/infra/bots/recipes/update_meta_config.py
Eric Boren f94514b0ff [recipes] Copy file, isolate, swarming, swarming_client from build.git
Rename swarming -> skia_swarming.
Some required heavy modification to remove other dependencies on modules
in build.git.

Expected changes:

- RECIPE_MODULE[build::<module>] -> RECIPE_MODULE[skia::<module>]
- No more runit; directly run through Python.

Bug: skia:6628
Change-Id: I1b1370ed387966222ce10731771dbde9020cf542
Reviewed-on: https://skia-review.googlesource.com/17448
Commit-Queue: Eric Boren <borenet@google.com>
Reviewed-by: Ravi Mistry <rmistry@google.com>
2017-05-22 13:08:25 +00:00

89 lines
2.6 KiB
Python

# Copyright 2017 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Recipe for the Bot that updates meta config."""
DEPS = [
'depot_tools/gclient',
'file',
'recipe_engine/context',
'recipe_engine/path',
'recipe_engine/properties',
'recipe_engine/python',
'recipe_engine/raw_io',
'recipe_engine/step',
'core',
'infra',
'run',
'vars',
]
TEST_BUILDERS = {
'client.skia.compile': {
'skiabot-linux-swarm-000': [
'Housekeeper-Nightly-UpdateMetaConfig',
],
},
}
UPDATE_META_CONFIG_GITCOOKIES_FILE = 'update_meta_config.git_cookies'
UPDATE_META_CONFIG_KEY = 'update_meta_config_git_cookies'
def RunSteps(api):
api.core.setup()
if api.vars.is_trybot:
raise Exception('Cannot run update_meta_config recipe as a trybot')
update_meta_config_gitcookies = api.path.join(
api.path.expanduser('~'), UPDATE_META_CONFIG_GITCOOKIES_FILE)
repo_name = api.properties.get('repository').split('/')[-1].rstrip('.git')
cmd = ['python',
api.vars.skia_dir.join('infra', 'bots', 'update_meta_config.py'),
'--repo_name', repo_name,
'--tasks_json', api.vars.skia_dir.join('infra', 'bots', 'tasks.json'),
'--gitcookies', str(update_meta_config_gitcookies)]
with api.infra.MetadataFetch(
api, UPDATE_META_CONFIG_KEY, UPDATE_META_CONFIG_GITCOOKIES_FILE):
with api.context(cwd=api.vars.skia_dir):
api.run(api.step, 'Update meta/config', cmd=cmd)
def GenTests(api):
builder = 'Housekeeper-Nightly-UpdateMetaConfig'
yield (
api.test(builder) +
api.properties(buildername=builder,
repository='https://skia.googlesource.com/skia.git',
revision='abc123',
path_config='kitchen',
swarm_out_dir='[SWARM_OUT_DIR]')
)
yield (
api.test('failed_update') +
api.properties(buildername=builder,
repository='https://skia.googlesource.com/skia.git',
revision='abc123',
path_config='kitchen',
swarm_out_dir='[SWARM_OUT_DIR]') +
api.step_data('Update meta/config', retcode=1)
)
yield (
api.test('trybot_test') +
api.properties(buildername=builder,
repository='https://skia.googlesource.com/skia.git',
revision='abc123',
path_config='kitchen',
swarm_out_dir='[SWARM_OUT_DIR]',
patch_issue=123,
patch_set=3) +
api.expect_exception('Exception')
)