Skip to content

Commit

Permalink
Merge branch 'coder:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
projectoperations authored Jul 21, 2024
2 parents e584ebb + 88d2dbd commit 1a8e945
Show file tree
Hide file tree
Showing 156 changed files with 6,313 additions and 625 deletions.
22 changes: 21 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -966,7 +966,7 @@ jobs:
uses: actions/dependency-review-action@v4.3.2
with:
allow-licenses: Apache-2.0, 0BSD, BSD-2-Clause, BSD-3-Clause, CC0-1.0, ISC, MIT, MIT-0, MPL-2.0
allow-dependencies-licenses: "pkg:golang/github.com/coder/wgtunnel@0.1.13-0.20240522110300-ade90dfb2da0, pkg:npm/pako@1.0.11, pkg:npm/caniuse-lite@1.0.30001639"
allow-dependencies-licenses: "pkg:golang/github.com/coder/wgtunnel@0.1.13-0.20240522110300-ade90dfb2da0, pkg:npm/pako@1.0.11, pkg:npm/caniuse-lite@1.0.30001639, pkg:githubactions/alwaysmeticulous/report-diffs-action/cloud-compute"
license-check: true
vulnerability-check: false
- name: "Report"
Expand All @@ -992,3 +992,23 @@ jobs:
fi
done
echo "No incompatible licenses detected"
meticulous:
runs-on: ubuntu-latest
steps:
- name: "Checkout Repository"
uses: actions/checkout@v4
- name: Setup Node
uses: ./.github/actions/setup-node
- name: Build
working-directory: ./site
run: pnpm build
- name: Serve
working-directory: ./site
run: |
pnpm vite preview &
sleep 5
- name: Run Meticulous tests
uses: alwaysmeticulous/report-diffs-action/cloud-compute@v1
with:
api-token: ${{ secrets.METICULOUS_API_TOKEN }}
app-url: "http://127.0.0.1:4173/"
2 changes: 2 additions & 0 deletions .github/workflows/typos.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ hel = "hel"
pn = "pn"
# typos doesn't like the EDE in TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA
EDE = "EDE"
# HELO is an SMTP command
HELO = "HELO"

