Skip to content

feat: Add CLI support for workspace build parameters - #5768

Merged
mtojek merged 16 commits into
coder:mainfrom
mtojek:5574-cli-add-template-version-parameters
Jan 23, 2023
Merged

mtojek merged 16 commits into
coder:mainfrom
mtojek:5574-cli-add-template-version-parameters

Conversation

@mtojek

@mtojek mtojek commented Jan 18, 2023 •

Copy link
Copy Markdown
Member

Related: #5574

Changes:

  • feat: coder create ... --rich-parameters-file <file>
  • feat: coder update ... --rich-parameters-file <file>
  • feat: cliui adjusted to handle rich parameters as old ones
  • feat: dry-run template with rich parameter values
  • feat: coderd handles mutable parameters
  • fix: use provider.ParameterEnvironmentVariable to hashencode parameter names

Template used for testing purposes:

...

data "coder_parameter" "project_id" {
  name = "Project ID"
  icon = "/icon/folder.svg"
  description = "This is the Project ID."
  default = "12345"
}

data "coder_parameter" "sample_mutable" {
  name = "Sample mutable"
  icon = "/icon/folder.svg"
  description = "This is a sample, mutable parameter."
  default = "helloworld"
  mutable = true
}

...

CLI create:

./scripts/coder-dev.sh create --template="docker-2" docker-rich-1

  This template has customizable parameters. Values can be
  changed after create, but may have unintended side effects
  (like data loss).

Project ID
  This is the Project ID.

> Enter a value (default: "12345"): foobar1
Sample mutable
  This is a sample, mutable parameter.

> Enter a value (default: "helloworld"): sample1
Planning workspace...
✔ Queued [804ms]
⧗  Setting up
...

CLI update:

./scripts/coder-dev.sh update docker-rich-1 --always-prompt

  This template has customizable parameters. Values can be
  changed after create, but may have unintended side effects
  (like data loss).

Parameter "Project ID" is not mutable, so can't be customized after workspace creation.
Sample mutable
  This is a sample, mutable parameter.

> Enter a value (default: "helloworld"): mutable1
Planning workspace...
✔ Queued [753ms]
⧗  Setting up

@mtojek mtojek self-assigned this Jan 18, 2023
@mtojek mtojek mentioned this pull request Jan 18, 2023
@mtojek
mtojek requested a review from kylecarbs January 19, 2023 18:10
@mtojek
mtojek marked this pull request as ready for review January 19, 2023 18:10
@mtojek
mtojek requested a review from a team as a code owner January 19, 2023 18:10
@mtojek
mtojek requested review from BrunoQuaresma and removed request for a team January 19, 2023 18:10

@BrunoQuaresma BrunoQuaresma left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JS looks good!

@kylecarbs kylecarbs left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't have a ton of time to give this a thorough review, all looks as expected!

@mtojek
mtojek merged commit bbb208e into coder:main Jan 23, 2023
@github-actions github-actions Bot locked and limited conversation to collaborators Jan 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants