Skip to content

Commit 6fae365

Browse files
authored
Merge branch 'main' into cv-kasm
2 parents 1969cfb + 3a54a31 commit 6fae365

File tree

14 files changed

+145
-32
lines changed

14 files changed

+145
-32
lines changed

cmd/readmevalidation/contributors.go

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

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

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

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

298295
absolutePath := strings.TrimSuffix(con.filePath, "README.md") +
299296
*con.frontmatter.AvatarURL
300-
_, err := os.ReadFile(absolutePath)
297+
_, err := os.Stat(absolutePath)
301298
if err != nil {
302-
errs = append(errs, fmt.Errorf("%q: relative avatar path %q does not point to image in file system", con.filePath, *con.frontmatter.AvatarURL))
299+
errs = append(errs, fmt.Errorf("%q: path %q does not point to image in file system", con.filePath, absolutePath))
303300
}
304301
}
305302

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: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,24 @@ module coder.com/coder-registry
22

33
go 1.23.2
44

5-
require gopkg.in/yaml.v3 v3.0.1
5+
require (
6+
cdr.dev/slog v1.6.1
7+
gopkg.in/yaml.v3 v3.0.1
8+
)
9+
10+
require (
11+
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
12+
github.com/charmbracelet/lipgloss v0.7.1 // indirect
13+
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
14+
github.com/mattn/go-isatty v0.0.19 // indirect
15+
github.com/mattn/go-runewidth v0.0.15 // indirect
16+
github.com/muesli/reflow v0.3.0 // indirect
17+
github.com/muesli/termenv v0.15.2 // indirect
18+
github.com/rivo/uniseg v0.4.4 // indirect
19+
go.opentelemetry.io/otel v1.16.0 // indirect
20+
go.opentelemetry.io/otel/trace v1.16.0 // indirect
21+
golang.org/x/crypto v0.35.0 // indirect
22+
golang.org/x/sys v0.30.0 // indirect
23+
golang.org/x/term v0.29.0 // indirect
24+
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
25+
)

go.sum

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,77 @@
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=
38+
github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
39+
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
40+
github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis=
41+
github.com/rivo/uniseg v0.4.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
42+
github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY=
43+
github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
44+
go.opentelemetry.io/otel v1.16.0 h1:Z7GVAX/UkAXPKsy94IU+i6thsQS4nb7LviLpnaNeW8s=
45+
go.opentelemetry.io/otel v1.16.0/go.mod h1:vl0h9NUa1D5s1nv3A5vZOYWn8av4K8Ml6JDeHrT/bx4=
46+
go.opentelemetry.io/otel/metric v1.16.0 h1:RbrpwVG1Hfv85LgnZ7+txXioPDoh6EdbZHo26Q3hqOo=
47+
go.opentelemetry.io/otel/metric v1.16.0/go.mod h1:QE47cpOmkwipPiefDwo2wDzwJrlfxxNYodqc4xnGCo4=
48+
go.opentelemetry.io/otel/sdk v1.16.0 h1:Z1Ok1YsijYL0CSJpHt4cS3wDDh7p572grzNrBMiMWgE=
49+
go.opentelemetry.io/otel/sdk v1.16.0/go.mod h1:tMsIuKXuuIWPBAOrH+eHtvhTL+SntFtXF9QD68aP6p4=
50+
go.opentelemetry.io/otel/trace v1.16.0 h1:8JRpaObFoW0pxuVPapkgH8UhHQj+bJW8jJsCZEu5MQs=
51+
go.opentelemetry.io/otel/trace v1.16.0/go.mod h1:Yt9vYq1SdNz3xdjZZK7wcXv1qv2pwLkqr2QVwea0ef0=
52+
golang.org/x/crypto v0.35.0 h1:b15kiHdrGCHrP6LvwaQ3c03kgNhhiMgvlhxHQhmg2Xs=
53+
golang.org/x/crypto v0.35.0/go.mod h1:dy7dXNW32cAb/6/PRuTNsix8T+vJAqvuIy5Bli/x0YQ=
54+
golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4=
55+
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
56+
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
57+
golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc=
58+
golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
59+
golang.org/x/term v0.29.0 h1:L6pJp37ocefwRRtYPKSWOWzOtWSxVajvz2ldH/xi3iU=
60+
golang.org/x/term v0.29.0/go.mod h1:6bl4lRlvVuDgSf3179VpIxBF0o10JUpXWOnI7nErv7s=
61+
golang.org/x/text v0.22.0 h1:bofq7m3/HAFvbF51jz3Q9wLg3jkvSPuiZu/pD1XwgtM=
62+
golang.org/x/text v0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY=
63+
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 h1:H2TDz8ibqkAF6YGhCdN3jS9O0/s90v0rJh3X/OLHEUk=
64+
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8=
65+
google.golang.org/genproto v0.0.0-20230726155614-23370e0ffb3e h1:xIXmWJ303kJCuogpj0bHq+dcjcZHU+XFyc1I0Yl9cRg=
66+
google.golang.org/genproto v0.0.0-20230726155614-23370e0ffb3e/go.mod h1:0ggbjUrZYpy1q+ANUS30SEoGZ53cdfwtbuG7Ptgy108=
67+
google.golang.org/genproto/googleapis/api v0.0.0-20230706204954-ccb25ca9f130 h1:XVeBY8d/FaK4848myy41HBqnDwvxeV3zMZhwN1TvAMU=
68+
google.golang.org/genproto/googleapis/api v0.0.0-20230706204954-ccb25ca9f130/go.mod h1:mPBs5jNgx2GuQGvFwUvVKqtn6HsUw9nP64BedgvqEsQ=
69+
google.golang.org/genproto/googleapis/rpc v0.0.0-20230706204954-ccb25ca9f130 h1:2FZP5XuJY9zQyGM5N0rtovnoXjiMUEIUMvw0m9wlpLc=
70+
google.golang.org/genproto/googleapis/rpc v0.0.0-20230706204954-ccb25ca9f130/go.mod h1:8mL13HKkDa+IuJ8yruA3ci0q+0vsUz4m//+ottjwS5o=
71+
google.golang.org/grpc v1.57.0 h1:kfzNeI/klCGD2YPMUlaGNT3pxvYfga7smW3Vth8Zsiw=
72+
google.golang.org/grpc v1.57.0/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo=
73+
google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8=
74+
google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
175
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
276
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
377
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)