Skip to content

Commit 26ace52

Browse files
committed
Merge remote-tracking branch 'origin/main' into ability-to-activate/kira-pilot
2 parents 88643c6 + d48ab96 commit 26ace52

22 files changed

+1035
-443
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

@@ -53,15 +53,15 @@ Once installed, you can run a temporary deployment in dev mode (all data is in-m
5353
coder server --dev
5454
```
5555

56-
Use `coder --help` to get a complete list of flags and environment variables. Use our [quickstart guide](./docs/quickstart.md) for a full walkthrough.
56+
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.
5757

5858
## Documentation
5959

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

6262
## Comparison
6363

64-
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).
64+
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).
6565

6666
| Tool | Type | Delivery Model | Cost | Environments |
6767
| :---------------------------------------------------------- | :------- | :----------------- | :---------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------- |
@@ -82,6 +82,6 @@ Join our community on [Discord](https://discord.gg/coder) and [Twitter](https://
8282

8383
## Contributing
8484

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

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

cli/bump.go

Lines changed: 17 additions & 8 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 {
@@ -62,7 +72,6 @@ func bump() *cobra.Command {
6272
newDeadline.Format(timeFormat),
6373
newDeadline.Format(dateFormat),
6474
)
65-
6675
return nil
6776
},
6877
}

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)