[files]
extend-exclude = [
Expand Down
25 changes: 19 additions & 6 deletions agent/agenttest/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,12 @@ func (f *FakeAgentAPI) UpdateStats(ctx context.Context, req *agentproto.UpdateSt
f.logger.Debug(ctx, "update stats called", slog.F("req", req))
// empty request is sent to get the interval; but our tests don't want empty stats requests
if req.Stats != nil {
f.statsCh <- req.Stats
select {
case <-ctx.Done():
return nil, ctx.Err()
case f.statsCh <- req.Stats:
// OK!
}
}
return &agentproto.UpdateStatsResponse{ReportInterval: durationpb.New(statsInterval)}, nil
}
Expand All @@ -233,17 +238,25 @@ func (f *FakeAgentAPI) UpdateLifecycle(_ context.Context, req *agentproto.Update

func (f *FakeAgentAPI) BatchUpdateAppHealths(ctx context.Context, req *agentproto.BatchUpdateAppHealthRequest) (*agentproto.BatchUpdateAppHealthResponse, error) {
f.logger.Debug(ctx, "batch update app health", slog.F("req", req))
f.appHealthCh <- req
return &agentproto.BatchUpdateAppHealthResponse{}, nil
select {
case <-ctx.Done():
return nil, ctx.Err()
case f.appHealthCh <- req:
return &agentproto.BatchUpdateAppHealthResponse{}, nil
}
}

func (f *FakeAgentAPI) AppHealthCh() <-chan *agentproto.BatchUpdateAppHealthRequest {
return f.appHealthCh
}

func (f *FakeAgentAPI) UpdateStartup(_ context.Context, req *agentproto.UpdateStartupRequest) (*agentproto.Startup, error) {
f.startupCh <- req.GetStartup()
return req.GetStartup(), nil
func (f *FakeAgentAPI) UpdateStartup(ctx context.Context, req *agentproto.UpdateStartupRequest) (*agentproto.Startup, error) {
select {
case <-ctx.Done():
return nil, ctx.Err()
case f.startupCh <- req.GetStartup():
return req.GetStartup(), nil
}
}

func (f *FakeAgentAPI) GetMetadata() map[string]agentsdk.Metadata {
Expand Down
2 changes: 1 addition & 1 deletion cli/organizationmembers.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func (r *RootCmd) assignOrganizationRoles(orgContext *OrganizationContext) *serp

func (r *RootCmd) listOrganizationMembers(orgContext *OrganizationContext) *serpent.Command {
formatter := cliui.NewOutputFormatter(
cliui.TableFormat([]codersdk.OrganizationMemberWithName{}, []string{"username", "organization_roles"}),
cliui.TableFormat([]codersdk.OrganizationMemberWithUserData{}, []string{"username", "organization_roles"}),
cliui.JSONFormat(),
)

Expand Down
2 changes: 1 addition & 1 deletion cli/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -1066,7 +1066,7 @@ func (r *RootCmd) Server(newAPI func(context.Context, *coderd.Options) (*coderd.
autobuildTicker := time.NewTicker(vals.AutobuildPollInterval.Value())
defer autobuildTicker.Stop()
autobuildExecutor := autobuild.NewExecutor(
ctx, options.Database, options.Pubsub, coderAPI.TemplateScheduleStore, &coderAPI.Auditor, coderAPI.AccessControlStore, logger, autobuildTicker.C)
ctx, options.Database, options.Pubsub, coderAPI.TemplateScheduleStore, &coderAPI.Auditor, coderAPI.AccessControlStore, logger, autobuildTicker.C, options.NotificationsEnqueuer)
autobuildExecutor.Run()

hangDetectorTicker := time.NewTicker(vals.JobHangDetectorInterval.Value())
Expand Down
44 changes: 44 additions & 0 deletions cli/testdata/coder_server_--help.golden
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,8 @@ can safely ignore these settings.
"tls11", "tls12" or "tls13".

NOTIFICATIONS OPTIONS:
Configure how notifications are processed and delivered.

--notifications-dispatch-timeout duration, $CODER_NOTIFICATIONS_DISPATCH_TIMEOUT (default: 1m0s)
How long to wait while a notification is being sent before giving up.

Expand All @@ -337,6 +339,11 @@ NOTIFICATIONS OPTIONS:
Which delivery method to use (available options: 'smtp', 'webhook').

NOTIFICATIONS / EMAIL OPTIONS:
Configure how email notifications are sent.

--notifications-email-force-tls bool, $CODER_NOTIFICATIONS_EMAIL_FORCE_TLS (default: false)
Force a TLS connection to the configured SMTP smarthost.

--notifications-email-from string, $CODER_NOTIFICATIONS_EMAIL_FROM
The sender's address to use.

Expand All @@ -346,6 +353,43 @@ NOTIFICATIONS / EMAIL OPTIONS:
--notifications-email-smarthost host:port, $CODER_NOTIFICATIONS_EMAIL_SMARTHOST (default: localhost:587)
The intermediary SMTP host through which emails are sent.

NOTIFICATIONS / EMAIL / EMAIL AUTHENTICATION OPTIONS:
Configure SMTP authentication options.

--notifications-email-auth-identity string, $CODER_NOTIFICATIONS_EMAIL_AUTH_IDENTITY
Identity to use with PLAIN authentication.

--notifications-email-auth-password string, $CODER_NOTIFICATIONS_EMAIL_AUTH_PASSWORD
Password to use with PLAIN/LOGIN authentication.

--notifications-email-auth-password-file string, $CODER_NOTIFICATIONS_EMAIL_AUTH_PASSWORD_FILE
File from which to load password for use with PLAIN/LOGIN
authentication.

--notifications-email-auth-username string, $CODER_NOTIFICATIONS_EMAIL_AUTH_USERNAME
Username to use with PLAIN/LOGIN authentication.

NOTIFICATIONS / EMAIL / EMAIL TLS OPTIONS:
Configure TLS for your SMTP server target.

--notifications-email-tls-ca-cert-file string, $CODER_NOTIFICATIONS_EMAIL_TLS_CACERTFILE
CA certificate file to use.

--notifications-email-tls-cert-file string, $CODER_NOTIFICATIONS_EMAIL_TLS_CERTFILE
Certificate file to use.

--notifications-email-tls-cert-key-file string, $CODER_NOTIFICATIONS_EMAIL_TLS_CERTKEYFILE
Certificate key file to use.

--notifications-email-tls-server-name string, $CODER_NOTIFICATIONS_EMAIL_TLS_SERVERNAME
Server name to verify against the target certificate.

--notifications-email-tls-skip-verify bool, $CODER_NOTIFICATIONS_EMAIL_TLS_SKIPVERIFY
Skip verification of the target server's certificate (insecure).

--notifications-email-tls-starttls bool, $CODER_NOTIFICATIONS_EMAIL_TLS_STARTTLS
Enable STARTTLS to upgrade insecure SMTP connections using TLS.

NOTIFICATIONS / WEBHOOK OPTIONS:
--notifications-webhook-endpoint url, $CODER_NOTIFICATIONS_WEBHOOK_ENDPOINT
The endpoint to which to send webhooks.
Expand Down
2 changes: 1 addition & 1 deletion cli/testdata/coder_users_list_--help.golden
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ USAGE:
OPTIONS:
-c, --column string-array (default: username,email,created_at,status)
Columns to display in table output. Available columns: id, username,
email, created at, status.
email, created at, updated at, status.

-o, --output string (default: table)
Output format. Available formats: table, json.
Expand Down
2 changes: 2 additions & 0 deletions cli/testdata/coder_users_list_--output_json.golden
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"name": "Test User",
"email": "testuser@coder.com",
"created_at": "[timestamp]",
"updated_at": "[timestamp]",
"last_seen_at": "[timestamp]",
"status": "active",
"login_type": "password",
Expand All @@ -27,6 +28,7 @@
"name": "",
"email": "testuser2@coder.com",
"created_at": "[timestamp]",
"updated_at": "[timestamp]",
"last_seen_at": "[timestamp]",
"status": "dormant",
"login_type": "password",
Expand Down
55 changes: 47 additions & 8 deletions cli/testdata/server-config.yaml.golden
Original file line number Diff line number Diff line change
Expand Up @@ -493,13 +493,15 @@ userQuietHoursSchedule:
# compatibility reasons, this will be removed in a future release.
# (default: false, type: bool)
allowWorkspaceRenames: false
# Configure how notifications are processed and delivered.
notifications:
# Which delivery method to use (available options: 'smtp', 'webhook').
# (default: smtp, type: string)
method: smtp
# How long to wait while a notification is being sent before giving up.
# (default: 1m0s, type: duration)
dispatch-timeout: 1m0s
dispatchTimeout: 1m0s
# Configure how email notifications are sent.
email:
# The sender's address to use.
# (default: <unset>, type: string)
Expand All @@ -510,41 +512,78 @@ notifications:
# The hostname identifying the SMTP server.
# (default: localhost, type: string)
hello: localhost
# Force a TLS connection to the configured SMTP smarthost.
# (default: false, type: bool)
forceTLS: false
# Configure SMTP authentication options.
emailAuth:
# Identity to use with PLAIN authentication.
# (default: <unset>, type: string)
identity: ""
# Username to use with PLAIN/LOGIN authentication.
# (default: <unset>, type: string)
username: ""
# Password to use with PLAIN/LOGIN authentication.
# (default: <unset>, type: string)
password: ""
# File from which to load password for use with PLAIN/LOGIN authentication.
# (default: <unset>, type: string)
passwordFile: ""
# Configure TLS for your SMTP server target.
emailTLS:
# Enable STARTTLS to upgrade insecure SMTP connections using TLS.
# (default: <unset>, type: bool)
startTLS: false
# Server name to verify against the target certificate.
# (default: <unset>, type: string)
serverName: ""
# Skip verification of the target server's certificate (insecure).
# (default: <unset>, type: bool)
insecureSkipVerify: false
# CA certificate file to use.
# (default: <unset>, type: string)
caCertFile: ""
# Certificate file to use.
# (default: <unset>, type: string)
certFile: ""
# Certificate key file to use.
# (default: <unset>, type: string)
certKeyFile: ""
webhook:
# The endpoint to which to send webhooks.
# (default: <unset>, type: url)
hello:
# The upper limit of attempts to send a notification.
# (default: 5, type: int)
max-send-attempts: 5
maxSendAttempts: 5
# The minimum time between retries.
# (default: 5m0s, type: duration)
retry-interval: 5m0s
retryInterval: 5m0s
# The notifications system buffers message updates in memory to ease pressure on
# the database. This option controls how often it synchronizes its state with the
# database. The shorter this value the lower the change of state inconsistency in
# a non-graceful shutdown - but it also increases load on the database. It is
# recommended to keep this option at its default value.
# (default: 2s, type: duration)
store-sync-interval: 2s
storeSyncInterval: 2s
# The notifications system buffers message updates in memory to ease pressure on
# the database. This option controls how many updates are kept in memory. The
# lower this value the lower the change of state inconsistency in a non-graceful
# shutdown - but it also increases load on the database. It is recommended to keep
# this option at its default value.
# (default: 50, type: int)
store-sync-buffer-size: 50
storeSyncBufferSize: 50
# How long a notifier should lease a message. This is effectively how long a
# notification is 'owned' by a notifier, and once this period expires it will be
# available for lease by another notifier. Leasing is important in order for
# multiple running notifiers to not pick the same messages to deliver
# concurrently. This lease period will only expire if a notifier shuts down
# ungracefully; a dispatch of the notification releases the lease.
# (default: 2m0s, type: duration)
lease-period: 2m0s
leasePeriod: 2m0s
# How many notifications a notifier should lease per fetch interval.
# (default: 20, type: int)
lease-count: 20
leaseCount: 20
# How often to query the database for queued notifications.
# (default: 15s, type: duration)
fetch-interval: 15s
fetchInterval: 15s
Loading

0 comments on commit 1a8e945

Please sign in to comment.