wrap call to m.dart.download_and_verify() in retry
Bug: https://github.com/flutter/flutter/issues/151791
Change-Id: Icf0df87233fe68948a5fdbf82310da638513d130
Reviewed-on: https://flutter-review.googlesource.com/c/recipes/+/58421
Commit-Queue: Christopher Fujino <fujino@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
diff --git a/recipe_modules/flutter_bcid/__init__.py b/recipe_modules/flutter_bcid/__init__.py
index 767e06f..ce4fd70 100644
--- a/recipe_modules/flutter_bcid/__init__.py
+++ b/recipe_modules/flutter_bcid/__init__.py
@@ -6,6 +6,7 @@
'dart/dart',
'depot_tools/gsutil',
'flutter/repo_util',
+ 'flutter/retry',
'recipe_engine/bcid_reporter',
'recipe_engine/buildbucket',
'recipe_engine/file',
diff --git a/recipe_modules/flutter_bcid/api.py b/recipe_modules/flutter_bcid/api.py
index 8a02a06..9c02d8b 100644
--- a/recipe_modules/flutter_bcid/api.py
+++ b/recipe_modules/flutter_bcid/api.py
@@ -76,9 +76,20 @@
with self.m.step.nest("Verify %s provenance" % filename):
verify_temp_path = self.m.path.mkdtemp("verify")
download_path = download_path = verify_temp_path.join(filename)
- bcid_response = self.m.dart.download_and_verify(
- filename, bucket, gcs_path_without_bucket, download_path,
- 'misc_software://flutter/engine'
+
+ def download_and_verify():
+ return self.m.dart.download_and_verify(
+ filename, bucket, gcs_path_without_bucket, download_path,
+ 'misc_software://flutter/engine'
+ )
+
+ # The provenance file may not have been uploaded yet:
+ # https://github.com/flutter/flutter/issues/151791
+ bcid_response = self.m.retry.wrap(
+ download_and_verify,
+ sleep=60,
+ backoff_factor=2,
+ max_attempts=4,
)
artifact_vsa = bcid_response['verificationSummary']