Skip to content

feat: implement deprecated flag for templates to prevent new workspaces #10745

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
Nov 20, 2023

Conversation

Emyrk
Copy link
Member

@Emyrk Emyrk commented Nov 16, 2023

Closes #6355

What this does

Adds a new template meta data field "deprecated" that if set blocks new workspaces from being created on that template.

Existing workspaces still function as before.

UX could be improved, but I implemented an MVP to make the deprecation noticeable on all relevant pages.

UI

Deprecate a template

Screenshot from 2023-11-17 15-10-02

Missing enterprise license

Screenshot from 2023-11-17 15-15-08

Deprecated templates remain deprecated if you lose your license. But you can no longer edit the field. I think this is better than making the template active again.

Creating a workspace

This could probably be prevented with better ux?

Screenshot from 2023-11-17 12-13-28

Templates table page

Screenshot from 2023-11-17 14-23-13

Templates page

We should show the deprecation message here. I just don't know where to put it 🤔

Screenshot from 2023-11-17 14-48-29

Workspace page

Screenshot from 2023-11-17 14-42-33

@Emyrk Emyrk marked this pull request as ready for review November 17, 2023 21:17
@ammario
Copy link
Member

ammario commented Nov 18, 2023

You should be able to remove deprecation even without a license, but not add it back. You should always be able to return your deployment to the pre-license state without a license.

@Emyrk
Copy link
Member Author

Emyrk commented Nov 19, 2023

You should be able to remove deprecation even without a license, but not add it back. You should always be able to return your deployment to the pre-license state without a license.

I can add the ability to remove deprecation then. It's just a little more difficult in the UI to have it not disabled, but then be disabled when you delete the message.

I thought it was clunky in the UI 🤔

Copy link
Member

@johnstcn johnstcn left a comment

Choose a reason for hiding this comment

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

This PR is approaching the upper limit of what I'm comfortable reviewing at once.

It would be a lot simpler to review the following separately:

  • Database + API changes
  • UI changes
  • CLI changes

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.

Left a few comments.

@@ -614,6 +614,21 @@ func CreateAnotherUserMutators(t testing.TB, client *codersdk.Client, organizati
return createAnotherUserRetry(t, client, organizationID, 5, roles, mutators...)
}

// AuthzUserSubject does not include the user's groups.
func AuthzUserSubject(user codersdk.User) rbac.Subject {
Copy link
Member

Choose a reason for hiding this comment

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

That's handy!

Copy link
Member Author

Choose a reason for hiding this comment

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

Yup, got tired of using AsSystemContext in all my unit tests. Figured this would be a bit better.

@Emyrk Emyrk enabled auto-merge (squash) November 20, 2023 19:15
@Emyrk Emyrk merged commit 5229d7f into main Nov 20, 2023
@Emyrk Emyrk deleted the stevenmasley/deprecate_template branch November 20, 2023 19:16
@github-actions github-actions bot locked and limited conversation to collaborators Nov 20, 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.

feat: allow disabling an existing template (template deprecation)
5 participants