Commit 473499ba authored by Chong Gu's avatar Chong Gu Committed by LUCI CQ

[cipd] Add verification-timeout as a passable flag

For Fuchsia official builders, we need a way to increase
the verification timeout so that our packages are uploaded
successfully

Bug:1215771
Change-Id: Ie59dc149e2b88864afea1aaf6700a94324593196
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2973226
Commit-Queue: Chong Gu <chonggu@google.com>
Auto-Submit: Chong Gu <chonggu@google.com>
Reviewed-by: 's avatarDirk Pranke <dpranke@google.com>
parent 59140d43
......@@ -152,7 +152,7 @@ Args:
should use when installing this package. If None, defaults to the
platform default ('copy' on windows, 'symlink' on everything else).
&mdash; **def [create\_from\_pkg](/recipes/recipe_modules/cipd/api.py#332)(self, pkg_def, refs=None, tags=None):**
&mdash; **def [create\_from\_pkg](/recipes/recipe_modules/cipd/api.py#340)(self, pkg_def, refs=None, tags=None):**
Builds and uploads a package based on a PackageDefinition object.
......@@ -170,7 +170,7 @@ Returns the JSON 'result' section, e.g.: {
"instance_id": "433bfdf86c0bb82d1eee2d1a0473d3709c25d2c4"
}
&mdash; **def [create\_from\_yaml](/recipes/recipe_modules/cipd/api.py#312)(self, pkg_def, refs=None, tags=None):**
&mdash; **def [create\_from\_yaml](/recipes/recipe_modules/cipd/api.py#314)(self, pkg_def, refs=None, tags=None, verification_timeout=None):**
Builds and uploads a package based on on-disk YAML package definition
file.
......@@ -182,6 +182,10 @@ Args:
refs (list(str)) - A list of ref names to set for the package instance.
tags (dict(str, str)) - A map of tag name -> value to set for the package
instance.
verification_timeout (str) - Duration string that controls the time to
wait for backend-side package hash
verification. Valid time units are "ns",
"us", "ms", "s", "m", "h".
Returns the JSON 'result' section, e.g.: {
"package": "infra/tools/cipd/android-amd64",
......@@ -190,9 +194,9 @@ Returns the JSON 'result' section, e.g.: {
&emsp; **@property**<br>&mdash; **def [default\_bot\_service\_account\_credentials](/recipes/recipe_modules/cipd/api.py#200)(self):**
&mdash; **def [describe](/recipes/recipe_modules/cipd/api.py#439)(self, package_name, version, test_data_refs=None, test_data_tags=None):**
&mdash; **def [describe](/recipes/recipe_modules/cipd/api.py#447)(self, package_name, version, test_data_refs=None, test_data_tags=None):**
&mdash; **def [ensure](/recipes/recipe_modules/cipd/api.py#354)(self, root, packages):**
&mdash; **def [ensure](/recipes/recipe_modules/cipd/api.py#362)(self, root, packages):**
Ensures that packages are installed in a given root dir.
......@@ -221,13 +225,13 @@ parameters will be used.
&mdash; **def [register](/recipes/recipe_modules/cipd/api.py#264)(self, package_name, package_path, refs=None, tags=None):**
&mdash; **def [search](/recipes/recipe_modules/cipd/api.py#421)(self, package_name, tag):**
&mdash; **def [search](/recipes/recipe_modules/cipd/api.py#429)(self, package_name, tag):**
&mdash; **def [set\_ref](/recipes/recipe_modules/cipd/api.py#401)(self, package_name, version, refs):**
&mdash; **def [set\_ref](/recipes/recipe_modules/cipd/api.py#409)(self, package_name, version, refs):**
&mdash; **def [set\_service\_account\_credentials](/recipes/recipe_modules/cipd/api.py#193)(self, path):**
&mdash; **def [set\_tag](/recipes/recipe_modules/cipd/api.py#381)(self, package_name, version, tags):**
&mdash; **def [set\_tag](/recipes/recipe_modules/cipd/api.py#389)(self, package_name, version, tags):**
### *recipe_modules* / [depot\_tools](/recipes/recipe_modules/depot_tools)
[DEPS](/recipes/recipe_modules/depot_tools/__init__.py#5): [recipe\_engine/context][recipe_engine/recipe_modules/context], [recipe\_engine/platform][recipe_engine/recipe_modules/platform], [recipe\_engine/runtime][recipe_engine/recipe_modules/runtime]
......
......@@ -282,7 +282,7 @@ class CIPDApi(recipe_api.RecipeApi):
)
def _create(self, pkg_name, pkg_def_file_or_placeholder,
refs=None, tags=None):
refs=None, tags=None, verification_timeout=None):
refs = refs or []
tags = tags or {}
check_list_type('refs', refs, str)
......@@ -295,6 +295,8 @@ class CIPDApi(recipe_api.RecipeApi):
]
if self._cipd_credentials:
cmd.extend(['-service-account-json', self._cipd_credentials])
if verification_timeout:
cmd.extend(['-verification-timeout', verification_timeout])
for ref in refs:
cmd.extend(['-ref', ref])
for tag, value in sorted(tags.items()):
......@@ -309,7 +311,8 @@ class CIPDApi(recipe_api.RecipeApi):
'https://chrome-infra-packages.appspot.com/p/%(package)s/+/%(instance_id)s' % ret_data)
return ret_data
def create_from_yaml(self, pkg_def, refs=None, tags=None):
def create_from_yaml(self, pkg_def, refs=None, tags=None,
verification_timeout=None):
"""Builds and uploads a package based on on-disk YAML package definition
file.
......@@ -320,6 +323,10 @@ class CIPDApi(recipe_api.RecipeApi):
refs (list(str)) - A list of ref names to set for the package instance.
tags (dict(str, str)) - A map of tag name -> value to set for the package
instance.
verification_timeout (str) - Duration string that controls the time to
wait for backend-side package hash
verification. Valid time units are "ns",
"us", "ms", "s", "m", "h".
Returns the JSON 'result' section, e.g.: {
"package": "infra/tools/cipd/android-amd64",
......@@ -327,7 +334,8 @@ class CIPDApi(recipe_api.RecipeApi):
}
"""
check_type('pkg_def', pkg_def, Path)
return self._create(self.m.path.basename(pkg_def), pkg_def, refs, tags)
return self._create(self.m.path.basename(pkg_def), pkg_def, refs, tags,
verification_timeout)
def create_from_pkg(self, pkg_def, refs=None, tags=None):
"""Builds and uploads a package based on a PackageDefinition object.
......
......@@ -291,6 +291,8 @@
"/path/to/tmp/json",
"-service-account-json",
"fake-credentials.json",
"-verification-timeout",
"10m",
"-ref",
"fake-ref-1",
"-ref",
......
......@@ -291,6 +291,8 @@
"/path/to/tmp/json",
"-service-account-json",
"fake-credentials.json",
"-verification-timeout",
"10m",
"-ref",
"fake-ref-1",
"-ref",
......
......@@ -291,6 +291,8 @@
"/path/to/tmp/json",
"-service-account-json",
"fake-credentials.json",
"-verification-timeout",
"10m",
"-ref",
"fake-ref-1",
"-ref",
......
......@@ -291,6 +291,8 @@
"/path/to/tmp/json",
"-service-account-json",
"fake-credentials.json",
"-verification-timeout",
"10m",
"-ref",
"fake-ref-1",
"-ref",
......
......@@ -83,7 +83,8 @@ def RunSteps(api, use_pkg, pkg_files, pkg_dirs, ver_files, install_mode):
api.cipd.create_from_yaml(api.path['start_dir'].join('fake-package.yaml'),
refs=['fake-ref-1', 'fake-ref-2'],
tags={'fake_tag_1': 'fake_value_1',
'fake_tag_2': 'fake_value_2'})
'fake_tag_2': 'fake_value_2'},
verification_timeout='10m')
# Set tag or ref of an already existing package.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment