Skip to content

feat: Add CLI support for workspace build parameters #5768

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Jan 23, 2023

Conversation

mtojek
Copy link
Member

@mtojek mtojek commented Jan 18, 2023

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
Copy link
Collaborator

@BrunoQuaresma BrunoQuaresma left a comment

Choose a reason for hiding this comment

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

JS looks good!

Copy link
Member

@kylecarbs kylecarbs left a comment

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