Skip to content

Commit fad45ae

Browse files
authored
chore: add repository name as prefix to actions in the catalog (#983)
This should make collisions with similarly named actions in other repositories more unlikely.
1 parent 62d1340 commit fad45ae

File tree

4 files changed

+60
-22
lines changed

4 files changed

+60
-22
lines changed

catalog-info.yaml

Lines changed: 39 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ metadata:
2121
links:
2222
- title: README
2323
url: https://github.com/grafana/shared-workflows/blob/main/actions/argo-lint/README.md
24-
name: argo-lint
24+
name: shared-workflows-argo-lint
2525
title: argo-lint
2626
spec:
2727
lifecycle: production
@@ -39,7 +39,7 @@ metadata:
3939
links:
4040
- title: README
4141
url: https://github.com/grafana/shared-workflows/blob/main/actions/aws-auth/README.md
42-
name: aws-auth
42+
name: shared-workflows-aws-auth
4343
title: aws-auth
4444
spec:
4545
lifecycle: production
@@ -57,14 +57,32 @@ metadata:
5757
links:
5858
- title: README
5959
url: https://github.com/grafana/shared-workflows/blob/main/actions/build-push-to-dockerhub/README.md
60-
name: build-push-to-dockerhub
60+
name: shared-workflows-build-push-to-dockerhub
6161
title: build-push-to-dockerhub
6262
spec:
6363
lifecycle: production
6464
owner: group:platform-productivity
6565
subcomponentOf: component:shared-workflows
6666
type: github-action
6767

68+
---
69+
apiVersion: backstage.io/v1alpha1
70+
kind: Component
71+
metadata:
72+
annotations:
73+
github.com/project-slug: grafana/shared-workflows
74+
description: Auto dismiss Dependabot alerts based on manifest path
75+
links:
76+
- title: README
77+
url: https://github.com/grafana/shared-workflows/blob/main/actions/dependabot-auto-triage/README.md
78+
name: shared-workflows-dependabot-auto-triage
79+
title: dependabot-auto-triage
80+
spec:
81+
lifecycle: production
82+
owner: group:platform-productivity
83+
subcomponentOf: component:shared-workflows
84+
type: github-action
85+
6886
---
6987
apiVersion: backstage.io/v1alpha1
7088
kind: Component
@@ -75,7 +93,7 @@ metadata:
7593
links:
7694
- title: README
7795
url: https://github.com/grafana/shared-workflows/blob/main/actions/dockerhub-login/README.md
78-
name: dockerhub-login
96+
name: shared-workflows-dockerhub-login
7997
title: dockerhub-login
8098
spec:
8199
lifecycle: production
@@ -93,7 +111,7 @@ metadata:
93111
links:
94112
- title: README
95113
url: https://github.com/grafana/shared-workflows/blob/main/actions/find-pr-for-commit/README.md
96-
name: find-pr-for-commit
114+
name: shared-workflows-find-pr-for-commit
97115
title: find-pr-for-commit
98116
spec:
99117
lifecycle: production
@@ -112,7 +130,7 @@ metadata:
112130
links:
113131
- title: README
114132
url: https://github.com/grafana/shared-workflows/blob/main/actions/generate-openapi-clients/README.md
115-
name: generate-openapi-clients
133+
name: shared-workflows-generate-openapi-clients
116134
title: generate-openapi-clients
117135
spec:
118136
lifecycle: production
@@ -130,7 +148,7 @@ metadata:
130148
links:
131149
- title: README
132150
url: https://github.com/grafana/shared-workflows/blob/main/actions/get-vault-secrets/README.md
133-
name: get-vault-secrets
151+
name: shared-workflows-get-vault-secrets
134152
title: get-vault-secrets
135153
spec:
136154
lifecycle: production
@@ -148,7 +166,7 @@ metadata:
148166
links:
149167
- title: README
150168
url: https://github.com/grafana/shared-workflows/blob/main/actions/lint-pr-title/README.md
151-
name: lint-pr-title
169+
name: shared-workflows-lint-pr-title
152170
title: lint-pr-title
153171
spec:
154172
lifecycle: production
@@ -166,7 +184,7 @@ metadata:
166184
links:
167185
- title: README
168186
url: https://github.com/grafana/shared-workflows/blob/main/actions/login-to-gar/README.md
169-
name: login-to-gar
187+
name: shared-workflows-login-to-gar
170188
title: login-to-gar
171189
spec:
172190
lifecycle: production
@@ -184,7 +202,7 @@ metadata:
184202
links:
185203
- title: README
186204
url: https://github.com/grafana/shared-workflows/blob/main/actions/login-to-gcs/README.md
187-
name: login-to-gcs
205+
name: shared-workflows-login-to-gcs
188206
title: login-to-gcs
189207
spec:
190208
lifecycle: production
@@ -202,7 +220,7 @@ metadata:
202220
links:
203221
- title: README
204222
url: https://github.com/grafana/shared-workflows/blob/main/actions/push-to-gar-docker/README.md
205-
name: push-to-gar-docker
223+
name: shared-workflows-push-to-gar-docker
206224
title: push-to-gar-docker
207225
spec:
208226
lifecycle: production
@@ -220,7 +238,7 @@ metadata:
220238
links:
221239
- title: README
222240
url: https://github.com/grafana/shared-workflows/blob/main/actions/push-to-gcs/README.md
223-
name: push-to-gcs
241+
name: shared-workflows-push-to-gcs
224242
title: push-to-gcs
225243
spec:
226244
lifecycle: production
@@ -234,10 +252,11 @@ kind: Component
234252
metadata:
235253
annotations:
236254
github.com/project-slug: grafana/shared-workflows
255+
description: This action removes credentials stored by the actions/checkout action
237256
links:
238257
- title: README
239258
url: https://github.com/grafana/shared-workflows/blob/main/actions/remove-checkout-credentials/README.md
240-
name: remove-checkout-credentials
259+
name: shared-workflows-remove-checkout-credentials
241260
title: remove-checkout-credentials
242261
spec:
243262
lifecycle: production
@@ -255,7 +274,7 @@ metadata:
255274
links:
256275
- title: README
257276
url: https://github.com/grafana/shared-workflows/blob/main/actions/send-slack-message/README.md
258-
name: send-slack-message
277+
name: shared-workflows-send-slack-message
259278
title: send-slack-message
260279
spec:
261280
lifecycle: production
@@ -274,7 +293,7 @@ metadata:
274293
links:
275294
- title: README
276295
url: https://github.com/grafana/shared-workflows/blob/main/actions/setup-argo/README.md
277-
name: setup-argo
296+
name: shared-workflows-setup-argo
278297
title: setup-argo
279298
spec:
280299
lifecycle: production
@@ -293,7 +312,7 @@ metadata:
293312
links:
294313
- title: README
295314
url: https://github.com/grafana/shared-workflows/blob/main/actions/setup-conftest/README.md
296-
name: setup-conftest
315+
name: shared-workflows-setup-conftest
297316
title: setup-conftest
298317
spec:
299318
lifecycle: production
@@ -312,7 +331,7 @@ metadata:
312331
links:
313332
- title: README
314333
url: https://github.com/grafana/shared-workflows/blob/main/actions/setup-jrsonnet/README.md
315-
name: setup-jrsonnet
334+
name: shared-workflows-setup-jrsonnet
316335
title: setup-jrsonnet
317336
spec:
318337
lifecycle: production
@@ -330,7 +349,7 @@ metadata:
330349
links:
331350
- title: README
332351
url: https://github.com/grafana/shared-workflows/blob/main/actions/techdocs-rewrite-relative-links/README.md
333-
name: techdocs-rewrite-relative-links
352+
name: shared-workflows-techdocs-rewrite-relative-links
334353
title: techdocs-rewrite-relative-links
335354
spec:
336355
lifecycle: production
@@ -348,7 +367,7 @@ metadata:
348367
links:
349368
- title: README
350369
url: https://github.com/grafana/shared-workflows/blob/main/actions/trigger-argo-workflow/README.md
351-
name: trigger-argo-workflow
370+
name: shared-workflows-trigger-argo-workflow
352371
title: trigger-argo-workflow
353372
spec:
354373
lifecycle: production
@@ -366,7 +385,7 @@ metadata:
366385
links:
367386
- title: README
368387
url: https://github.com/grafana/shared-workflows/blob/main/actions/validate-policy-bot-config/README.md
369-
name: validate-policy-bot-config
388+
name: shared-workflows-validate-policy-bot-config
370389
title: validate-policy-bot-config
371390
spec:
372391
lifecycle: production

scripts/generate-catalog-info/go.mod

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,14 @@ go 1.24.2
44

55
require (
66
github.com/hairyhenderson/go-codeowners v0.7.0
7+
k8s.io/apimachinery v0.33.0
78
sigs.k8s.io/yaml v1.4.0
89
)
910

1011
require (
12+
github.com/go-logr/logr v1.4.2 // indirect
1113
github.com/kr/text v0.2.0 // indirect
1214
github.com/rogpeppe/go-internal v1.14.1 // indirect
15+
k8s.io/klog/v2 v2.130.1 // indirect
16+
k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 // indirect
1317
)

scripts/generate-catalog-info/go.sum

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
22
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
33
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
4-
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
4+
github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY=
5+
github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
56
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
7+
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
8+
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
69
github.com/hairyhenderson/go-codeowners v0.7.0 h1:s0W4wF8bdsBEjTWzwzSlsatSthWtTAF2xLgo4a4RwAo=
710
github.com/hairyhenderson/go-codeowners v0.7.0/go.mod h1:wUlNgQ3QjqC4z8DnM5nnCYVq/icpqXJyJOukKx5U8/Q=
811
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
@@ -20,5 +23,11 @@ gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntN
2023
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
2124
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
2225
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
26+
k8s.io/apimachinery v0.33.0 h1:1a6kHrJxb2hs4t8EE5wuR/WxKDwGN1FKH3JvDtA0CIQ=
27+
k8s.io/apimachinery v0.33.0/go.mod h1:BHW0YOu7n22fFv/JkYOEfkUYNRN0fj0BlvMFWA7b+SM=
28+
k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk=
29+
k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE=
30+
k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 h1:M3sRQVHv7vB20Xc2ybTt7ODCeFj6JSWYFzOFnYeS6Ro=
31+
k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
2332
sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E=
2433
sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY=

scripts/generate-catalog-info/main.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"strings"
1212

1313
"github.com/hairyhenderson/go-codeowners"
14+
"k8s.io/apimachinery/pkg/util/validation"
1415
"sigs.k8s.io/yaml"
1516
)
1617

@@ -147,7 +148,7 @@ func main() {
147148
APIVersion: "backstage.io/v1alpha1",
148149
Kind: "Component",
149150
Metadata: CatalogInfoMetadata{
150-
Name: action.Slug,
151+
Name: "shared-workflows-" + action.Slug,
151152
Title: action.Slug,
152153
Description: action.Description,
153154
Annotations: map[string]string{
@@ -167,6 +168,11 @@ func main() {
167168
SubcomponentOf: "component:shared-workflows",
168169
},
169170
}
171+
172+
if errors := validation.IsQualifiedName(info.Metadata.Name); len(errors) > 0 {
173+
logger.Error("entity name invalid", "entity-name", info.Metadata.Name, "errors", errors)
174+
os.Exit(1)
175+
}
170176
err := writeYAML(&output, info)
171177
if err != nil {
172178
logger.Error("generating YAML failed", "err", err.Error())

0 commit comments

Comments
 (0)