You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
depot_tools/recipes/recipe_modules/bot_update/tests/ensure_checkout.py

36 lines
858 B
Python

# Copyright 2018 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.
from recipe_engine import post_process
DEPS = [
'bot_update',
'gclient',
'recipe_engine/json',
]
def RunSteps(api):
api.gclient.set_config('depot_tools')
api.bot_update.ensure_checkout()
Allow the bot_update api to not fetch tags from the git server. There are 3 layers modified, starting from the bottom up: 1. git_cache.py populate Now takes a --no-fetch-tags option. If specified, the cache will not fetch updated tags from the server by passing --no-tags to git fetch. This prevents the server from sending all the tag refs. In chromium this prevents significant time bottlenecks dealing with 10k+ tags. 2. bot_update.py bot_update has to deal with multiple git repos, it has the root repo that is checked out through git-cache, as well as repos synched via DEPS and gclient. The script now takes a --no_fetch_tags option. If specified, the git-cache populate call will include --no-fetch-tags. Otherwise, it won't. So this controls (for chromium) if fetches to the src.git server are passed --no-tags. 3. bot_update/api.py This is the entry point for recipes and also has to deal with multiple git repos. The behaviour at this point is not changed from the default. A |no_fetch_tags| parameter is added to ensure_checkout() that defaults to False. This CL is a refactor with no intended behavior change. The next step will be to change the chromium build repo to pass True for ensure_checkout(no_fetch_tags) on chromium trybots. This represents solution #2 in https://docs.google.com/document/d/1hDIunJjjfpmr50y3YnZ4o3aq1NZF4gJa1TS0p7AIL64/edit# Bug: 1019824 Change-Id: I935430603299daa9e301a95a5184c0ce486fd912 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1894352 Reviewed-by: Aaron Gable <agable@chromium.org> Reviewed-by: Erik Chen <erikchen@chromium.org> Commit-Queue: danakj <danakj@chromium.org> Auto-Submit: danakj <danakj@chromium.org>
6 years ago
api.bot_update.ensure_checkout(no_fetch_tags=True)
def GenTests(api):
yield (
api.test('basic') +
api.post_process(post_process.StatusSuccess) +
api.post_process(post_process.DropExpectation)
)
yield (
api.test('failure') +
api.override_step_data(
'bot_update',
api.json.output({'did_run': True}),
retcode=1) +
api.post_process(post_process.StatusAnyFailure) +
api.post_process(post_process.DropExpectation)
)