Skip to content

Commit 51a99c4

Browse files
authored
Merge branch 'main' into mafredri/fix-authorize-nil-error
2 parents 5fd6b2f + 9a0a6b7 commit 51a99c4

39 files changed

+1109
-45
lines changed

.github/workflows/coder.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ jobs:
428428
fetch-depth: 0
429429

430430
- name: Authenticate to Google Cloud
431-
uses: google-github-actions/auth@v0
431+
uses: google-github-actions/auth@v1
432432
with:
433433
workload_identity_provider: projects/573722524737/locations/global/workloadIdentityPools/github/providers/github
434434
service_account: coder-ci@coder-dogfood.iam.gserviceaccount.com

.github/workflows/dependabot.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ jobs:
99
permissions:
1010
pull-requests: write
1111
steps:
12-
- uses: hmarr/auto-approve-action@v2
12+
- uses: hmarr/auto-approve-action@v3
1313
if: github.actor == 'dependabot[bot]'

.github/workflows/dogfood.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
steps:
1818
- name: Get branch name
1919
id: branch-name
20-
uses: tj-actions/branch-names@v6.2
20+
uses: tj-actions/branch-names@v6.3
2121

2222
- name: "Branch name to Docker tag name"
2323
id: docker-tag-name

.github/workflows/release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ jobs:
170170
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
171171

172172
- name: Authenticate to Google Cloud
173-
uses: google-github-actions/auth@v0
173+
uses: google-github-actions/auth@v1
174174
with:
175175
workload_identity_provider: ${{ secrets.GCP_WORKLOAD_ID_PROVIDER }}
176176
service_account: ${{ secrets.GCP_SERVICE_ACCOUNT }}

.github/workflows/stale.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ jobs:
1717
with:
1818
stale-issue-label: 'stale'
1919
stale-pr-label: 'stale'
20-
exempt-issue-labels: 'never stale'
21-
exempt-pr-labels: 'never stale'
2220
# Pull Requests become stale more quickly due to merge conflicts.
2321
# Also, we promote minimizing WIP.
2422
days-before-pr-stale: 7

buildinfo/buildinfo.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@ func VersionsMatch(v1, v2 string) bool {
6868
return semver.MajorMinor(v1) == semver.MajorMinor(v2)
6969
}
7070

71+
// IsDev returns true if this is a development build.
72+
func IsDev() bool {
73+
return strings.HasPrefix(Version(), develPrefix)
74+
}
75+
7176
// ExternalURL returns a URL referencing the current Coder version.
7277
// For production builds, this will link directly to a release.
7378
// For development builds, this will link to a commit.

cli/deployment/config.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414
"github.com/spf13/viper"
1515
"golang.org/x/xerrors"
1616

17+
"github.com/coder/coder/buildinfo"
1718
"github.com/coder/coder/cli/cliui"
1819
"github.com/coder/coder/cli/config"
1920
"github.com/coder/coder/codersdk"
@@ -405,6 +406,12 @@ func newConfig() *codersdk.DeploymentConfig {
405406
Usage: "Enable experimental features. Experimental features are not ready for production.",
406407
Flag: "experimental",
407408
},
409+
UpdateCheck: &codersdk.DeploymentConfigField[bool]{
410+
Name: "Update Check",
411+
Usage: "Periodically check for new releases of Coder and inform the owner. The check is performed once per day.",
412+
Flag: "update-check",
413+
Default: flag.Lookup("test.v") == nil && !buildinfo.IsDev(),
414+
},
408415
}
409416
}
410417

cli/deployment/config_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ func TestConfig(t *testing.T) {
3838
"CODER_TELEMETRY": "false",
3939
"CODER_TELEMETRY_TRACE": "false",
4040
"CODER_WILDCARD_ACCESS_URL": "something-wildcard.com",
41+
"CODER_UPDATE_CHECK": "false",
4142
},
4243
Valid: func(config *codersdk.DeploymentConfig) {
4344
require.Equal(t, config.Address.Value, "0.0.0.0:8443")
@@ -53,6 +54,7 @@ func TestConfig(t *testing.T) {
5354
require.Equal(t, config.Telemetry.Enable.Value, false)
5455
require.Equal(t, config.Telemetry.Trace.Value, false)
5556
require.Equal(t, config.WildcardAccessURL.Value, "something-wildcard.com")
57+
require.Equal(t, config.UpdateCheck.Value, false)
5658
},
5759
}, {
5860
Name: "DERP",

cli/server.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ import (
6363
"github.com/coder/coder/coderd/prometheusmetrics"
6464
"github.com/coder/coder/coderd/telemetry"
6565
"github.com/coder/coder/coderd/tracing"
66+
"github.com/coder/coder/coderd/updatecheck"
6667
"github.com/coder/coder/codersdk"
6768
"github.com/coder/coder/cryptorand"
6869
"github.com/coder/coder/provisioner/echo"
@@ -373,6 +374,25 @@ func Server(vip *viper.Viper, newAPI func(context.Context, *coderd.Options) (*co
373374
options.TLSCertificates = tlsConfig.Certificates
374375
}
375376

377+
if cfg.UpdateCheck.Value {
378+
options.UpdateCheckOptions = &updatecheck.Options{
379+
// Avoid spamming GitHub API checking for updates.
380+
Interval: 24 * time.Hour,
381+
// Inform server admins of new versions.
382+
Notify: func(r updatecheck.Result) {
383+
if semver.Compare(r.Version, buildinfo.Version()) > 0 {
384+
options.Logger.Info(
385+
context.Background(),
386+
"new version of coder available",
387+
slog.F("new_version", r.Version),
388+
slog.F("url", r.URL),
389+
slog.F("upgrade_instructions", "https://coder.com/docs/coder-oss/latest/admin/upgrade"),
390+
)
391+
}
392+
},
393+
}
394+
}
395+
376396
if cfg.OAuth2.Github.ClientSecret.Value != "" {
377397
options.GithubOAuth2Config, err = configureGithubOAuth2(accessURLParsed,
378398
cfg.OAuth2.Github.ClientID.Value,

cli/testdata/coder_server_--help.golden

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,10 @@ Flags:
219219
verbose flag was supplied, debug-level
220220
logs will be included.
221221
Consumes $CODER_TRACE_CAPTURE_LOGS
222+
--update-check Periodically check for new releases of
223+
Coder and inform the owner. The check is
224+
performed once per day.
225+
Consumes $CODER_UPDATE_CHECK
222226
--wildcard-access-url string Specifies the wildcard hostname to use
223227
for workspace applications in the form
224228
"*.example.com".

0 commit comments

Comments
 (0)