Repository navigation
Description
OS Information
- OS: macOS
- Browser (if applicable):
- Architecture:
coder --version: Coder v0.6.0-devel+56ec53d0
Steps to Reproduce
- Create a workspace with persistent resources (e.g. docker example with volume)
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
- Get out of the idea of predicting ephemeral vs persistent. Coder show just shows you what the current resources are
- Fix the identification of ephemeral vs persistent based on the templates
- Really fix this by rerunning the dry tunes every time the parameters for the workspace are changed.
- have
--dryrunoption 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
spikecurtis commentedon May 31, 2022
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.
spikecurtis commentedon May 31, 2022
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 showby querying those resources...kylecarbs commentedon Jun 1, 2022
We should probably look at the template version resources instead.
[-]Bug: `coder show` incorrectly shows permanent resources as ephemeral.[/-][+]`coder show` incorrectly shows permanent resources as ephemeral.[/+]