Commit Graph

34 Commits

Author SHA1 Message Date
Ammar Bandukwala b4c0fa80d8
chore(cli): rename Cmd to Command (#12616)
I think Command is cleaner and my original decision to use "Cmd"
a mistake.

Plus this creates better parity with cobra.
2024-03-17 09:45:26 -05:00
Ammar Bandukwala 496232446d
chore(cli): replace clibase with external `coder/serpent` (#12252) 2024-03-15 11:24:38 -05:00
Steven Masley d2998c6b7b
feat: implement organization context in the cli (#12259)
* feat: implement organization context in the cli

`coder org show current`
2024-02-26 10:03:49 -06:00
Mathias Fredriksson 60653bbacb
fix(cli): allow template name length of 32 in template push and create (#11915) 2024-01-30 12:47:10 +02:00
Marcin Tojek cb77f04104
feat: load variables from tfvars files (#11549) 2024-01-12 15:08:23 +01:00
Garrett Delfosse b21da38bea
chore: deprecate template create command in favor of template push (#11390) 2024-01-05 21:04:14 +00:00
Marcin Tojek 58c2ce17da
refactor(cli): load template variables (#11234) 2023-12-15 14:55:24 +01:00
Marcin Tojek 89d8a293f0
fix: tar: do not archive .tfvars (#11208) 2023-12-15 11:15:12 +01:00
Ammar Bandukwala dd97fe2bce
chore(cli): replace lipgloss with coder/pretty (#9564)
This change will improve over CLI performance and "snappiness" as well as
substantially reduce our test times. Preliminary benchmarks show
`coder server --help` times cut from 300ms to 120ms on my dogfood
instance.

The inefficiency of lipgloss disproportionately impacts our system, as all help
text for every command is generated whenever any command is invoked.

The `pretty` API could clean up a lot of the code (e.g., by replacing
complex string concatenations with Printf), but this commit is too
expansive as is so that work will be done in a follow up.
2023-09-07 16:28:22 -05:00
Mathias Fredriksson b240799f47
refactor(cli): use codersdk for provisioner types (#9508)
This change removes one use of `coderd/database` from the slim binary
and more correctly uses codersdk instead of database or provisionerd
packages.

No size change (yet).

Ref: #9380
2023-09-04 21:42:15 +03:00
Kyle Carberry 22e781eced
chore: add /v2 to import module path (#9072)
* chore: add /v2 to import module path

go mod requires semantic versioning with versions greater than 1.x

This was a mechanical update by running:
```
go install github.com/marwan-at-work/mod/cmd/mod@latest
mod upgrade
```

Migrate generated files to import /v2

* Fix gen
2023-08-18 18:55:43 +00:00
Ammar Bandukwala 2a01747804
feat(cli): add --var shorthand for --variable (#8710)
`--variable` is used frequently enough to deserve a shorthand. Unfortunately,
`-v` is taken by verbose, and `-V` is too easily confused with version or
verbose, so we're left with "--var".
2023-07-25 14:36:02 +00:00
Marcin Tojek 3727e02bbf
feat(cli): add `--create` flag to `templates push` (#8454) 2023-07-13 12:58:34 +02:00
Mathias Fredriksson 75f62dc39d
feat: add support for template version messages in api and cli (#8336) 2023-07-11 13:11:08 +03:00
Colin Adler adf14f1917
chore(cli): warn on template push or create when no lockfile present (#8059) 2023-06-20 15:02:44 +00:00
Ammar Bandukwala 5eaf809851
fix(cli): speed up CLI over SSH (#7885)
By caching the terminal's color profile, we avoid myriad round trips during command execution.
2023-06-07 05:22:58 +00:00
goodspark e2613c91a7
feat(cli): support non-active template version pushes (#7488)
So that we can push template updates for testing without impacting
normal users of the template.

---------

Co-authored-by: Ammar Bandukwala <ammar@ammar.io>
Co-authored-by: Muhammad Atif Ali <matifali@live.com>
Co-authored-by: Atif Ali <atif@coder.com>
2023-06-03 22:39:00 +00:00
Marcin Tojek a7366a8b76
feat!: drop support for legacy parameters (#7663) 2023-06-02 11:16:46 +02:00
Mathias Fredriksson 51841e9e11
test(cli): Fix TestTemplatePush/UseWorkingDir bad use of chdir (#7160) 2023-04-17 17:58:25 +03:00
Ammar Bandukwala f88f273cd6
fix: resolve template name from working directory "." (#6822) 2023-03-27 22:58:20 +00:00
Ammar Bandukwala 2bd6d2908e
feat: convert entire CLI to clibase (#6491)
I'm sorry.
2023-03-23 17:42:20 -05:00
Ammar Bandukwala f05609b4da
chore: format Go more aggressively 2023-02-18 18:32:09 -06: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 3724d81413
chore: simplify error handling in template push (#6065) 2023-02-06 20:35:48 +00:00
Ammar Bandukwala a422cc00e8
Stream template upload (#6035)
Resolves #5718
2023-02-04 20:07:09 +00: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 fcd5511403
fix: add provisioner tags to template push (#5446)
This was previously only on template create!
2022-12-16 15:13:03 +00: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
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
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
Ammar Bandukwala 6e63487b27
Rename `template update` to `template push` (#3307)
Before, there was a `template edit` AND a `template update`. The
distinction between both commands was easy to forget. `push` more
clearly indicates that the template's source code is being updated.

It is also complimentary to existing `template pull`.
2022-07-29 19:21:48 +00:00
Renamed from cli/templateupdate.go (Browse further)