Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Change coder create | edit envs image flag to take image name and source defaults from image #159

Merged
merged 1 commit into from
Oct 27, 2020

Conversation

fuskovic
Copy link
Contributor

@fuskovic fuskovic commented Oct 26, 2020

What this does

  • Users can pass the image name to the --image flag instead of having to pass the image id.
  • This applies to both coder create and edit
  • Coder create and edit both now source default resource amounts based on the imported image vs arbitrary ones we had previously defined in the CLI.

Create

Create environment with default resource amounts

This screenshot also demonstrates some examples of errors users might have.

create

Create environment with custom resource amounts

create_w_custom

Edit

Change the image of an environment

When an environment image is changed and resource amounts are left unspecified, the resource amounts will be changed to that of the default resource amounts specified by the new image the environment will be using.

Also not there's a caveat here in the screenshot it's worth being aware of. Notice when we are going from codercom/enterprise-dev to ubuntu that we get a warning message about how we can't reduce the amount of disk storage. The ubuntu default is 10 so the tool is smart enough to recognize that the default amount of the new image for disk is smaller than what it's currently using and keeps it the same while warning the user.

edit_image

Change the resource amounts of an environment

edit_resoures

Change both the image and resource amounts of an environment

edit_both

@fuskovic fuskovic force-pushed the faris/ch2149/src-defaults-from-img branch 4 times, most recently from c823160 to 7d89f9e Compare October 27, 2020 01:12
@fuskovic fuskovic marked this pull request as ready for review October 27, 2020 01:32
@fuskovic fuskovic requested a review from cmoog October 27, 2020 01:32
@fuskovic fuskovic changed the title Change coder create envs image flag to take image name Change coder create | edit envs image flag to take image name and source defaults from image Oct 27, 2020
@fuskovic fuskovic force-pushed the faris/ch2149/src-defaults-from-img branch from 985b877 to 58b4d42 Compare October 27, 2020 18:19
@fuskovic
Copy link
Contributor Author

@tychoish

It looks like all the envs commands take pointers because the value of user is propogated by the persistent flag user upstream in the parent command. Other than that I pushed up all your suggested changes.

@cmoog

Pushed all yours up as well and I updated the PR description to reflect any new changes and behaviors.

@fuskovic fuskovic requested review from cmoog and tychoish October 27, 2020 18:23
@fuskovic fuskovic force-pushed the faris/ch2149/src-defaults-from-img branch from e6daf5c to 1a2a7ce Compare October 27, 2020 18:35
@@ -68,6 +68,16 @@ func LogSuccess(header string, lines ...string) {
}.String())
}

// LogWarn prints the given warn message to stderr.
func LogWarn(header string, lines ...string) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice 👍

// Environment disks can not be shrink so we have to overwrite this
// if the user accidentally requests it or if the default diskGB value for a
// newly requested image is smaller than the current amount the environment is using.
if *updateReq.DiskGB < conf.environment.DiskGB {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice 👍

@fuskovic fuskovic force-pushed the faris/ch2149/src-defaults-from-img branch from 928f447 to a3dfa5d Compare October 27, 2020 18:59
@cmoog
Copy link
Contributor

cmoog commented Oct 27, 2020

Also- I've been moving towards Squash and merge. Makes the commit history on master super clean and doesn't require as much force pushing for fixups and such.

@fuskovic fuskovic force-pushed the faris/ch2149/src-defaults-from-img branch from dc19fa2 to 9d1ed0d Compare October 27, 2020 19:08
@fuskovic fuskovic force-pushed the faris/ch2149/src-defaults-from-img branch from 0ee26d4 to dee3f7c Compare October 27, 2020 19:15
@fuskovic fuskovic merged commit cb3ac49 into master Oct 27, 2020
@fuskovic fuskovic deleted the faris/ch2149/src-defaults-from-img branch October 27, 2020 19:21
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