aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/asset/storage.go
diff options
context:
space:
mode:
authorAleksandr Nogikh <nogikh@google.com>2023-05-12 15:26:38 +0200
committerAleksandr Nogikh <wp32pw@gmail.com>2023-05-15 10:58:51 +0200
commitf174396014c87ad0b8e4b03465b418e3394d0bd1 (patch)
treea42dcb5ce53529fab101cf531929dcf90a89baf2 /pkg/asset/storage.go
parente9f324cf6d085e7e9b87302e5f9df84199b240b0 (diff)
pkg/asset: support deprecation in the many buckets case
If several syz-cis with different GCS buckets for assets are connected to a single dashboard, we currently face problems during the asset deprecation process. If we receive from the dashboard a valid GCS URL that belong to an unknown bucket, don't abort the process. Just ignore the URL. Test this behavior.
Diffstat (limited to 'pkg/asset/storage.go')
-rw-r--r--pkg/asset/storage.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/pkg/asset/storage.go b/pkg/asset/storage.go
index 6905b0a07..1debdaa4a 100644
--- a/pkg/asset/storage.go
+++ b/pkg/asset/storage.go
@@ -205,6 +205,8 @@ func (e *FileExistsError) Error() string {
return fmt.Sprintf("asset exists: %s", e.Path)
}
+var ErrUnknownBucket = errors.New("the asset is not in the currently managed bucket")
+
const deletionEmbargo = time.Hour * 24 * 7
// Best way: convert download URLs to paths.
@@ -217,7 +219,10 @@ func (storage *Storage) DeprecateAssets() error {
needed := map[string]bool{}
for _, url := range resp.DownloadURLs {
path, err := storage.backend.getPath(url)
- if err != nil {
+ if err == ErrUnknownBucket {
+ // The asset is not managed by the particular instance.
+ continue
+ } else if err != nil {
// If we failed to parse just one URL, let's stop the entire process.
// Otherwise we'll start deleting still needed files we couldn't recognize.
return fmt.Errorf("failed to parse '%s': %w", url, err)