Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat!: drop support for legacy parameters #7663

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 47 commits into from
Jun 2, 2023

Conversation

mtojek
Copy link
Member

@mtojek mtojek commented May 24, 2023

Fixes: #7452

This PR rips off legacy parameters from coder source code. The size of the PR is huge, it is basically unreviewable, so I suggest playing around with the branch.

I removed references to legacy parameters from:

  • API/coderd
  • provisioners and provisioner daemon
  • CLI
  • site/UI

Once this is merged, coder will require feature_use_managed_variables = true if there any variables. This is the only way we can distinguish if variable is potentially a legacy parameter. After a few releases, we can remove that requirement.

I didn't remove the relevant database table in case somebody would like to roll back to the previous release.

Screenshot 2023-05-25 at 13 25 06

Extra changes:

  • API methods with empty responses (deprecated endpoint) d6e5207
  • Extra check to block pushing templates with legacy parameters. 0ed1bad
  • Legacy parameters verification 8c5eee9

@mtojek mtojek self-assigned this May 24, 2023
@mtojek mtojek force-pushed the 7452-remove-legacy-parameters branch from 884dbbc to 70b2a98 Compare May 24, 2023 17:21
@matifali
Copy link
Member

Can we use terraform variable with use_managed_variable set in the coder terraform provider?

@mtojek
Copy link
Member Author

mtojek commented May 25, 2023

Can we use terraform variable with use_managed_variable set in the coder terraform provider?

For detecting pushed templates with legacy params? Yes, that's the assumption 👍

@matifali
Copy link
Member

Can we use terraform variable with use_managed_variable set in the coder terraform provider?

For detecting pushed templates with legacy params? Yes, that's the assumption 👍

I mean after the deprecation. Can we still use them to store sensitive data?

@mtojek
Copy link
Member Author

mtojek commented May 25, 2023

I mean after the deprecation. Can we still use them to store sensitive data?

After deprecation, users will be able to use Terraform variables only as managed ones.

@mtojek mtojek force-pushed the 7452-remove-legacy-parameters branch from f7c703e to d6e5207 Compare May 25, 2023 10:47
@mtojek mtojek force-pushed the 7452-remove-legacy-parameters branch from 8915f75 to 217ea69 Compare May 25, 2023 11:08
@mtojek mtojek marked this pull request as ready for review May 25, 2023 13:07
@mtojek mtojek requested a review from johnstcn May 25, 2023 13:08
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.

LGTM

@mtojek
Copy link
Member Author

mtojek commented May 31, 2023

add a permanent banner highlighting that the workspace with legacy parameters is not supported

Screenshot 2023-05-31 at 18 18 47 Screenshot 2023-05-31 at 18 17 01

show warning in the CLI

Screenshot 2023-05-31 at 17 52 50

try to find a way to delete the impaired workspace if it requires Terraform variables to do that

  1. Template author should add feature_use_managed_variables = true to the template.
  2. Update the affected workspace.
  3. Delete the workspace.

Clean!

@mtojek mtojek requested a review from spikecurtis May 31, 2023 16:19
@bpmct
Copy link
Member

bpmct commented May 31, 2023

Awesome!! How will the template author know to do steps 1-3? Are there cases where deleting the workspace will not work until steps 1-3 are completed?

Perhaps we should link to some docs on how to clean up the old workspaces in the message.

@ammario ammario changed the title feat!: Drop support for legacy parameters feat!: drop support for legacy parameters May 31, 2023
@spikecurtis
Copy link
Contributor

try to find a way to delete the impaired workspace if it requires Terraform variables to do that

  1. Template author should add feature_use_managed_variables = true to the template.
  2. Update the affected workspace.
  3. Delete the workspace.

Clean!

  1. I have a workspace up that uses legacy parameters
  2. Upgrade Coderd
  3. Stop the workspace

I get failed stop

Error: No value for required variable
on main.tf line 27:
  27: variable "legacy" {
The root module input variable "legacy" is not set, and has no default value. Use a -var or -var-file command line argument to provide a value for this variable.

But, then, if I

  1. Update the template to convert to a rich parameter, set feature_use_managed_variables = true
  2. Update the workspace (it prompts me for the parameter value --- no migration of my old value)

It succeeds building.

A little gnarly, but works out ok in the end. @bpmct you ok with that?

@spikecurtis
Copy link
Contributor

So this UX is confusing:

Screen.Recording.2023-06-01.at.2.10.24.PM.mov

If I try to change to an old version with legacy parameters, it

a) doesn't change the version
b) tells me to delete the workspace

The warning box that comes up should say something like, "Unable to change version. Legacy parameters in use on this version aren't supported any more."

@spikecurtis
Copy link
Contributor

The error message says, "Legacy parameters are not supported anymore, delete the workspace and the related template."

This isn't great advice

If you do delete the workspace, the delete job will always fail because there are variables in the template that we aren't supplying value to. It then tells you to have an admin delete with --orphan, but we could skip straight to this, instead of having the user bang their head against a failed delete.

Also, deleting the template is not necessary. The template author can just rework the variables to "coder_parameters", push a new version, and then people can upgrade.

Basically, there is nothing a regular (non-template-admin, non-owner) user can meaningfully do if they have a workspace that uses legacy parameters after upgrade. Our advice to end users should just be, "Contact your administrator for assistance."

Our advice to admins (this can be in docs & release notes, it doesn't have to be in the dashboard IMO) should be:

Decide whether you are going to fix the template to use rich parameters. If you aren't going to fix it, then delete all workspaces with --orphan, manually clean up infrastructure resources, and delete the template. If you are going to fix it, then push a new version, and upgrade all the affected workspaces.

@mtojek
Copy link
Member Author

mtojek commented Jun 1, 2023

The warning box that comes up should say something like, "Unable to change version. Legacy parameters in use on this version aren't supported any more."

It is one more API to cover with extra condition, should not be hard to do this.

Despite that, I think that we should not invest much time and efforts on making the whole operation really smooth. In theory, this is already beyond the deprecation timeline (end of April), so most of the users should be already migrated. I doubt that these paths will be actively followed.

Basically, there is nothing a regular (non-template-admin, non-owner) user can meaningfully do if they have a workspace that uses legacy parameters after upgrade

Thanks for providing UX feedback. "Contact your administrator for assistance." seems to be a better fit and actionable for every regular user. I also like the idea to describe admin steps in docs. Happy to adjust both.

@mtojek
Copy link
Member Author

mtojek commented Jun 1, 2023

It is one more API to cover with extra condition, should not be hard to do this.

Actually it is more challenging that I expected, as "Change Version" dialog uses the same API method as Start or Stop workspace (/builds). If it isn't required, I wouldn't like to add more UI logic to handle this case, as this is contrary to what we're trying to achieve - remove references to legacy stuff.

I decided to just adjust wording here. Let me know your thoughts:

Screenshot 2023-06-01 at 16 11 44

EDIT:

Maybe it is better to keep docs aside from this PR as it is huge and hard to review. I will push the docs update in the follow-up as I wouldn't like to keep this submission open for a long time.

@mtojek mtojek requested a review from spikecurtis June 1, 2023 14:23
@mtojek mtojek marked this pull request as ready for review June 1, 2023 14:23
Copy link
Contributor

@spikecurtis spikecurtis left a comment

Choose a reason for hiding this comment

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

I like the new error message and I agree that if it's a huge pain to fix up the Change Versions case, then we can live with some ugliness since it'll only affect people in the short term.

@mtojek mtojek merged commit a7366a8 into coder:main Jun 2, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Jun 2, 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.

Deprecation plan for legacy parameters
5 participants