Skip to content

Commit 570431c

Browse files
committed
Merge branch 'main' into dean/more-rate-limit-flags
2 parents 91da46f + ab7e676 commit 570431c

File tree

111 files changed

+7129
-5137
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+7129
-5137
lines changed

.github/workflows/packages.yaml

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,11 @@ jobs:
1515
run: |
1616
Invoke-WebRequest https://aka.ms/wingetcreate/latest -OutFile wingetcreate.exe
1717
18-
# the package version is the same as the release tag without the leading
19-
# "v", and with a trailing ".0" (e.g. "v1.2.3" -> "1.2.3.0")
18+
# The package version is the same as the tag minus the leading "v".
2019
- name: Calculate package version
2120
id: version
2221
run: |
2322
$version = $env:CODER_VERSION -replace "^v", ""
24-
$version += ".0"
2523
echo "::set-output name=version::$version"
2624
2725
- name: Submit updated manifest to winget-pkgs
@@ -35,17 +33,30 @@ jobs:
3533
3634
echo "Installer URL: $installer_url"
3735
36+
# The URL "|X64" suffix forces the architecture as it cannot be
37+
# sniffed properly from the URL. wingetcreate checks both the URL and
38+
# binary magic bytes for the architecture and they need to both match,
39+
# but they only check for `x64`, `win64` and `_64` in the URL. Our URL
40+
# contains `amd64` which doesn't match sadly.
41+
#
42+
# wingetcreate will still do the binary magic bytes check, so if we
43+
# accidentally change the architecture of the installer, it will fail
44+
# submission.
3845
.\wingetcreate.exe update Coder.Coder `
3946
--submit `
4047
--version "${{ steps.version.outputs.version }}" `
41-
--urls "$installer_url" `
48+
--urls "${installer_url}|X64" `
4249
--token "${{ secrets.CDRCI_GITHUB_TOKEN }}"
4350
51+
env:
52+
# For gh CLI:
53+
GH_TOKEN: ${{ github.token }}
54+
4455
- name: Comment on PR
4556
run: |
4657
# find the PR that wingetcreate just made
4758
$pr_list = gh pr list --repo microsoft/winget-pkgs --search "author:cdrci Coder.Coder version ${{ steps.version.outputs.version }}" --limit 1 --json number | `
4859
ConvertFrom-Json`
4960
$pr_number = $pr_list[0].number
5061
51-
gh pr comment --repo microsoft/winget-pkgs "$pr_number" --body "🤖 cc: @deansheather"
62+
gh pr comment --repo microsoft/winget-pkgs "$pr_number" --body "🤖 cc: @deansheather @matifali"

cli/deployment/config.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,12 @@ func newConfig() *codersdk.DeploymentConfig {
248248
Flag: "oidc-ignore-email-verified",
249249
Default: false,
250250
},
251+
UsernameField: &codersdk.DeploymentConfigField[string]{
252+
Name: "OIDC Username Field",
253+
Usage: "OIDC claim field to use as the username.",
254+
Flag: "oidc-username-field",
255+
Default: "preferred_username",
256+
},
251257
},
252258

253259
Telemetry: &codersdk.TelemetryConfig{
@@ -356,12 +362,6 @@ func newConfig() *codersdk.DeploymentConfig {
356362
Flag: "ssh-keygen-algorithm",
357363
Default: "ed25519",
358364
},
359-
AutoImportTemplates: &codersdk.DeploymentConfigField[[]string]{
360-
Name: "Auto Import Templates",
361-
Usage: "Templates to auto-import. Available auto-importable templates are: kubernetes",
362-
Flag: "auto-import-template",
363-
Hidden: true,
364-
},
365365
MetricsCacheRefreshInterval: &codersdk.DeploymentConfigField[time.Duration]{
366366
Name: "Metrics Cache Refresh Interval",
367367
Usage: "How frequently metrics are refreshed",

cli/server.go

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -379,27 +379,6 @@ func Server(vip *viper.Viper, newAPI func(context.Context, *coderd.Options) (*co
379379
return xerrors.Errorf("parse ssh keygen algorithm %s: %w", cfg.SSHKeygenAlgorithm.Value, err)
380380
}
381381

382-
// Validate provided auto-import templates.
383-
var (
384-
validatedAutoImportTemplates = make([]coderd.AutoImportTemplate, len(cfg.AutoImportTemplates.Value))
385-
seenValidatedAutoImportTemplates = make(map[coderd.AutoImportTemplate]struct{}, len(cfg.AutoImportTemplates.Value))
386-
)
387-
for i, autoImportTemplate := range cfg.AutoImportTemplates.Value {
388-
var v coderd.AutoImportTemplate
389-
switch autoImportTemplate {
390-
case "kubernetes":
391-
v = coderd.AutoImportTemplateKubernetes
392-
default:
393-
return xerrors.Errorf("auto import template %q is not supported", autoImportTemplate)
394-
}
395-
396-
if _, ok := seenValidatedAutoImportTemplates[v]; ok {
397-
return xerrors.Errorf("auto import template %q is specified more than once", v)
398-
}
399-
seenValidatedAutoImportTemplates[v] = struct{}{}
400-
validatedAutoImportTemplates[i] = v
401-
}
402-
403382
defaultRegion := &tailcfg.DERPRegion{
404383
EmbeddedRelay: true,
405384
RegionID: cfg.DERP.Server.RegionID.Value,
@@ -457,7 +436,6 @@ func Server(vip *viper.Viper, newAPI func(context.Context, *coderd.Options) (*co
457436
SSHKeygenAlgorithm: sshKeygenAlgorithm,
458437
TracerProvider: tracerProvider,
459438
Telemetry: telemetry.NewNoop(),
460-
AutoImportTemplates: validatedAutoImportTemplates,
461439
MetricsCacheRefreshInterval: cfg.MetricsCacheRefreshInterval.Value,
462440
AgentStatsRefreshInterval: cfg.AgentStatRefreshInterval.Value,
463441
DeploymentConfig: cfg,
@@ -536,8 +514,9 @@ func Server(vip *viper.Viper, newAPI func(context.Context, *coderd.Options) (*co
536514
Verifier: oidcProvider.Verifier(&oidc.Config{
537515
ClientID: cfg.OIDC.ClientID.Value,
538516
}),
539-
EmailDomain: cfg.OIDC.EmailDomain.Value,
540-
AllowSignups: cfg.OIDC.AllowSignups.Value,
517+
EmailDomain: cfg.OIDC.EmailDomain.Value,
518+
AllowSignups: cfg.OIDC.AllowSignups.Value,
519+
UsernameField: cfg.OIDC.UsernameField.Value,
541520
}
542521
}
543522

cli/testdata/coder_server_--help.golden

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,9 @@ Flags:
131131
OIDC.
132132
Consumes $CODER_OIDC_SCOPES (default
133133
[openid,profile,email])
134+
--oidc-username-field string OIDC claim field to use as the username.
135+
Consumes $CODER_OIDC_USERNAME_FIELD
136+
(default "preferred_username")
134137
--postgres-url string URL of a PostgreSQL database. If empty,
135138
PostgreSQL binaries will be downloaded
136139
from Maven

0 commit comments

Comments
 (0)