Correctly accumulate gs upload URLs

https://crrev.com/c/6796221 added a gsutil_urls output property that
provides the URLs of uploads to Google storage that were performed by
the build. It attempts to accumulate the URLs by updating a dictionary
on the result object's properties, but the properties on a step's
results object is empty when created, so it was just overriding the
property each time with a single element dict. This change keeps the
dict on the API object and updates it when an upload is performed so
that the final value includes all of the URLs produced by the build.

Change-Id: I6681ca7c137969cbef58e09ce24d0605155d2c3e
Recipe-Nontrivial-Roll: build
Recipe-Nontrivial-Roll: build_internal
Recipe-Nontrivial-Roll: chrome_release
Recipe-Nontrivial-Roll: chromiumos
Recipe-Nontrivial-Roll: infra
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6880970
Commit-Queue: Robbie Iannucci <iannucci@google.com>
Reviewed-by: Ben Pastene <bpastene@chromium.org>
Reviewed-by: Robbie Iannucci <iannucci@google.com>
Auto-Submit: Garrett Beaty <gbeaty@google.com>
changes/70/6880970/4
Garrett Beaty 3 months ago committed by LUCI CQ
parent ab44126935
commit 312d6a0313

@ -714,7 +714,7 @@ Generates a Gitiles repo URL. See also parse_repo_url.
#### **class [GSUtilApi](/recipes/recipe_modules/gsutil/api.py#10)([RecipeApi][recipe_engine/wkt/RecipeApi]):**
&mdash; **def [\_\_call\_\_](/recipes/recipe_modules/gsutil/api.py#21)(self, cmd, name=None, use_retry_wrapper=True, version=None, parallel_upload=False, multithreaded=False, infra_step=True, dry_run=False, \*\*kwargs):**
&mdash; **def [\_\_call\_\_](/recipes/recipe_modules/gsutil/api.py#22)(self, cmd, name=None, use_retry_wrapper=True, version=None, parallel_upload=False, multithreaded=False, infra_step=True, dry_run=False, \*\*kwargs):**
A step to run arbitrary gsutil commands.
@ -754,7 +754,7 @@ Args:
&mdash; **def [download\_url](/recipes/recipe_modules/gsutil/api.py#128)(self, url, dest, args=None, \*\*kwargs):**
&emsp; **@property**<br>&mdash; **def [gsutil\_py\_path](/recipes/recipe_modules/gsutil/api.py#17)(self):**
&emsp; **@property**<br>&mdash; **def [gsutil\_py\_path](/recipes/recipe_modules/gsutil/api.py#18)(self):**
&mdash; **def [list](/recipes/recipe_modules/gsutil/api.py#168)(self, url, args=None, \*\*kwargs):**
@ -764,7 +764,7 @@ Args:
&mdash; **def [stat](/recipes/recipe_modules/gsutil/api.py#142)(self, url, args=None, \*\*kwargs):**
&mdash; **def [upload](/recipes/recipe_modules/gsutil/api.py#98)(self, source, bucket, dest, args=None, link_name='gsutil.upload', metadata=None, unauthenticated_url=False, \*\*kwargs):**
&mdash; **def [upload](/recipes/recipe_modules/gsutil/api.py#99)(self, source, bucket, dest, args=None, link_name='gsutil.upload', metadata=None, unauthenticated_url=False, \*\*kwargs):**
### *recipe_modules* / [osx\_sdk](/recipes/recipe_modules/osx_sdk)
[DEPS](/recipes/recipe_modules/osx_sdk/__init__.py#6): [recipe\_engine/cipd][recipe_engine/recipe_modules/cipd], [recipe\_engine/context][recipe_engine/recipe_modules/context], [recipe\_engine/json][recipe_engine/recipe_modules/json], [recipe\_engine/path][recipe_engine/recipe_modules/path], [recipe\_engine/platform][recipe_engine/recipe_modules/platform], [recipe\_engine/properties][recipe_engine/recipe_modules/properties], [recipe\_engine/raw\_io][recipe_engine/recipe_modules/raw_io], [recipe\_engine/step][recipe_engine/recipe_modules/step], [recipe\_engine/version][recipe_engine/recipe_modules/version]

@ -13,6 +13,7 @@ class GSUtilApi(recipe_api.RecipeApi):
super(GSUtilApi, self).__init__(*args, **kwargs)
self._boto_config_path = env_properties.BOTO_CONFIG
self._boto_path = env_properties.BOTO_PATH
self._upload_urls = {}
@property
def gsutil_py_path(self):
@ -113,9 +114,8 @@ class GSUtilApi(recipe_api.RecipeApi):
is_directory=is_dir,
is_anonymous=unauthenticated_url)
result.presentation.links[link_name] = link
if 'gsutil_urls' not in result.presentation.properties:
result.presentation.properties['gsutil_urls'] = {}
result.presentation.properties['gsutil_urls'][result.name] = full_dest
self._upload_urls[result.name] = full_dest
result.presentation.properties['gsutil_urls'] = self._upload_urls
return result
def download(self, bucket, source, dest, args=None, **kwargs):

@ -51,7 +51,7 @@
"name": "gsutil upload (2)",
"~followup_annotations": [
"@@@STEP_LINK@gsutil.upload@https://storage.googleapis.com/example/some/random/path/to/boom@@@",
"@@@SET_BUILD_PROPERTY@gsutil_urls@{\"gsutil upload (2)\": \"gs://example/some/random/path/to/boom\"}@@@"
"@@@SET_BUILD_PROPERTY@gsutil_urls@{\"gsutil upload\": \"gs://example/some/random/path/to/boom\", \"gsutil upload (2)\": \"gs://example/some/random/path/to/boom\"}@@@"
]
},
{
@ -71,7 +71,7 @@
"name": "gsutil upload -r",
"~followup_annotations": [
"@@@STEP_LINK@gsutil.upload@https://console.cloud.google.com/storage/browser/example/some/random/path@@@",
"@@@SET_BUILD_PROPERTY@gsutil_urls@{\"gsutil upload -r\": \"gs://example/some/random/path\"}@@@"
"@@@SET_BUILD_PROPERTY@gsutil_urls@{\"gsutil upload\": \"gs://example/some/random/path/to/boom\", \"gsutil upload (2)\": \"gs://example/some/random/path/to/boom\", \"gsutil upload -r\": \"gs://example/some/random/path\"}@@@"
]
},
{
@ -91,7 +91,7 @@
"name": "gsutil upload --recursive",
"~followup_annotations": [
"@@@STEP_LINK@gsutil.upload@https://console.cloud.google.com/storage/browser/example/some/other/random/path@@@",
"@@@SET_BUILD_PROPERTY@gsutil_urls@{\"gsutil upload --recursive\": \"gs://example/some/other/random/path\"}@@@"
"@@@SET_BUILD_PROPERTY@gsutil_urls@{\"gsutil upload\": \"gs://example/some/random/path/to/boom\", \"gsutil upload (2)\": \"gs://example/some/random/path/to/boom\", \"gsutil upload --recursive\": \"gs://example/some/other/random/path\", \"gsutil upload -r\": \"gs://example/some/random/path\"}@@@"
]
},
{

Loading…
Cancel
Save