Commit Graph

33 Commits

Author SHA1 Message Date
Ammar Bandukwala 2bd6d2908e
feat: convert entire CLI to clibase (#6491)
I'm sorry.
2023-03-23 17:42:20 -05:00
Marcin Tojek 3b87316ad7
feat: propagate job error codes (#6507)
* feat: propagate job error_code

* fix

* Fix

* Fix

* Fix

* add errors to typesGenerated

* Address PR comments

* Fix
2023-03-08 16:32:00 +01:00
Marcin Tojek a69137b1f7
feat: Update CLI to handle managed variables (#6220)
* WIP

* hcl

* useManagedVariables

* fix

* Fix

* Fix

* fix

* go:build

* Fix

* fix: bool flag

* Insert template variables

* API

* fix

* Expose via API

* More wiring

* CLI for testing purposes

* WIP

* Delete FIXME

* planVars

* WIP

* WIP

* UserVariableValues

* no dry run

* Dry run

* Done FIXME

* Fix

* Fix: CLI

* Fix: migration

* API tests

* Test info

* Tests

* More tests

* fix: lint

* Fix: authz

* Address PR comments

* Fix

* fix

* fix

* CLI: create

* unit tests: create templates with variables

* Use last variables

* Fix

* Fix

* Fix

* Push tests

* fix: variable is required if Default is nil

* WIP

* Redact sensitive values

* Fixes

* Fixes

* Fix: arg description

* Fix

* Variable param

* Fix: gen

* Fix

* Fix: goldens
2023-02-17 09:07:45 +01:00
Marcin Tojek 3b7b96ac28
feat: Expose managed variables via API (#6134)
* WIP

* hcl

* useManagedVariables

* fix

* Fix

* Fix

* fix

* go:build

* Fix

* fix: bool flag

* Insert template variables

* API

* fix

* Expose via API

* More wiring

* CLI for testing purposes

* WIP

* Delete FIXME

* planVars

* WIP

* WIP

* UserVariableValues

* no dry run

* Dry run

* Done FIXME

* Fix

* Fix: CLI

* Fix: migration

* API tests

* Test info

* Tests

* More tests

* fix: lint

* Fix: authz

* Address PR comments

* Fix

* fix

* fix
2023-02-15 18:24:15 +01:00
Ammar Bandukwala 592ce3b118
feat(cli): allow direct tar upload in template update/create (#5720) 2023-01-16 14:32:11 -06:00
Kyle Carberry b6703b11c6
feat: Add external provisioner daemons (#4935)
* Start to port over provisioner daemons PR

* Move to Enterprise

* Begin adding tests for external registration

* Move provisioner daemons query to enterprise

* Move around provisioner daemons schema

* Add tags to provisioner daemons

* make gen

* Add user local provisioner daemons

* Add provisioner daemons

* Add feature for external daemons

* Add command to start a provisioner daemon

* Add provisioner tags to template push and create

* Rename migration files

* Fix tests

* Fix entitlements test

* PR comments

* Update migration

* Fix FE types
2022-11-16 16:34:06 -06:00
Garrett Delfosse d277e28427
feat: change template max_ttl to default_ttl (#4843) 2022-11-09 19:36:25 +00:00
Kyle Carberry 30281852d6
feat: Add buffering to provisioner job logs (#4918)
* feat: Add bufferring to provisioner job logs

This should improve overall build performance, and especially under load.

It removes the old `id` column on the `provisioner_job_logs` table
and replaces it with an auto-incrementing big integer to preserve order.

Funny enough, we never had to care about order before because inserts
would at minimum be 1ms different. Now they aren't, so the order needs
to be preserved.

* Fix log bufferring

* Fix frontend log streaming

* Fix JS test
2022-11-06 20:50:34 -06:00
Jon Ayers 90f77a3415
feat: add groups support to the CLI (#4755) 2022-10-27 16:49:35 -05:00
Jon Ayers 4e57b9fbdc
fix: allow regular users to push files (#4500)
- As part of merging support for Template RBAC
  and user groups a permission check on reading files
  was relaxed.

  With the addition of admin roles on individual templates, regular
  users are now able to push template versions if they have
  inherited the 'admin' role for a template. In order to do so
  they need to be able to create and read their own files. Since
  collisions on hash in the past were ignored, this means that a regular user
  who pushes a template version with a file hash that collides with
  an existing hash will not be able to read the file (since it belongs to
  another user).

  This commit fixes the underlying problem which was that
  the files table had a primary key on the 'hash' column.
  This was not a problem at the time because only template
  admins and other users with similar elevated roles were
  able to read all files regardless of ownership. To fix this
  a new column and primary key 'id' has been introduced to the files
  table. The unique constraint has been updated to be hash+created_by.
  Tables (provisioner_jobs) that referenced files.hash have been updated
  to reference files.id. Relevant API endpoints have also been updated.
2022-10-13 18:02:52 -05:00
Kyle Carberry 28428d1294
feat: Add custom version names (#4186)
Fixes #4137.
2022-09-23 20:17:36 -05:00
Kyle Carberry a7ee8b31e0
fix: Don't use StatusAbnormalClosure (#4155) 2022-09-22 18:26:05 +00:00
Joe Previte 1359850715
feat(cli): validate name length on template create (#3823)
* feat(cli): add template create validation test

This adds a test to validate that `template create` prints an error
message if called with a template name exceeding the 32-char limit.

* fixup

* fixup test

* feat(cli): add name validation to templatecreate

This adds a validation step to ensure the template name is less than 32
characters.

* fixup!: use utf8.RuneCountInString

* fixup!: remove pty from test
2022-09-07 15:01:18 -05:00
Spike Curtis 184f0625e1
coder licenses add CLI command (#3632)
* coder licenses add CLI command

Signed-off-by: Spike Curtis <spike@coder.com>

* Fix up lint

Signed-off-by: Spike Curtis <spike@coder.com>

* Fix t.parallel call

Signed-off-by: Spike Curtis <spike@coder.com>

* Code review improvements

Signed-off-by: Spike Curtis <spike@coder.com>

* Lint

Signed-off-by: Spike Curtis <spike@coder.com>

Signed-off-by: Spike Curtis <spike@coder.com>
2022-08-23 13:55:39 -07:00
David Wahler b5f5e909bd
Return template parameters in consistent order (#2975)
* return parameters from Terraform provisioner in sorted order

* persist parameter indices in database and return them in correct order from API

* don't re-sort parameters by name when creating templates
2022-07-13 15:29:34 -05:00
Cian Johnston 5e6320163d
change default aws linux instance type to t3.micro, reduce default template TTL (#2776)
- make default template max TTL 24 hours (still less than 168)
- make default workspace autostop 2 hours unless specified otherwise
- add instance type selector to aws templates
2022-07-12 19:37:59 +01:00
Abhineet Jain 61c52b3090
feat: default confirm to no for cli delete (#2919) 2022-07-12 10:36:07 -07:00
Ketan Gangatirkar 2609be767d
feat: add timestamps to output at end of some workspace and template subcommands (#2831) 2022-07-08 14:27:56 -05:00
Kyle Carberry 584448e089
fix: worksapces -> workspaces in template create CLI (#2857)
Fixes #2846.
2022-07-08 14:22:30 -05:00
Steven Masley 4616499030
chore: Reuse ComputedParmeter, remove duplicated codersdk type (#2477)
* chore: Reuse ComputedParmeter instead of custom type
2022-06-17 15:20:13 -05:00
Steven Masley 64b92eea67
feat: Allow inheriting parameters from previous template_versions when updating a template (#2397)
* WIP: feat: Update templates also updates parameters
* Insert params for template version update
* Working implementation of inherited params
* Add "--always-prompt" flag and logging info
2022-06-17 12:22:28 -05:00
Spike Curtis 93b1425d85
Stop showing persistent vs ephemeral for resources (#2333)
Signed-off-by: Spike Curtis <spike@coder.com>
2022-06-16 18:36:11 +00:00
Cian Johnston 3e419ddb3d
feat: enforce template-level constraints for TTL and autostart (#2018)
This PR adds fields to templates that constrain values for workspaces derived from that template.

- Autostop: Adds a field max_ttl on the template which limits the maximum value of ttl on all workspaces derived from that template. Defaulting to 168 hours, enforced on edits to workspace metadata. New workspaces will default to the templates's `max_ttl` if not specified.
- Autostart: Adds a field min_autostart_duration which limits the minimum duration between successive autostarts of a template, measured from a single reference time. Defaulting to 1 hour, enforced on edits to workspace metadata.
2022-06-07 13:37:45 +01:00
Steven Masley ad946c3902
feat: Add confirm prompts to some cli actions (#1591)
* feat: Add confirm prompts to some cli actions
- Add optional -y skip. Standardize -y flag across commands
2022-05-20 15:59:04 +00:00
Abhineet Jain 7c3e1a5d97
feat: Read params from file for template/workspace creation (#1541)
* Read params from file for template/workspace creation

* Use os.ReadFile

* Refactor reading params into a separate module

* Add comments and unit tests

* Rename variable

* Uncomment and fix unit test

* Fix comment

* Refactor tests

* Fix unit tests for windows

* Fix unit tests for Windows

* Add comments for the hotfix
2022-05-20 11:29:10 -04:00
Steven Masley 6c1117094d
chore: Force codersdk to not import anything from database (#1576)
* chore: Force codersdk to not import anything from database (linter rule)
* chore: Move all database types in codersdk out
2022-05-19 13:04:44 -05:00
Kyle Carberry 38ee519f42
feat: Expose the values contained in an HCL validation string to the API (#1587)
* feat: Expose the values contained in an HCL validation string to the API

This allows the frontend to render inputs displaying these values!

* Update codersdk/parameters.go

Co-authored-by: Cian Johnston <cian@coder.com>

* Call a spade a space

* Fix linting errors with type conversion

Co-authored-by: Cian Johnston <cian@coder.com>
2022-05-19 13:29:36 +00:00
Mathias Fredriksson 56076a0aa2
feat: Unify cli behavior for templates create and update (#1385)
Fixes #565
2022-05-12 14:54:58 +03:00
Kyle Carberry c2b5009208
fix: Unnest workspaces command to the top-level (#1241)
This changes all "coder workspace *" commands to root.
A few of these were already at the root, like SSH. The
inconsistency made for a confusing experience.
2022-05-02 11:08:52 -05:00
Colin Adler f803e37505
chore: use workspace name as arg in `coder workspaces create` (#1007) 2022-04-14 17:23:20 +00:00
G r e y 6edd7cb036
fix: typo in create workspaces command hint (#995)
Resolves: #994
2022-04-13 15:30:58 +00:00
Kyle Carberry fb9dc4f346
feat: Improve resource preview and first-time experience (#946)
* Improve CLI documentation

* feat: Allow workspace resources to attach multiple agents

This enables a "kubernetes_pod" to attach multiple agents that
could be for multiple services. Each agent is required to have
a unique name, so SSH syntax is:

`coder ssh <workspace>.<agent>`

A resource can have zero agents too, they aren't required.

* Add tree view

* Improve table UI

* feat: Allow workspace resources to attach multiple agents

This enables a "kubernetes_pod" to attach multiple agents that
could be for multiple services. Each agent is required to have
a unique name, so SSH syntax is:

`coder ssh <workspace>.<agent>`

A resource can have zero agents too, they aren't required.

* Rename `tunnel` to `skip-tunnel`

This command was `true` by default, which causes
a confusing user experience.

* Add disclaimer about editing templates

* Add help to template create

* Improve workspace create flow

* Add end-to-end test for config-ssh

* Improve testing of config-ssh

* Fix workspace list

* Fix config ssh tests

* Update cli/configssh.go

Co-authored-by: Cian Johnston <public@cianjohnston.ie>

* Fix requested changes

* Remove socat requirement

* Fix resources not reading in TTY

Co-authored-by: Cian Johnston <public@cianjohnston.ie>
2022-04-11 18:54:30 -05:00
Kyle Carberry 02ad3f14f5
chore: Rename Projects to Templates (#880)
Customer feedback indicated projects was a confusing name.
After querying the team internally, it seemed unanimous
that it is indeed a confusing name.

Here's for a lil less confusion @ashmeer7 🥂
2022-04-06 12:42:40 -05:00
Renamed from cli/projectcreate.go (Browse further)