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: new command: dtm develop validate-plugin --all #443

Closed
daniel-hutao opened this issue May 5, 2022 · 9 comments
Closed

🍀 Proposal: new command: dtm develop validate-plugin --all #443

daniel-hutao opened this issue May 5, 2022 · 9 comments
Assignees
Labels
good first issue Good for newcomers

Comments

@daniel-hutao
Copy link
Member

daniel-hutao commented May 5, 2022

Description

Background

DevStream CLI dtm has a developer command dtm develop create-plugin to help contributors generate boilerplate code for a new plugin.

Usage: dtm develop create-plugin --name=xxx.

Then we added another command (thanks to @summingyu) dtm develop validate-plugin to further help developers to "validate" the code they wrote. For example, this command will validate if necessary source code files exist or not.

The thing is, we had created many plugins before the creation of the validate command, and that's why if we use the "validate" command against existing plugins, not all plugins could pass the validation.

Proposal

Refactor existing plugins (mainly rename/restructure, etc.) so that:

dtm develop validate-plugin --all

can pass.

@daniel-hutao daniel-hutao added the good first issue Good for newcomers label May 5, 2022
@xavier-hou
Copy link
Member

I wanna try

@daniel-hutao
Copy link
Member Author

/assign @HXCGIT

@daniel-hutao
Copy link
Member Author

Happy coding with your first pr! Feel free to call me anytime if you need any help. @HXCGIT

@xavier-hou
Copy link
Member

Happy coding with your first pr! Feel free to call me anytime if you need any help. @HXCGIT

I have a problem here. In dtm cli, develop act as a sub-command and valicate-plugin act as a argument. I'am not clear whether we can add a flag to arguments. If we add --all flag to develop command, then create-plugin will also have this flag. Does this make sense?
@daniel-hutao @summingyu

@daniel-hutao
Copy link
Member Author

@HXCGIT First of all, sorry for not replying to your comment in time, I've been a little busy lately with too much chores in my hands. Anyway I am so sorry about it.

You are very thoughtful, the behavior you mentioned is really not the best practice. Both validate-plugin and create-plugin should be sub-commands.

Although not it is currently functional, but it is indeed not optimal. And other commands also have a similar "flag is not accurate enough" problem.

Maybe after completing the functional development with validate-plugin, we can do some refactoring work to make this piece of logic better.

If you are interested in it, you are also very very welcome to submit a PR to complete this refactoring.

@xavier-hou
Copy link
Member

@daniel-hutao Thank you for your reply! I am more than happy to address the issue. I will do my best to complete this refactoring with your help!

@daniel-hutao
Copy link
Member Author

@HXCGIT The validation rules need some improvement. So let's wait for @summingyu do some work about it. See #453 for more info.

@daniel-hutao daniel-hutao changed the title Proposal: new command: dtm develop validate-plugin --all 🍀 Proposal: new command: dtm develop validate-plugin --all May 17, 2022
@daniel-hutao
Copy link
Member Author

I've test the --all flag and it does well.

  • ./dtm develop validate-plugin -a or
  • ./dtm develop validate-plugin --all
2022-05-19 22:27:19 ℹ [INFO]  Start validating all plugins.

2022-05-19 22:27:19 ℹ [INFO]  ===== start validating <argocd> =====
2022-05-19 22:27:19 ✔ [SUCCESS]  Plugin <argocd> passed validation.
2022-05-19 22:27:19 ℹ [INFO]  ===== Finished validate <argocd> =====

2022-05-19 22:27:19 ℹ [INFO]  ===== start validating <argocdapp> =====
2022-05-19 22:27:19 ✔ [SUCCESS]  Plugin <argocdapp> passed validation.
2022-05-19 22:27:19 ℹ [INFO]  ===== Finished validate <argocdapp> =====

2022-05-19 22:27:19 ℹ [INFO]  ===== start validating <devlake> =====
2022-05-19 22:27:19 ✔ [SUCCESS]  Plugin <devlake> passed validation.
2022-05-19 22:27:19 ℹ [INFO]  ===== Finished validate <devlake> =====

2022-05-19 22:27:19 ℹ [INFO]  ===== start validating <github-repo-scaffolding-golang> =====
2022-05-19 22:27:19 ✔ [SUCCESS]  Plugin <github-repo-scaffolding-golang> passed validation.
2022-05-19 22:27:19 ℹ [INFO]  ===== Finished validate <github-repo-scaffolding-golang> =====

2022-05-19 22:27:19 ℹ [INFO]  ===== start validating <githubactions-golang> =====
2022-05-19 22:27:19 ✔ [SUCCESS]  Plugin <githubactions-golang> passed validation.
2022-05-19 22:27:19 ℹ [INFO]  ===== Finished validate <githubactions-golang> =====

2022-05-19 22:27:19 ℹ [INFO]  ===== start validating <githubactions-nodejs> =====
2022-05-19 22:27:19 ✔ [SUCCESS]  Plugin <githubactions-nodejs> passed validation.
2022-05-19 22:27:19 ℹ [INFO]  ===== Finished validate <githubactions-nodejs> =====

2022-05-19 22:27:19 ℹ [INFO]  ===== start validating <githubactions-python> =====
2022-05-19 22:27:19 ✔ [SUCCESS]  Plugin <githubactions-python> passed validation.
2022-05-19 22:27:19 ℹ [INFO]  ===== Finished validate <githubactions-python> =====

2022-05-19 22:27:19 ℹ [INFO]  ===== start validating <gitlab-repo-scaffolding-golang> =====
2022-05-19 22:27:19 ✔ [SUCCESS]  Plugin <gitlab-repo-scaffolding-golang> passed validation.
2022-05-19 22:27:19 ℹ [INFO]  ===== Finished validate <gitlab-repo-scaffolding-golang> =====

2022-05-19 22:27:19 ℹ [INFO]  ===== start validating <gitlabci-generic> =====
2022-05-19 22:27:19 ✔ [SUCCESS]  Plugin <gitlabci-generic> passed validation.
2022-05-19 22:27:19 ℹ [INFO]  ===== Finished validate <gitlabci-generic> =====

2022-05-19 22:27:19 ℹ [INFO]  ===== start validating <gitlabci-golang> =====
2022-05-19 22:27:19 ✔ [SUCCESS]  Plugin <gitlabci-golang> passed validation.
2022-05-19 22:27:19 ℹ [INFO]  ===== Finished validate <gitlabci-golang> =====

2022-05-19 22:27:19 ℹ [INFO]  ===== start validating <hashicorp-vault> =====
2022-05-19 22:27:19 ✔ [SUCCESS]  Plugin <hashicorp-vault> passed validation.
2022-05-19 22:27:19 ℹ [INFO]  ===== Finished validate <hashicorp-vault> =====

2022-05-19 22:27:19 ℹ [INFO]  ===== start validating <helm-generic> =====
2022-05-19 22:27:19 ✔ [SUCCESS]  Plugin <helm-generic> passed validation.
2022-05-19 22:27:19 ℹ [INFO]  ===== Finished validate <helm-generic> =====

2022-05-19 22:27:19 ℹ [INFO]  ===== start validating <jenkins> =====
2022-05-19 22:27:19 ✔ [SUCCESS]  Plugin <jenkins> passed validation.
2022-05-19 22:27:19 ℹ [INFO]  ===== Finished validate <jenkins> =====

2022-05-19 22:27:19 ℹ [INFO]  ===== start validating <jira-github-integ> =====
2022-05-19 22:27:19 ✔ [SUCCESS]  Plugin <jira-github-integ> passed validation.
2022-05-19 22:27:19 ℹ [INFO]  ===== Finished validate <jira-github-integ> =====

2022-05-19 22:27:19 ℹ [INFO]  ===== start validating <kube-prometheus> =====
2022-05-19 22:27:19 ✔ [SUCCESS]  Plugin <kube-prometheus> passed validation.
2022-05-19 22:27:19 ℹ [INFO]  ===== Finished validate <kube-prometheus> =====

2022-05-19 22:27:19 ℹ [INFO]  ===== start validating <openldap> =====
2022-05-19 22:27:19 ✔ [SUCCESS]  Plugin <openldap> passed validation.
2022-05-19 22:27:19 ℹ [INFO]  ===== Finished validate <openldap> =====

2022-05-19 22:27:19 ℹ [INFO]  ===== start validating <trello> =====
2022-05-19 22:27:19 ✔ [SUCCESS]  Plugin <trello> passed validation.
2022-05-19 22:27:19 ℹ [INFO]  ===== Finished validate <trello> =====

2022-05-19 22:27:19 ℹ [INFO]  ===== start validating <trello-github-integ> =====
2022-05-19 22:27:19 ✔ [SUCCESS]  Plugin <trello-github-integ> passed validation.
2022-05-19 22:27:19 ℹ [INFO]  ===== Finished validate <trello-github-integ> =====
``

@daniel-hutao
Copy link
Member Author

/close #551

@daniel-hutao daniel-hutao self-assigned this May 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants