• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2017 The Chromium Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5
6"""Recipe for the Bot that updates meta config."""
7
8
9DEPS = [
10  'depot_tools/gclient',
11  'recipe_engine/context',
12  'recipe_engine/file',
13  'recipe_engine/path',
14  'recipe_engine/properties',
15  'recipe_engine/python',
16  'recipe_engine/raw_io',
17  'recipe_engine/step',
18  'core',
19  'infra',
20  'run',
21  'vars',
22]
23
24
25TEST_BUILDERS = {
26  'client.skia.compile': {
27    'skiabot-linux-swarm-000': [
28      'Housekeeper-Nightly-UpdateMetaConfig',
29    ],
30  },
31}
32
33
34UPDATE_META_CONFIG_GITCOOKIES_FILE = 'update_meta_config.git_cookies'
35UPDATE_META_CONFIG_KEY = 'update_meta_config_git_cookies'
36
37
38def RunSteps(api):
39  api.core.setup()
40
41  if api.vars.is_trybot:
42    raise Exception('Cannot run update_meta_config recipe as a trybot')
43  update_meta_config_gitcookies = api.path.join(
44      api.path.expanduser('~'), UPDATE_META_CONFIG_GITCOOKIES_FILE)
45  repo_name = api.properties.get('repository').split('/')[-1].rstrip('.git')
46  cmd = ['python',
47         api.vars.skia_dir.join('infra', 'bots', 'update_meta_config.py'),
48         '--repo_name', repo_name,
49         '--tasks_json', api.vars.skia_dir.join('infra', 'bots', 'tasks.json'),
50         '--gitcookies', str(update_meta_config_gitcookies)]
51  with api.infra.MetadataFetch(
52      api, UPDATE_META_CONFIG_KEY, UPDATE_META_CONFIG_GITCOOKIES_FILE):
53    with api.context(cwd=api.vars.skia_dir):
54      api.run(api.step, 'Update meta/config', cmd=cmd)
55
56
57def GenTests(api):
58  builder = 'Housekeeper-Nightly-UpdateMetaConfig'
59  yield (
60      api.test(builder) +
61      api.properties(buildername=builder,
62                     repository='https://skia.googlesource.com/skia.git',
63                     revision='abc123',
64                     path_config='kitchen',
65                     swarm_out_dir='[SWARM_OUT_DIR]')
66  )
67
68  yield (
69      api.test('failed_update') +
70      api.properties(buildername=builder,
71                     repository='https://skia.googlesource.com/skia.git',
72                     revision='abc123',
73                     path_config='kitchen',
74                     swarm_out_dir='[SWARM_OUT_DIR]') +
75      api.step_data('Update meta/config', retcode=1)
76  )
77
78  yield (
79      api.test('trybot_test') +
80      api.properties(buildername=builder,
81                     repository='https://skia.googlesource.com/skia.git',
82                     revision='abc123',
83                     path_config='kitchen',
84                     swarm_out_dir='[SWARM_OUT_DIR]',
85                     patch_issue=123,
86                     patch_set=3) +
87      api.expect_exception('Exception')
88  )
89