Skip to content

Commit 5211334

Browse files
committed
Merge branch 'main' into embeddeddb
2 parents dc122b6 + 45eb1b4 commit 5211334

File tree

98 files changed

+3242
-1622
lines changed

Some content is hidden

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

98 files changed

+3242
-1622
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Coder creates remote development machines so your team can develop from anywhere
3333
> **Note**:
3434
> Coder is in an alpha state. [Report issues here](https://github.com/coder/coder/issues/new).
3535
36-
There are a few ways to install Coder: [install script](./docs/install.md#installsh) (macOS, Linux), [docker-compose](./docs/install.md#docker-compose), or [manually](./docs/install.md#manual) via the latest release (macOS, Windows, and Linux).
36+
There are a few ways to install Coder: [install script](https://coder.com/docs/coder-oss/latest/install#installsh) (macOS, Linux), [docker-compose](https://coder.com/docs/coder-oss/latest/install#docker-compose), or [manually](https://coder.com/docs/coder-oss/latest/install#manual) via the latest release (macOS, Windows, and Linux).
3737

3838
If you use the install script, you can preview what occurs during the install process:
3939

@@ -57,15 +57,15 @@ coder server --postgres-builtin --tunnel
5757
coder server --postgres-url <url> --access-url <url>
5858
```
5959

60-
Use `coder --help` to get a complete list of flags and environment variables. Use our [quickstart guide](./docs/quickstart.md) for a full walkthrough.
60+
Use `coder --help` to get a complete list of flags and environment variables. Use our [quickstart guide](https://coder.com/docs/coder-oss/latest/quickstart) for a full walkthrough.
6161

6262
## Documentation
6363

64-
Visit our docs [here](./docs/index.md).
64+
Visit our docs [here](https://coder.com/docs/coder-oss).
6565

6666
## Comparison
6767

68-
Please file [an issue](https://github.com/coder/coder/issues/new) if any information is out of date. Also refer to: [What Coder is not](./docs/about.md#what-coder-is-not).
68+
Please file [an issue](https://github.com/coder/coder/issues/new) if any information is out of date. Also refer to: [What Coder is not](https://coder.com/docs/coder-oss/latest/about#what-coder-is-not).
6969

7070
| Tool | Type | Delivery Model | Cost | Environments |
7171
| :---------------------------------------------------------- | :------- | :----------------- | :---------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------- |
@@ -86,6 +86,6 @@ Join our community on [Discord](https://discord.gg/coder) and [Twitter](https://
8686

8787
## Contributing
8888

89-
Read the [contributing docs](./docs/CONTRIBUTING.md).
89+
Read the [contributing docs](https://coder.com/docs/coder-oss/latest/CONTRIBUTING).
9090

9191
Find our list of contributors [here](./docs/CONTRIBUTORS.md).

cli/autostart_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ func TestAutostart(t *testing.T) {
107107
clitest.SetupConfig(t, client, root)
108108

109109
err := cmd.Execute()
110-
require.ErrorContains(t, err, "status code 403: Forbidden", "unexpected error")
110+
require.ErrorContains(t, err, "status code 404", "unexpected error")
111111
})
112112

113113
t.Run("unset_NotFound", func(t *testing.T) {
@@ -124,7 +124,7 @@ func TestAutostart(t *testing.T) {
124124
clitest.SetupConfig(t, client, root)
125125

126126
err := cmd.Execute()
127-
require.ErrorContains(t, err, "status code 403: Forbidden", "unexpected error")
127+
require.ErrorContains(t, err, "status code 404:", "unexpected error")
128128
})
129129
}
130130

cli/bump.go

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,26 @@ import (
88
"github.com/spf13/cobra"
99
"golang.org/x/xerrors"
1010

11+
"github.com/coder/coder/coderd/util/tz"
1112
"github.com/coder/coder/codersdk"
1213
)
1314

1415
const (
15-
bumpDescriptionLong = `To extend the autostop deadline for a workspace.`
16+
bumpDescriptionShort = `Shut your workspace down after a given duration has passed.`
17+
bumpDescriptionLong = `Modify the time at which your workspace will shut down automatically.
18+
* Provide a duration from now (for example, 1h30m).
19+
* The minimum duration is 30 minutes.
20+
* If the workspace template restricts the maximum runtime of a workspace, this will be enforced here.
21+
* If the workspace does not already have a shutdown scheduled, this does nothing.
22+
`
1623
)
1724

1825
func bump() *cobra.Command {
1926
bumpCmd := &cobra.Command{
2027
Args: cobra.RangeArgs(1, 2),
2128
Annotations: workspaceCommand,
22-
Use: "bump <workspace-name> <duration>",
23-
Short: "Extend the autostop deadline for a workspace.",
29+
Use: "bump <workspace-name> <duration from now>",
30+
Short: bumpDescriptionShort,
2431
Long: bumpDescriptionLong,
2532
Example: "coder bump my-workspace 90m",
2633
RunE: func(cmd *cobra.Command, args []string) error {
@@ -39,17 +46,20 @@ func bump() *cobra.Command {
3946
return xerrors.Errorf("get workspace: %w", err)
4047
}
4148

42-
newDeadline := time.Now().Add(bumpDuration)
49+
loc, err := tz.TimezoneIANA()
50+
if err != nil {
51+
loc = time.UTC // best effort
52+
}
4353

44-
if newDeadline.Before(workspace.LatestBuild.Deadline) {
54+
if bumpDuration < 29*time.Minute {
4555
_, _ = fmt.Fprintf(
4656
cmd.OutOrStdout(),
47-
"The proposed deadline is %s before the current deadline.\n",
48-
workspace.LatestBuild.Deadline.Sub(newDeadline).Round(time.Minute),
57+
"Please specify a duration of at least 30 minutes.\n",
4958
)
5059
return nil
5160
}
5261

62+
newDeadline := time.Now().In(loc).Add(bumpDuration)
5363
if err := client.PutExtendWorkspace(cmd.Context(), workspace.ID, codersdk.PutExtendWorkspaceRequest{
5464
Deadline: newDeadline,
5565
}); err != nil {
@@ -58,10 +68,10 @@ func bump() *cobra.Command {
5868

5969
_, _ = fmt.Fprintf(
6070
cmd.OutOrStdout(),
61-
"Workspace %q will now stop at %s\n", workspace.Name,
62-
newDeadline.Format(time.RFC822),
71+
"Workspace %q will now stop at %s on %s\n", workspace.Name,
72+
newDeadline.Format(timeFormat),
73+
newDeadline.Format(dateFormat),
6374
)
64-
6575
return nil
6676
},
6777
}

cli/bump_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@ func TestBump(t *testing.T) {
124124
workspace, err = client.Workspace(ctx, workspace.ID)
125125
require.NoError(t, err)
126126

127-
// TODO(cian): need to stop and start the workspace as we do not update the deadline yet
128-
// see: https://github.com/coder/coder/issues/1783
127+
// NOTE(cian): need to stop and start the workspace as we do not update the deadline
128+
// see: https://github.com/coder/coder/issues/2224
129129
coderdtest.MustTransitionWorkspace(t, client, workspace.ID, database.WorkspaceTransitionStart, database.WorkspaceTransitionStop)
130130
coderdtest.MustTransitionWorkspace(t, client, workspace.ID, database.WorkspaceTransitionStop, database.WorkspaceTransitionStart)
131131

0 commit comments

Comments
 (0)