Commit Graph

1252 Commits

Author SHA1 Message Date
13f6645ab9 fix(cli): improve container detection when cgroupns=private (#15156)
Fixes https://github.com/coder/coder/issues/12721

If a container in docker is started with `--cgroupns=private` (which is
the default behaviour in docker) then `/proc/1/cgroup` has the following
content:
```
0::/
```

If a container in docker is started with `--cgroupns=host` then
`/proc/1/cgroup` has the following content (hash will vary):
```
0::/docker/aa86ac98959eeedeae0ecb6e0c9ddd8ae8b97a9d0fdccccf7ea7a474f4e0bb1f
```

Currently we are determining if a host is containerized by assuming the
second scenario. This means the existing behaviour of sniffing
`/proc/1/cgroup` is not always sufficient for checking if a host is
containerized.

According to [the cgroups(7)
man-page](https://man7.org/linux/man-pages/man7/cgroups.7.html) there
exists a `cgroup.type` file in a nonroot cgroup. This exists in Linux
versions after `4.14`.

> Linux 4.14 added thread mode for cgroups v2.

> With the addition of thread mode, each nonroot cgroup now contains a
new file, cgroup.type

This means we can check for the existence of
`/sys/fs/cgroup/cgroup.type` to see if we are in a container or not.
2024-10-21 15:28:32 +01:00
c5a4095610 fix: include custom agent headers in tailnet to support DERP connections (#15145)
Fixes #15131.
2024-10-21 20:59:21 +11:00
9b8e707517 chore: skip ssh exec-ing test on windows (#15146)
See coder/internal#117
2024-10-21 04:17:20 +00:00
5ebc748e94 feat: allow promoting an existing template version to active from CLI (#15051)
Co-authored-by: Muhammad Atif Ali <atif@coder.com>
2024-10-17 14:15:14 +05:00
02f6203dc7 chore(cli): rename build options to ephemeral parameters in cli (#15030)
This PR aims to rename `build-option` to `ephemeral-parameters` based on
#10488 conversation.

`build-option` has been renamed `ephemeral-parameter` and can be used to
define a value for an ephemeral parameter in the template.

`build-options` has been renamed `prompt-ephemeral-parameters` and can
be used to prompt the user to put values for the ephemeral parameters in
the template.

---------

Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>
Co-authored-by: EdwardAngert <17991901+EdwardAngert@users.noreply.github.com>
Co-authored-by: defelmnq <yvincent@coder.com>
2024-10-16 23:54:12 +02:00
ccbb687ca0 feat(cli): extend duration to longer units (#15040)
This PR is a proposal to improve the situation described in #14750 

For some precise commands - we would like to be able to use durations
bigger than hours, minutes..

This PR extends the Duration proposed by Go with : 
- `d` - a day or 24hours.
- `y` - a year or 365 days.

I also removed the default value for lifetime and instead fetch the
maxLifetime value from codersdk - so by default if no value set we use
the value defined in the config.
2024-10-16 17:02:56 +02:00
06a40185cb chore(examples): add missing devcontainer templates to examples.go (#15080) 2024-10-15 17:26:42 +01:00
191449078c feat: implement feature to support template version while creating workspace using cli (#14880) 2024-10-11 18:00:11 +05:00
0ef5340d20 fix: change message when trying to update a workspace already up-to-date (#14975)
Related to #14940  -

We replace the wording from Workspace isn't outdated to Workspace is
up-to-date when the workspace already is up-to-date.
2024-10-10 12:56:53 +02:00
26df33ac88 docs: explain --rich-parameter-file format (#14941) 2024-10-09 09:34:24 +05:00
11f7b1b3f5 chore: remove notifications experiment (#14869)
Notifications have proved stable in the [mainline release of
v2.15](https://github.com/coder/coder/releases/tag/v2.15.0), and in
preparation for v2.16 we're moving this to stable.
2024-10-01 13:43:47 +00:00
35a5475166 chore: add site flag to buildinfo (#14868) 2024-10-01 10:01:17 +00:00
ba90bb0ab3 feat: implement feature to create a token on behalf of another user in the cli (#14813)
This PR addresses https://github.com/coder/coder/issues/13160
2024-09-30 20:15:28 +00:00
5c977c6be7 chore: rename 'first-organization' to 'coder' (#14808)
Rename the first-organization original name. Users can change from the
original name.
2024-09-26 13:20:44 -05:00
b7c574f679 feat!: add summary to coder ping (#14762) 2024-09-25 13:24:23 +10:00
b8944074c4 chore: improve coder server ux (#14761) 2024-09-24 13:16:36 +10:00
96e9a4f85c feat(site): add warnings and status indicator to provisioner groups (#14708) 2024-09-20 09:55:04 -06:00
922f4c545f fix: handle new agent stat format correctly (#14576)
---------

Co-authored-by: Ethan Dickson <ethan@coder.com>
2024-09-20 01:52:14 +10:00
37885e2e82 fix: make cli respect deployment --docs-url (#14568) 2024-09-18 21:47:53 +10:00
20a3801600 fix: use floats in report template (#14714) 2024-09-18 11:26:34 +00:00
fccf6f1e0e feat!: add --default-token-lifetime (#14631) 2024-09-18 21:23:42 +10:00
6de59371ea feat: notifications: report failed workspace builds (#14571) 2024-09-18 09:11:44 +02:00
c145f113fe chore: remove db import from cli package (#14709) 2024-09-17 22:07:58 +00:00
d96adad56f chore: add cli command to fetch group sync settings as json (#14694)
* chore: add cli command to fetch group sync settings as json
2024-09-17 14:08:33 -05:00
be516f9686 chore: unhide multi-organization cli commands (#14693)
* chore: unhide multi-organization cli commands

Multi-org is going into GA, unhide cli commands
2024-09-17 10:22:20 -05:00
14d3e300d3 fix: use ANSI colors codes instead of RGB (#14665)
* chore: add command for showing colors

* fix: use ANSI color codes instead of RGB

* feat: add '--no-color' flag

* fix: revert colors

* chore: change colors

* fix: update golden files

* fix: replace blue with brightBlue

* fix: drop '> ' for unfocused prompts

* fix: run 'make fmt'

* chore: allow disabling color with env flags

* fix: apply fixes from feedback

* fix: run 'make gen'

* fix: refactor janky code

* fix: re-add public function

* fix: re-add init for non-color tests

* fix: move styles to 'init' that can be

* fix: stop overwriting entire DefaultStyles

* fix: make code and field obey --no-color

* fix: rip out '--no-color' due to race condition

We still support `NO_COLOR` env variable through termenv's
`EnvColorProfile`. The reason for the race condition is that
`DefaultStyles` is a global that we shouldn't mutate after `init`
is called, but we have to mutate it after `init` has ran to have
serpent collect the cli flags and env vars for us.

* fix: apply nit

* fix: simplify code && hide command

* fix: newline shouldn't be themed

* fix: appease the linter
2024-09-17 14:21:24 +01:00
6ff9a05832 fix: close SSH sessions bottom-up if top-down fails (#14678) 2024-09-17 14:46:49 +04:00
71393743dc feat: implement organization role sync (#14649)
* chore: implement organization and site wide role sync in idpsync
* chore: remove old role sync, insert new idpsync package
2024-09-16 19:03:25 -05:00
efd532e1d7 chore: read template tar from stdin if stdin is not a tty (#14643) 2024-09-12 14:36:20 +10:00
6a846cdbb8 chore: support multi-org group sync with runtime configuration (#14578)
- Implement multi-org group sync
- Implement runtime configuration to change sync behavior
- Legacy group sync migrated to new package
2024-09-11 13:43:50 -05:00
1b5f3418d3 chore: align active version terminology and link to docs (#14639) 2024-09-11 12:25:07 +02:00
4f2202fe34 fix: fix TestPing/1Ping flake (#14634) 2024-09-11 14:22:23 +10:00
cb9d40fb8a feat: implement runtime configuration package with multi-org support (#14624)
runtime configuration package
---------

Signed-off-by: Danny Kopping <danny@coder.com>
Co-authored-by: Danny Kopping <danny@coder.com>
2024-09-09 14:14:52 -05:00
cd7ce8ecfb docs: add networking troubleshooting page (#14548) 2024-09-05 13:32:08 +10:00
bcf9bc3c90 feat(cli): add --provisioner-log-debug option (#14558)
Allows starting a build in debug mode from the CLI without needing
to have the build fail first by adding `--provisioner-log-debug`.
2024-09-04 14:39:35 +01:00
1958436b1d chore: replace AlecAivazis/survey with charmbracelet/bubbletea (#14475)
Replaces the unmaintained https://github.com/AlecAivazis/survey library with https://github.com/charmbracelet/bubbletea.
2024-09-04 11:38:08 +01:00
8f85464fe6 feat(codersdk): export name validators (#14551) 2024-09-04 08:34:39 +00:00
01a904c133 feat(codersdk): export name validators (#14550)
* feat(codersdk): export name validators

* review
2024-09-04 18:17:53 +10:00
48430625a0 ci: bump crate-ci/typos from 1.24.1 to 1.24.3 in the github-actions group (#14521)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Muhammad Atif Ali <atif@coder.com>
2024-09-03 17:17:12 +05:00
10c958bba1 chore: implement organization sync and create idpsync package (#14432)
* chore: implement filters for the organizations query
* chore: implement organization sync and create idpsync package

Organization sync can now be configured to assign users to an org based on oidc claims.
2024-08-30 11:19:36 -05:00
043f4f5327 docs: add documentation for notifications feature (#14478) 2024-08-30 17:30:06 +02:00
a74273f1fd chore(coderd/database/dbpurge): replace usage of time.* with quartz (#14480)
Related to #10576

This PR introduces quartz to coderd/database/dbpurge and updates the following unit tests to make use of Quartz's functionality:

- TestPurge
- TestDeleteOldWorkspaceAgentLogs

Additionally, updates DeleteOldWorkspaceAgentLogs to replace the hard-coded interval with a parameter passed into the query. This aids in testing and brings us a step towards allowing operators to configure the cutoff interval for workspace agent logs.
2024-08-30 11:55:47 +01:00
851df91991 fix: serve test derp map locally (#14490) 2024-08-30 18:43:51 +10:00
4b5c45d6df feat(cli): add aws check to ping p2p diagnostics (#14450) 2024-08-29 21:41:12 +10:00
e65eb0321c fix: support additional http headers on agent (#14464) 2024-08-29 14:15:15 +10:00
54fe082551 chore: implement filters for the organizations query (#14468)
Required for organization sync. Allows fetching a filtered set of orgs.
2024-08-28 13:24:28 -05:00
8c15192433 feat(cli): add p2p diagnostics to ping (#14426)
First PR to address #14244.

Adds common potential reasons as to why a direct connection to the workspace agent couldn't be established to `coder ping`:
- If the Coder deployment administrator has blocked direction connections (`CODER_BLOCK_DIRECT`).
- If the client has no STUN servers within it's DERP map.
- If the client or agent appears to be behind a hard NAT, as per Tailscale `netInfo.MappingVariesByDestIP`

Also adds a warning if the client or agent has a network interface below the 'safe' MTU for tailnet. This warning is always displayed at the end of a `coder ping`.
2024-08-28 15:39:01 +10:00
63fe2305f8 fix: detect nested dotfiles scripts (#14455) 2024-08-28 02:14:23 +10:00
6914862903 fix(cli): add check for DisableOwnerWorkspaceExec in scaletest (#14417)
- Adds `--use-host-login` to `coder exp scaletest workspace-traffic`
- Modifies getScaletestWorkspaces to conditionally filter workspaces if `CODER_DISABLE_OWNER_WORKSPACE_ACCESS` is set
- Adds a warning if `CODER_DISABLE_OWNER_WORKSPACE_ACCESS` is set and scaletest workspaces are filtered out due to ownership mismatch.
- Modifies `coderdtest.New` to detect cross-test bleed of `CODER_DISABLE_OWNER_WORKSPACE_ACCESS` and fast-fail.
2024-08-26 12:02:54 +01:00
c8eacc6df7 chore!: allow CreateUser to accept multiple organizations (#14383)
* chore: allow CreateUser to accept multiple organizations

In a multi-org deployment, it makes more sense to allow for multiple
org memberships to be assigned at create. The legacy param will still
be honored.

* Handle sdk deprecation better by maintaining cli functions
2024-08-23 21:23:51 +00:00