Skip to content

Commit 569049b

Browse files
committed
add specific blob not found check
1 parent 493dda5 commit 569049b

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

libs/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ go 1.21.6
44

55
require (
66
cloud.google.com/go/storage v1.46.0
7+
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.0
78
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.8.0
89
github.com/Azure/azure-sdk-for-go/sdk/data/aztables v1.2.0
910
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.6.0
@@ -54,7 +55,6 @@ require (
5455
dario.cat/mergo v1.0.0 // indirect
5556
filippo.io/age v1.0.0 // indirect
5657
github.com/Azure/azure-sdk-for-go v63.3.0+incompatible // indirect
57-
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.0 // indirect
5858
github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect
5959
github.com/Azure/go-autorest v14.2.0+incompatible // indirect
6060
github.com/Azure/go-autorest/autorest v0.11.26 // indirect

libs/storage/azure_plan_storage.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import (
88
"path/filepath"
99

1010
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob"
11+
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/bloberror"
12+
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
1113
)
1214

1315
type PlanStorageAzure struct {
@@ -27,6 +29,13 @@ func (psa *PlanStorageAzure) PlanExists(artifactName string, storedPlanFilePath
2729
// Get the blob properties
2830
resp, err := blobClient.GetProperties(psa.Context, nil)
2931
if err != nil {
32+
if azErr, ok := err.(*azcore.ResponseError); ok && string(azErr.ErrorCode) == string(bloberror.BlobNotFound) {
33+
slog.Debug("Blob not found",
34+
"container", psa.ContainerName,
35+
"path", storedPlanFilePath,
36+
"artifactName", artifactName)
37+
return false, nil
38+
}
3039
slog.Error("Failed to get blob properties",
3140
"container", psa.ContainerName,
3241
"path", storedPlanFilePath,

0 commit comments

Comments
 (0)