[PATCH] builds secrets: Indicate if a secret was shared
Export this patch
---
builds.go | 5 +++++
srht/buildssrht/gql.go | 2 +-
srht/buildssrht/operations.graphql | 3 +++
3 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/builds.go b/builds.go
index 687e211..8894c2e 100644
--- a/builds.go
@@ -659,6 +659,11 @@ func printSecret(w io.Writer, secret *buildssrht.Secret) {
var s string
created := termfmt.Dim.String(humanize.Time(secret.Created.Time))
s += fmt.Sprintf("%s\t%s\n", termfmt.DarkYellow.Sprint(secret.Uuid), created)
+
+ if secret.FromUser != nil {
+ s += termfmt.Dim.Sprintf("Shared by %s\n", secret.FromUser.CanonicalName)
+ }
+
if secret.Name != nil && *secret.Name != "" {
s += fmt.Sprintf("%s\n", *secret.Name)
}
diff --git a/srht/buildssrht/gql.go b/srht/buildssrht/gql.go
index d093e08..b760262 100644
--- a/srht/buildssrht/gql.go
+++ b/srht/buildssrht/gql.go
@@ -645,7 +645,7 @@ func Show(client *gqlclient.Client, ctx context.Context, id int32) (job *Job, er
}
func Secrets(client *gqlclient.Client, ctx context.Context, cursor *Cursor) (secrets *SecretCursor, err error) {
- op := gqlclient.NewOperation("query secrets ($cursor: Cursor) {\n\tsecrets(cursor: $cursor) {\n\t\tresults {\n\t\t\tcreated\n\t\t\tuuid\n\t\t\tname\n\t\t\t__typename\n\t\t\t... on SecretFile {\n\t\t\t\tpath\n\t\t\t\tmode\n\t\t\t}\n\t\t}\n\t\tcursor\n\t}\n}\n")
+ op := gqlclient.NewOperation("query secrets ($cursor: Cursor) {\n\tsecrets(cursor: $cursor) {\n\t\tresults {\n\t\t\tcreated\n\t\t\tuuid\n\t\t\tname\n\t\t\tfromUser {\n\t\t\t\tcanonicalName\n\t\t\t}\n\t\t\t__typename\n\t\t\t... on SecretFile {\n\t\t\t\tpath\n\t\t\t\tmode\n\t\t\t}\n\t\t}\n\t\tcursor\n\t}\n}\n")
op.Var("cursor", cursor)
var respData struct {
Secrets *SecretCursor
diff --git a/srht/buildssrht/operations.graphql b/srht/buildssrht/operations.graphql
index 10f96b4..cccae73 100644
--- a/srht/buildssrht/operations.graphql
+++ b/srht/buildssrht/operations.graphql
@@ -142,6 +142,9 @@ query secrets($cursor: Cursor) {
created
uuid
name
+ fromUser {
+ canonicalName
+ }
__typename
... on SecretFile {
path
base-commit: 79f13c07bf884d8091acd65d7e9cff9839ef5a54
--
2.42.0
Pushed, thanks!