Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: Unify cli behavior for templates create and update#1385

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
mafredri merged 3 commits intomainfrommafredri/feat-common-cli-params-for-templates
May 12, 2022

Conversation

mafredri
Copy link
Member

This PR changes thetemplates update command to be more in line withtemplates create.

Changes:

  • The directory is either cwd or provided via the-d flag, same ascreate
  • A confirmation prompt is now shown to confirm theupdate directory, same ascreate
  • For bothcreate andupdate the--provider flag is now called--test.provider and has no shorthand to improve clarity
  • A test was added forupdate

Other considerations:

  • I considered turning dir into a mandatory arg and name into an optional flag as it would be quite low effor to dotemplates create .,tempaltes update . and by default infer thename from the provided directory. Ultimately decided to keep the behavior as-is but am open to make the change if it seems like a good idea

Fixes#565


Observations:

  • While trying to get the spinner to show, I tried dumping a few MB of data into the folder, only to notice there's a 1MB limit. This does seem a bit conservative?

@mafredrimafredri self-assigned thisMay 11, 2022
@mafredrimafredri requested review frombpmct,johnstcn anda teamMay 11, 2022 13:23
@codecov
Copy link

codecovbot commentedMay 11, 2022
edited
Loading

Codecov Report

Merging#1385 (6bfed73) intomain (9d94f4f) willincrease coverage by0.38%.
The diff coverage is82.00%.

@@            Coverage Diff             @@##             main    #1385      +/-   ##==========================================+ Coverage   66.93%   67.32%   +0.38%==========================================  Files         288      288                Lines       18856    19105     +249       Branches      241      241              ==========================================+ Hits        12622    12862     +240+ Misses       4944     4931      -13- Partials     1290     1312      +22
FlagCoverage Δ
unittest-go-macos-latest54.60% <82.00%> (+0.52%)⬆️
unittest-go-postgres-65.73% <82.00%> (+0.30%)⬆️
unittest-go-ubuntu-latest56.72% <82.00%> (+0.33%)⬆️
unittest-go-windows-202252.92% <82.00%> (+0.54%)⬆️
unittest-js74.24% <ø> (ø)
Impacted FilesCoverage Δ
cli/templatecreate.go48.36% <63.15%> (+1.44%)⬆️
cli/templateupdate.go60.67% <93.54%> (+53.42%)⬆️
provisionersdk/serve.go35.13% <0.00%> (-8.11%)⬇️
coderd/turnconn/turnconn.go81.91% <0.00%> (-3.20%)⬇️
codersdk/workspaceagents.go51.52% <0.00%> (-1.36%)⬇️
coderd/organizations.go56.23% <0.00%> (-1.01%)⬇️
coderd/provisionerdaemons.go63.81% <0.00%> (-0.17%)⬇️
coderd/database/queries.sql.go77.78% <0.00%> (-0.13%)⬇️
cli/templates.go100.00% <0.00%> (ø)
provisionersdk/agent.go100.00% <0.00%> (ø)
... and15 more

Continue to review full report at Codecov.

Legend -Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing data
Powered byCodecov. Last update9d94f4f...6bfed73. Read thecomment docs.


currentDirectory, _ := os.Getwd()
cmd.Flags().StringVarP(&directory, "directory", "d", currentDirectory, "Specify the directory to create from")
cmd.Flags().StringVarP(&provisioner, "test.provisioner", "", "terraform", "Customize the provisioner backend")
Copy link
Member

Choose a reason for hiding this comment

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

I really like this!

mafredri reacted with heart emoji
Copy link
Contributor

Choose a reason for hiding this comment

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

Why isprovisioner ->test.provisioner a good idea?

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, is it possible / advisable to allow people to switch from one provisioner to another for a template that already exists?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

It's because this is not a flag that should be exposed to users (which is why it's hidden on the lines below). Naming ittest. is a convention we could use throughout the cli when we need to modify functionality for test purposes, it also makes it very clear that these are not ordinary flags.

Copy link
Contributor

Choose a reason for hiding this comment

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

I mean, I get that terraform is the only "real" provisioner at the moment, but that may not be true long term, and so you'd use that flag outside of testing purposes.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I think at that point we'd figure out how to officially support it, and not re-use this flag.

Copy link
Member

@kylecarbskylecarbs left a comment

Choose a reason for hiding this comment

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

@johnstcn left a great review, and LGTM too! 🥳

The change ofprovisioner totest.provisioner is really nice!

mafredri reacted with heart emoji
@mafredrimafredri merged commit56076a0 intomainMay 12, 2022
@mafredrimafredri deleted the mafredri/feat-common-cli-params-for-templates branchMay 12, 2022 11:55
@missknissmisskniss added this to theV2 Beta milestoneMay 15, 2022
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@spikecurtisspikecurtisspikecurtis left review comments

@johnstcnjohnstcnjohnstcn approved these changes

@kylecarbskylecarbskylecarbs approved these changes

@bpmctbpmctAwaiting requested review from bpmct

Assignees

@mafredrimafredri

Labels
None yet
Projects
None yet
Milestone
V2 Beta
Development

Successfully merging this pull request may close these issues.

use common directory params fortemplates create andtemplates update
5 participants
@mafredri@johnstcn@spikecurtis@kylecarbs@misskniss

[8]ページ先頭

©2009-2025 Movatter.jp