Skip to content
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

Proposal: I would like to have support for generating the default config configuration using the command #383

Closed
summingyu opened this issue Apr 2, 2022 · 15 comments
Assignees

Comments

@summingyu
Copy link
Contributor

Description

I would like to have support for generating the default config configuration using the command
such as dtm config githubaction to generate the default configuration of githubaction

Describe the Proposal

The current way to get the plugin configuration file is to visit the docs directory of the github repository.
However, if a customer installs with brew or has only one binary, they may not know how the plugin configuration file is configured.
So there is a need to have a convenient way to show the default configuration of plugin.

Or go a step further and generate the toolschain configuration file with a command.
For example dtm config toolschain p1-p2-p3

@daniel-hutao
Copy link
Member

Great idea! In fact, as early as a few months ago, I thought about generating a specific devops toolchain through the command line interactively, such as the GitOps chain.
I have also discussed this idea with @IronCore864 before, but since DevStream is not mature enough, the idea had been waiting for the right time.


We can implement this idea step by step. In order to avoid getting into complications at the beginning, we can first implement such a feature:
output the default configuration of any plugin through the command line,
the output is exactly the same as the default configuration written in that plugin's documentation. In this way the user does not need to read the documentation to learn the configuration of a plugin. When this feature is perfected, we further think about the more interesting feature later.


Then I have a simple design for your reference:

  • command: dtm config default --plugin=A_PLUGIN_NAME.
  • All plugins need to support this command.
  • Maybe add an output.go file in the internal/pkg/plugin/PLUGIN_NAME/ directory to put this the "output content"
  • The "output content" may be like the code below:
var DefaultConfigContent = `tools:
- name: NAME
  # name of the plugin
  plugin: NAME
  options:
    foo: bar
`
  • The generation with output.go template should be adding to dtm develop xxx command.
  • Of course, related documents also need to be updated, but we can wait until this ticket is merged and then update docs separately. Because the document may involve multiple places such as repo/blogs, it will also involve some additional thinking, such as whether to update the old blog, or add a new blog, and then add the link to the old blog. In short, documentation is a separate piece of work but important too.

/cc @devstream-io/devstream

@daniel-hutao
Copy link
Member

daniel-hutao commented Apr 2, 2022

@summingyu Please wait for @IronCore864 's reply, start development after more discussions here.

@IronCore864
Copy link
Member

@summingyu great idea!

@daniel-hutao I think dtm config default is a little bit too verbose (command, sub-command, sub-sub command). Maybe dtm default-config --plugin=A_PLUGIN_NAME is enough?

Let's decide on this detail and get started :)

@daniel-hutao
Copy link
Member

When I was thinking about this command format(dtm config default), I thought that there may be more possibilities for config subcommands, such as dtm config validate, etc.;

Of course, there is no such needs at present, so dtm default-config --plugin=A_PLUGIN_NAME is also a good format for me.

As for the verbose, perhaps it would be easier for the user to see the default subcommand immediately after a short config command is entered after we have dig.

I'm not particularly prefer to a certain format above, just show my thoughts here. You decide it @IronCore864 @summingyu .

@IronCore864
Copy link
Member

@daniel-hutao @summingyu I think config sounds like a noun instead of a verb, so dtm config doesn't follow other commands' naming convention (dtm + verb), like dtm init, dtm apply, etc.

May I suggest dtm show default-config --plugin=A_PLUGIN_NAME?

I would like to use the verb show, because later we can also dtm show outputs.

What do you think?

@summingyu
Copy link
Contributor Author

@daniel-hutao @IronCore864

I think show config might be better, helm is also using this

@daniel-hutao
Copy link
Member

show config vs show default-config

I vote show config, it's more clear.

@IronCore864
Copy link
Member

Great, go for it. Then let's decide on dtm show config :)

@daniel-hutao
Copy link
Member

daniel-hutao commented Apr 6, 2022

I'll implement the default config print logic at dtm develop create-plugin first, then, we all can let all plugins to support the default config print logic together.

/cc @summingyu

@daniel-hutao
Copy link
Member

/cc @devstream-io/devstream If you are interested in this feature, please leave your comments below.

After I complete the development of dtm develop, I will assign a dozen specific plugins to volunteers leave comments below.

@summingyu
Copy link
Contributor Author

I am interested

@daniel-hutao daniel-hutao self-assigned this Apr 6, 2022
@imxw
Copy link
Member

imxw commented Apr 6, 2022

I'd like to join

@daniel-hutao
Copy link
Member

daniel-hutao commented Apr 7, 2022

@summingyu @imxw You can go for it after #392 merged.

  • Refer to the internal/pkg/show/config/plugin/argocd.go file to implement other plugins "default config print" logic in the same directory.
  • See docs/plugins for the default configs with all plugins.
  • Remember to use dtm show config --plugin=xxx to verify the result.
  • Keep the go file name same as the plugin name, such as argocd.go/jira-github-integ.go. (Refer to cmd/plugin)

As for the plugins assignment, you can discuss with each other and decide it.

@daniel-hutao
Copy link
Member

/assign @imxw @summingyu @daniel-hutao

@daniel-hutao
Copy link
Member

/close #392 #399 #400

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants