Skip to content

Commit f0a3147

Browse files
authored
Merge pull request #220 from nlamirault/feat/sops-errors
Add SOPS user error to logs
2 parents 5efc068 + 460eae2 commit f0a3147

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

controllers/kustomization_decryptor.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import (
2525
"os/exec"
2626

2727
securejoin "github.com/cyphar/filepath-securejoin"
28+
"go.mozilla.org/sops/v3"
2829
"go.mozilla.org/sops/v3/aes"
2930
"go.mozilla.org/sops/v3/cmd/sops/common"
3031
"go.mozilla.org/sops/v3/cmd/sops/formats"
@@ -87,6 +88,9 @@ func (kd *KustomizeDecryptor) Decrypt(res *resource.Resource) (*resource.Resourc
8788
},
8889
)
8990
if err != nil {
91+
if userErr, ok := err.(sops.UserError); ok {
92+
err = fmt.Errorf(userErr.UserError())
93+
}
9094
return nil, fmt.Errorf("GetDataKey: %w", err)
9195
}
9296

0 commit comments

Comments
 (0)