Skip to content

coder show incorrectly shows permanent resources as ephemeral. #1937

Closed

Description

@spikecurtis

OS Information

  • OS: macOS
  • Browser (if applicable):
  • Architecture:
  • coder --version: Coder v0.6.0-devel+56ec53d0

Steps to Reproduce

  1. Create a workspace with persistent resources (e.g. docker example with volume)
  2. coder show <name>

Expected

coder show should list resources as permanent

Actual

% coder show test
┌─────────────────────────────────────────────────────────────────┐
│ RESOURCE                    STATUS             ACCESS           │
├─────────────────────────────────────────────────────────────────┤
│ docker_container.workspace  ephemeral                           │
│ └─ dev (linux, armv7)       ⦾ connecting [7s]   coder ssh test  │
├─────────────────────────────────────────────────────────────────┤
│ docker_volume.home_volume   ephemeral                           │
└─────────────────────────────────────────────────────────────────┘

Logs

Screenshot

Notes

What's going on here is that coder show is getting the resources for most recent build, which will only include resources at the most recent transition. Meanwhile, the CLI code derives the status of ephemeral / permanent based on whether there is a resource included for the stop transition. Since we only get start resources when querying the start job, the resources are always listed as ephemeral. You can see this clearly by stopping the workspace and then calling coder show again:

% coder show test
┌───────────────────────────────────────────────┐
│ RESOURCE                   STATUS      ACCESS │
├───────────────────────────────────────────────┤
│ docker_volume.home_volume  persistent         │
└───────────────────────────────────────────────┘

More generally, I'm not sure "status" is the right word for ephemeral vs permanent, as typically object status implies something that can change.

Finally, when we call coder show, I think users are going to be interested in not just whether the resource would remain if the workspace were stopped (ephemeral vs permanent), but whether the resource presently exists.

Implementation notes:

Options

  1. Get out of the idea of predicting ephemeral vs persistent. Coder show just shows you what the current resources are
  2. Fix the identification of ephemeral vs persistent based on the templates
  3. Really fix this by rerunning the dry tunes every time the parameters for the workspace are changed.
  4. have --dryrun option and do the computation at that time. This would have the impact of not being 'predictive' in terms of ephemeral vs persistent. (separate ticket / feature)

Decision: Option 1

AC

coder show does not show a status anymore - only the current resources
coder template create only shows the start resources
tests for the above

Activity

  1. spikecurtis commented on May 31, 2022

    @spikecurtis
    CollaboratorAuthor

    We won't know for sure what resources are created at start & stop until we get all the actual values of the parameters for the particular workspace instance. There is some attempt to learn this information at the time the template is ingested, but it won't be accurate in all cases.

    If we really care about giving end users this information we need to do the dry runs during workspace creation, not during template creation.

  2. spikecurtis commented on May 31, 2022

    @spikecurtis
    CollaboratorAuthor

    Looks like dry run during workspace creation is coming in #1732 so once that is merged we can take a stab at fixing up coder show by querying those resources...

  3. kylecarbs commented on Jun 1, 2022

    @kylecarbs
    Member

    We should probably look at the template version resources instead.

  4. added this to the Community MVP milestone on Jun 3, 2022
  5. changed the title [-]Bug: `coder show` incorrectly shows permanent resources as ephemeral.[/-] [+]`coder show` incorrectly shows permanent resources as ephemeral.[/+] on Jun 7, 2022
  6. self-assigned this
    on Jun 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

apiArea: HTTP APIcliArea: CLI

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions