Skip to content

Commit f1f6dcd

Browse files
committed
Merge branch 'main' into callum-linter
Signed-off-by: Callum Styan <[email protected]>
2 parents ab6e974 + 3a54a31 commit f1f6dcd

File tree

14 files changed

+139
-31
lines changed

14 files changed

+139
-31
lines changed

cmd/readmevalidation/contributors.go

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,13 @@ import (
1515
var validContributorStatuses = []string{"official", "partner", "community"}
1616

1717
type contributorProfileFrontmatter struct {
18-
DisplayName string `yaml:"display_name"`
19-
Bio string `yaml:"bio"`
20-
ContributorStatus string `yaml:"status"`
21-
// Script assumes that if avatar URL is nil, the Registry site build step
22-
// will backfill the value with the user's GitHub avatar URL.
23-
AvatarURL *string `yaml:"avatar"`
24-
LinkedinURL *string `yaml:"linkedin"`
25-
WebsiteURL *string `yaml:"website"`
26-
SupportEmail *string `yaml:"support_email"`
18+
DisplayName string `yaml:"display_name"`
19+
Bio string `yaml:"bio"`
20+
ContributorStatus string `yaml:"status"`
21+
AvatarURL *string `yaml:"avatar"`
22+
LinkedinURL *string `yaml:"linkedin"`
23+
WebsiteURL *string `yaml:"website"`
24+
SupportEmail *string `yaml:"support_email"`
2725
}
2826

2927
type contributorProfileReadme struct {
@@ -274,11 +272,8 @@ func aggregateContributorReadmeFiles() ([]readme, error) {
274272
func validateContributorRelativeUrls(contributors map[string]contributorProfileReadme) error {
275273
// This function only validates relative avatar URLs for now, but it can be
276274
// beefed up to validate more in the future.
277-
errs := []error{}
278-
275+
var errs []error
279276
for _, con := range contributors {
280-
// If the avatar URL is missing, we'll just assume that the Registry
281-
// site build step will take care of filling in the data properly.
282277
if con.frontmatter.AvatarURL == nil {
283278
continue
284279
}
@@ -289,16 +284,18 @@ func validateContributorRelativeUrls(contributors map[string]contributorProfileR
289284
continue
290285
}
291286

292-
if strings.HasPrefix(*con.frontmatter.AvatarURL, "..") {
287+
isAvatarInApprovedSpot := strings.HasPrefix(*con.frontmatter.AvatarURL, "./.images/") ||
288+
strings.HasPrefix(*con.frontmatter.AvatarURL, ".images/")
289+
if !isAvatarInApprovedSpot {
293290
errs = append(errs, xerrors.Errorf("%q: relative avatar URLs cannot be placed outside a user's namespaced directory", con.filePath))
294291
continue
295292
}
296293

297294
absolutePath := strings.TrimSuffix(con.filePath, "README.md") +
298295
*con.frontmatter.AvatarURL
299-
_, err := os.ReadFile(absolutePath)
296+
_, err := os.Stat(absolutePath)
300297
if err != nil {
301-
errs = append(errs, xerrors.Errorf("%q: relative avatar path %q does not point to image in file system", con.filePath, *con.frontmatter.AvatarURL))
298+
errs = append(errs, xerrors.Errorf("%q: relative avatar path %q does not point to image in file system", con.filePath, absolutePath))
302299
}
303300
}
304301

cmd/readmevalidation/main.go

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,30 @@
66
package main
77

88
import (
9-
"fmt"
9+
"context"
1010
"log"
1111
"os"
12+
13+
"cdr.dev/slog"
14+
"cdr.dev/slog/sloggers/sloghuman"
1215
)
1316

17+
var logger = slog.Make(sloghuman.Sink(os.Stdout))
18+
1419
func main() {
15-
log.Println("Starting README validation")
20+
logger.Info(context.Background(), "starting README validation")
1621

1722
// If there are fundamental problems with how the repo is structured, we
1823
// can't make any guarantees that any further validations will be relevant
1924
// or accurate.
20-
repoErr := validateRepoStructure()
21-
if repoErr != nil {
22-
log.Println(repoErr)
25+
err := validateRepoStructure()
26+
if err != nil {
27+
log.Println(err)
2328
os.Exit(1)
2429
}
2530

2631
var errs []error
27-
err := validateAllContributorFiles()
32+
err = validateAllContributorFiles()
2833
if err != nil {
2934
errs = append(errs, err)
3035
}
@@ -34,11 +39,11 @@ func main() {
3439
}
3540

3641
if len(errs) == 0 {
37-
log.Printf("Processed all READMEs in the %q directory\n", rootRegistryPath)
42+
logger.Info(context.Background(), "processed all READMEs in directory", "dir", rootRegistryPath)
3843
os.Exit(0)
3944
}
4045
for _, err := range errs {
41-
fmt.Println(err)
46+
logger.Error(context.Background(), err.Error())
4247
}
4348
os.Exit(1)
4449
}

go.mod

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,24 @@ module coder.com/coder-registry
33
go 1.23.2
44

55
require (
6+
cdr.dev/slog v1.6.1
67
github.com/quasilyte/go-ruleguard/dsl v0.3.22
78
golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da
89
gopkg.in/yaml.v3 v3.0.1
910
)
11+
12+
require (
13+
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
14+
github.com/charmbracelet/lipgloss v0.7.1 // indirect
15+
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
16+
github.com/mattn/go-isatty v0.0.19 // indirect
17+
github.com/mattn/go-runewidth v0.0.15 // indirect
18+
github.com/muesli/reflow v0.3.0 // indirect
19+
github.com/muesli/termenv v0.15.2 // indirect
20+
github.com/rivo/uniseg v0.4.4 // indirect
21+
go.opentelemetry.io/otel v1.16.0 // indirect
22+
go.opentelemetry.io/otel/trace v1.16.0 // indirect
23+
golang.org/x/crypto v0.35.0 // indirect
24+
golang.org/x/sys v0.30.0 // indirect
25+
golang.org/x/term v0.29.0 // indirect
26+
)

go.sum

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,79 @@
1+
cdr.dev/slog v1.6.1 h1:IQjWZD0x6//sfv5n+qEhbu3wBkmtBQY5DILXNvMaIv4=
2+
cdr.dev/slog v1.6.1/go.mod h1:eHEYQLaZvxnIAXC+XdTSNLb/kgA/X2RVSF72v5wsxEI=
3+
cloud.google.com/go/compute v1.23.0 h1:tP41Zoavr8ptEqaW6j+LQOnyBBhO7OkOMAGrgLopTwY=
4+
cloud.google.com/go/compute v1.23.0/go.mod h1:4tCnrn48xsqlwSAiLf1HXMQk8CONslYbdiEZc9FEIbM=
5+
cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY=
6+
cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA=
7+
cloud.google.com/go/logging v1.7.0 h1:CJYxlNNNNAMkHp9em/YEXcfJg+rPDg7YfwoRpMU+t5I=
8+
cloud.google.com/go/logging v1.7.0/go.mod h1:3xjP2CjkM3ZkO73aj4ASA5wRPGGCRrPIAeNqVNkzY8M=
9+
cloud.google.com/go/longrunning v0.5.1 h1:Fr7TXftcqTudoyRJa113hyaqlGdiBQkp0Gq7tErFDWI=
10+
cloud.google.com/go/longrunning v0.5.1/go.mod h1:spvimkwdz6SPWKEt/XBij79E9fiTkHSQl/fRUUQJYJc=
11+
github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k=
12+
github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8=
13+
github.com/charmbracelet/lipgloss v0.7.1 h1:17WMwi7N1b1rVWOjMT+rCh7sQkvDU75B2hbZpc5Kc1E=
14+
github.com/charmbracelet/lipgloss v0.7.1/go.mod h1:yG0k3giv8Qj8edTCbbg6AlQ5e8KNWpFujkNawKNhE2c=
15+
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
16+
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
17+
github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ=
18+
github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
19+
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
20+
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
21+
github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg=
22+
github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
23+
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
24+
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
25+
github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY=
26+
github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
27+
github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA=
28+
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
29+
github.com/mattn/go-runewidth v0.0.12/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk=
30+
github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U=
31+
github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
32+
github.com/muesli/reflow v0.3.0 h1:IFsN6K9NfGtjeggFP+68I4chLZV2yIKsXJFNZ+eWh6s=
33+
github.com/muesli/reflow v0.3.0/go.mod h1:pbwTDkVPibjO2kyvBQRBxTWEEGDGq0FlB1BIKtnHY/8=
34+
github.com/muesli/termenv v0.15.2 h1:GohcuySI0QmI3wN8Ok9PtKGkgkFIk7y6Vpb5PvrY+Wo=
35+
github.com/muesli/termenv v0.15.2/go.mod h1:Epx+iuz8sNs7mNKhxzH4fWXGNpZwUaJKRS1noLXviQ8=
36+
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
37+
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
138
github.com/quasilyte/go-ruleguard/dsl v0.3.22 h1:wd8zkOhSNr+I+8Qeciml08ivDt1pSXe60+5DqOpCjPE=
239
github.com/quasilyte/go-ruleguard/dsl v0.3.22/go.mod h1:KeCP03KrjuSO0H1kTuZQCWlQPulDV6YMIXmpQss17rU=
40+
github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
41+
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
42+
github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis=
43+
github.com/rivo/uniseg v0.4.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
44+
github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY=
45+
github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
46+
go.opentelemetry.io/otel v1.16.0 h1:Z7GVAX/UkAXPKsy94IU+i6thsQS4nb7LviLpnaNeW8s=
47+
go.opentelemetry.io/otel v1.16.0/go.mod h1:vl0h9NUa1D5s1nv3A5vZOYWn8av4K8Ml6JDeHrT/bx4=
48+
go.opentelemetry.io/otel/metric v1.16.0 h1:RbrpwVG1Hfv85LgnZ7+txXioPDoh6EdbZHo26Q3hqOo=
49+
go.opentelemetry.io/otel/metric v1.16.0/go.mod h1:QE47cpOmkwipPiefDwo2wDzwJrlfxxNYodqc4xnGCo4=
50+
go.opentelemetry.io/otel/sdk v1.16.0 h1:Z1Ok1YsijYL0CSJpHt4cS3wDDh7p572grzNrBMiMWgE=
51+
go.opentelemetry.io/otel/sdk v1.16.0/go.mod h1:tMsIuKXuuIWPBAOrH+eHtvhTL+SntFtXF9QD68aP6p4=
52+
go.opentelemetry.io/otel/trace v1.16.0 h1:8JRpaObFoW0pxuVPapkgH8UhHQj+bJW8jJsCZEu5MQs=
53+
go.opentelemetry.io/otel/trace v1.16.0/go.mod h1:Yt9vYq1SdNz3xdjZZK7wcXv1qv2pwLkqr2QVwea0ef0=
54+
golang.org/x/crypto v0.35.0 h1:b15kiHdrGCHrP6LvwaQ3c03kgNhhiMgvlhxHQhmg2Xs=
55+
golang.org/x/crypto v0.35.0/go.mod h1:dy7dXNW32cAb/6/PRuTNsix8T+vJAqvuIy5Bli/x0YQ=
56+
golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4=
57+
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
58+
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
59+
golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc=
60+
golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
61+
golang.org/x/term v0.29.0 h1:L6pJp37ocefwRRtYPKSWOWzOtWSxVajvz2ldH/xi3iU=
62+
golang.org/x/term v0.29.0/go.mod h1:6bl4lRlvVuDgSf3179VpIxBF0o10JUpXWOnI7nErv7s=
63+
golang.org/x/text v0.22.0 h1:bofq7m3/HAFvbF51jz3Q9wLg3jkvSPuiZu/pD1XwgtM=
64+
golang.org/x/text v0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY=
365
golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da h1:noIWHXmPHxILtqtCOPIhSt0ABwskkZKjD3bXGnZGpNY=
466
golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da/go.mod h1:NDW/Ps6MPRej6fsCIbMTohpP40sJ/P/vI1MoTEGwX90=
67+
google.golang.org/genproto v0.0.0-20230726155614-23370e0ffb3e h1:xIXmWJ303kJCuogpj0bHq+dcjcZHU+XFyc1I0Yl9cRg=
68+
google.golang.org/genproto v0.0.0-20230726155614-23370e0ffb3e/go.mod h1:0ggbjUrZYpy1q+ANUS30SEoGZ53cdfwtbuG7Ptgy108=
69+
google.golang.org/genproto/googleapis/api v0.0.0-20230706204954-ccb25ca9f130 h1:XVeBY8d/FaK4848myy41HBqnDwvxeV3zMZhwN1TvAMU=
70+
google.golang.org/genproto/googleapis/api v0.0.0-20230706204954-ccb25ca9f130/go.mod h1:mPBs5jNgx2GuQGvFwUvVKqtn6HsUw9nP64BedgvqEsQ=
71+
google.golang.org/genproto/googleapis/rpc v0.0.0-20230706204954-ccb25ca9f130 h1:2FZP5XuJY9zQyGM5N0rtovnoXjiMUEIUMvw0m9wlpLc=
72+
google.golang.org/genproto/googleapis/rpc v0.0.0-20230706204954-ccb25ca9f130/go.mod h1:8mL13HKkDa+IuJ8yruA3ci0q+0vsUz4m//+ottjwS5o=
73+
google.golang.org/grpc v1.57.0 h1:kfzNeI/klCGD2YPMUlaGNT3pxvYfga7smW3Vth8Zsiw=
74+
google.golang.org/grpc v1.57.0/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo=
75+
google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8=
76+
google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
577
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
678
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
779
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=

registry/coder/.images/avatar.png

22.3 KB
Loading

registry/coder/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
display_name: Coder
33
bio: Coder provisions cloud development environments via Terraform, supporting Linux, macOS, Windows, X86, ARM, Kubernetes and more.
44
github: coder
5+
avatar: ./.images/avatar.png
56
linkedin: https://www.linkedin.com/company/coderhq
67
website: https://www.coder.com
78
status: official

registry/coder/modules/vault-token/README.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,12 @@ variable "vault_token" {
2020
}
2121
2222
module "vault" {
23-
source = "registry.coder.com/coder/vault-token/coder"
24-
version = "1.1.0"
25-
agent_id = coder_agent.example.id
26-
vault_token = var.token # optional
27-
vault_addr = "https://vault.example.com"
23+
source = "registry.coder.com/coder/vault-token/coder"
24+
version = "1.2.0"
25+
agent_id = coder_agent.example.id
26+
vault_token = var.token # optional
27+
vault_addr = "https://vault.example.com"
28+
vault_namespace = "prod" # optional, vault enterprise only
2829
}
2930
```
3031

@@ -74,7 +75,7 @@ variable "vault_token" {
7475
7576
module "vault" {
7677
source = "registry.coder.com/coder/vault-token/coder"
77-
version = "1.1.0"
78+
version = "1.2.0"
7879
agent_id = coder_agent.example.id
7980
vault_addr = "https://vault.example.com"
8081
vault_token = var.token

registry/coder/modules/vault-token/main.tf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ variable "vault_token" {
2626
sensitive = true
2727
default = null
2828
}
29+
variable "vault_namespace" {
30+
type = string
31+
description = "The Vault namespace to use."
32+
default = null
33+
}
2934

3035
variable "vault_cli_version" {
3136
type = string
@@ -62,3 +67,10 @@ resource "coder_env" "vault_token" {
6267
name = "VAULT_TOKEN"
6368
value = var.vault_token
6469
}
70+
71+
resource "coder_env" "vault_namespace" {
72+
count = var.vault_namespace != null ? 1 : 0
73+
agent_id = var.agent_id
74+
name = "VAULT_NAMESPACE"
75+
value = var.vault_namespace
76+
}
121 KB
Loading

registry/nataindata/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
display_name: Nataindata
33
bio: Data engineer
44
github: nataindata
5+
avatar: ./.images/avatar.png
56
website: https://www.nataindata.com
67
status: community
78
---

0 commit comments

Comments
 (0)