Skip to content

chore: create workspaces and templates for multiple orgs #13866

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 11 commits into from
Jul 12, 2024

Conversation

Emyrk
Copy link
Member

@Emyrk Emyrk commented Jul 10, 2024

What this does

This allows creating a workspace using a template in an organization other than the default. If only 1 organization exists, then nothing changes.

If you select a template that has a unique name, then coder create can infer the organization to create the workspace in. If the template name is not unique across organizations, then using --org is required.

Changes

Create lists templates

Screenshot from 2024-07-11 12-25-09

template create (deprecated command, but still exists)

Prints out the coder cli command to use the template without any ambiguity. If another template of the same name exists in another org, --org=<org_name> must be specified.

The rabbitt3 template has been created at
Jul 10 10:47:24! Developers can provision a workspace
with this template using:

   coder create --template="<template_name>" --org="<org_name>" [workspace name] 

coder create with ambiguous organization

If a template name is not unique across multiple organizations, coder create requires a --rg=<org_name> flag to disambiguate.

$ coder create --template="docker" ambigiousworkspace
Encountered an error running "coder create", see "coder create --help" for more information
error: multiple templates found with the name "docker", use `--org=<organization_name>` to specify which template by that name to use. Organizations available: first-organization, rabbit

coder create with a wrong organization selected

If you try to use a template with --org set to the wrong organization, an error is thrown.

$ coder create --template="rabbitt" --org="first-organization" ambigiousworkspace2
Encountered an error running "coder create", see "coder create --help" for more information
error: template is in organization "rabbit", but '--org="first-organization"' was specified. Use '--org="rabbit"' to use this template

@Emyrk Emyrk changed the title chore: creating workspaces and templates to work with orgs chore: create workspaces and templates for multi orgs Jul 10, 2024
@Emyrk Emyrk changed the title chore: create workspaces and templates for multi orgs chore: create workspaces and templates for multiple orgs Jul 10, 2024
@Emyrk Emyrk force-pushed the stevenmasley/create_workspace branch 2 times, most recently from 4160118 to d59cb83 Compare July 11, 2024 14:18
@Emyrk Emyrk force-pushed the stevenmasley/create_workspace branch from 401166d to da4d8ee Compare July 11, 2024 16:32
@Emyrk Emyrk marked this pull request as ready for review July 11, 2024 16:53
@Emyrk Emyrk requested a review from f0ssel July 12, 2024 13:16
Copy link
Contributor

@f0ssel f0ssel left a comment

Choose a reason for hiding this comment

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

I think this is all good for now, but before experimental release I'd like to nail down how much we need to handle different org cases or if we just make everything take a flag explicitly to simplify things. Something we should probably loop in with product.

@Emyrk
Copy link
Member Author

Emyrk commented Jul 12, 2024

I think this is all good for now, but before experimental release I'd like to nail down how much we need to handle different org cases or if we just make everything take a flag explicitly to simplify things. Something we should probably loop in with product.

The downside of the explicit flag is deployments with only 1 org 😢

@Emyrk Emyrk merged commit 9cbe2b2 into main Jul 12, 2024
32 checks passed
@Emyrk Emyrk deleted the stevenmasley/create_workspace branch July 12, 2024 20:47
@github-actions github-actions bot locked and limited conversation to collaborators Jul 12, 2024
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.

2 participants