blob: f02a7dc51f82e8dee1c230b1018bfdb306f00cfc [file] [log] [blame]
# -*- coding: utf-8 -*-
# Copyright 2020 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Copied from
# https://chromium.googlesource.com/chromiumos/infra/recipes/+/HEAD/recipe_modules/repo/
# pylint: disable=missing-module-docstring
DEPS = [
'fuchsia/status_check',
'pigweed/repo',
'recipe_engine/path',
]
PYTHON_VERSION_COMPATIBILITY = "PY3"
def RunSteps(api):
api.repo.ensure_synced_checkout(
api.path['cleanup'].join('ensure'), 'http://manifest_url'
)
def attempt_retry_repo(api, attempt): # pylint: disable=invalid-name
"""Step data for retries."""
if attempt == 1:
step_text = 'ensure synced checkout.repo init'
retcode = 128
else:
step_text = 'ensure synced checkout.clean up root path and retry'
retcode = 0
return api.step_data(step_text, retcode=retcode)
def GenTests(api):
yield (
api.status_check.test('repo_retry_success')
+ attempt_retry_repo(api, 1)
+ attempt_retry_repo(api, 2)
)