Skip to content

chore: deprecate template create command in favor of template push #11390

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 43 commits into from
Jan 5, 2024

Conversation

f0ssel
Copy link
Contributor

@f0ssel f0ssel commented Jan 3, 2024

Closes #9318

What this changes:

  • coder template create has been marked as deprecated and produces a warning pushing users to push and edit commands.
  • --create flag has been removed from push in favor of automatically creating if template does not exist.
  • --private flag has been added to coder template edit to meet parity with the previous create command flags.
  • disable_everyone_group_access bool has been added to the template edit API to support the new --private flag.
  • Update docs to change mentions of coder templates create to coder templates push.

Examples:

➜  coder git:(f0ssel/templatepush-2) ✗ go run ./cmd/coder/main.go template create

DEPRECATION WARNING: This command will be removed in a future
release.
Use `coder templates push` command for creating and updating templates. 
Use `coder templates edit` command for editing template settings. 
➜  coder git:(f0ssel/templatepush-2) go run ./cmd/coder/main.go template -h   
coder v0.0.0-devel

USAGE:
  coder templates

  Manage templates

  Aliases: template

  Templates are written in standard Terraform and describe the infrastructure for workspaces
    - Make changes to your template, and plan the changes:
  
        $ coder templates plan my-template 
  
    - Create or push an update to the template. Your developers can update their
  workspaces:
  
        $ coder templates push my-template 

SUBCOMMANDS:
    archive     Archive unused or failed template versions from a given template(s)
    create      DEPRECATED: Create a template from the current directory or as specified by flag
    delete      Delete templates
    edit        Edit the metadata of a template by name.
    init        Get started with a templated template.
    list        List all the templates available for the organization
    pull        Download the active, latest, or specified version of a template to a path.
    push        Create or update a template from the current directory or as specified by flag
    versions    Manage different versions of the specified template

———
Run `coder --help` for a list of global options.

Copy link
Member

ammario commented Jan 3, 2024

I'm good with this change as it gets us closer to the ideal state. We will have to mark the PR as a breaking change.

@f0ssel
Copy link
Contributor Author

f0ssel commented Jan 3, 2024

Great, I'll continue this one and mark it so. Thanks for the guidance on this one.

@f0ssel
Copy link
Contributor Author

f0ssel commented Jan 3, 2024

@ammario One more thing, since this will be a breaking change - should we just bite the bullet and remove the create command altogether? Or is that too drastic? I figure it may be better than breaking people twice, once now and once again when we remove it. (And lets us do the cleanup now instead of possibly forgetting to do it later).

Copy link
Member

ammario commented Jan 3, 2024

That's a good point. We could go ahead and break "create" right now, but I don't think we should simply remove the command from the CLI as the error message would be scary. Instead, we can hide the subcommand and make it fail with something like "use push instead with the same arguments".

@ammario
Copy link
Member

ammario commented Jan 3, 2024

Hmm, I wonder if we can just make create an alias of push?

@f0ssel f0ssel changed the title fix: remove settings flags from template create command (experiment) fix!: remove settings flags from template create command (experiment) Jan 4, 2024
@f0ssel f0ssel changed the title fix!: remove settings flags from template create command (experiment) fix!: remove template create command in favor of template push Jan 4, 2024
@f0ssel f0ssel requested a review from ammario January 4, 2024 16:15
@f0ssel
Copy link
Contributor Author

f0ssel commented Jan 4, 2024

I went ahead and just made the command produce an error instructing users to push or edit, since an alias would just produce generic invalid flag errors without any other information.

@f0ssel f0ssel marked this pull request as ready for review January 4, 2024 17:44
@f0ssel f0ssel changed the title fix!: remove template create command in favor of template push fix!: deprecate template create command in favor of template push Jan 4, 2024
@f0ssel f0ssel changed the title fix!: deprecate template create command in favor of template push fix: deprecate template create command in favor of template push Jan 4, 2024
@github-actions github-actions bot added the release/breaking This label is applied to PRs to detect breaking changes as part of the release process label Jan 4, 2024
@f0ssel f0ssel changed the title fix: deprecate template create command in favor of template push chore: deprecate template create command in favor of template push Jan 4, 2024
@github-actions github-actions bot changed the title chore: deprecate template create command in favor of template push chore!: deprecate template create command in favor of template push Jan 4, 2024
@f0ssel f0ssel removed the release/breaking This label is applied to PRs to detect breaking changes as part of the release process label Jan 4, 2024
@f0ssel f0ssel changed the title chore!: deprecate template create command in favor of template push chore: deprecate template create command in favor of template push Jan 4, 2024
@f0ssel f0ssel requested a review from sreya January 5, 2024 19:00
@f0ssel
Copy link
Contributor Author

f0ssel commented Jan 5, 2024

@ammario @sreya I've made the changes we spoke about yesterday and this should be ready for review.

Copy link
Collaborator

@sreya sreya left a comment

Choose a reason for hiding this comment

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

It would be good if the command was marked as deprecrated in the coder templates --help output

@f0ssel f0ssel requested a review from sreya January 5, 2024 20:25
Copy link
Collaborator

@sreya sreya left a comment

Choose a reason for hiding this comment

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

LGTM, may be good to support deprecation in clibase but I don't have any suggestions for the best way to do it

@f0ssel f0ssel force-pushed the f0ssel/templatepush-2 branch from 2cfd8df to 13794fd Compare January 5, 2024 20:48
@f0ssel f0ssel enabled auto-merge (squash) January 5, 2024 21:00
@f0ssel f0ssel merged commit b21da38 into main Jan 5, 2024
@f0ssel f0ssel deleted the f0ssel/templatepush-2 branch January 5, 2024 21:04
@github-actions github-actions bot locked and limited conversation to collaborators Jan 5, 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.

Fold template create into template push
3 participants