-
Notifications
You must be signed in to change notification settings - Fork 190
feature(veinmind-runner): add harbor webhook #113
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
Conversation
| engine := s.registerRouter() | ||
|
|
||
| go func() { | ||
| err := engine.Run(":" + s.option.port) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里可以直接 engine.RunListener(s.option.listener)
| log.Error(err) | ||
| return | ||
| } | ||
| postData, err := route.ParseHarborwebhookPostdata(c) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
考虑下方法的入参,尽量做到通用,这里可能[]byte比较合适
| } | ||
| val, ok := s.option.policies.Load(postData.Type) | ||
| if !ok { | ||
| log.Error(err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里不需要打印err
| } | ||
|
|
||
| func (s *harborWebhookServer) registerRouter() *gin.Engine { | ||
| engine := gin.Default() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
整个函数体需要合理的代码块换行
|
|
||
| func (s *harborWebhookServer) registerRouter() *gin.Engine { | ||
| engine := gin.Default() | ||
| engine.POST("/api", func(c *gin.Context) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
路由层里不要加业务逻辑代码,拆分直接传给业务层处理
|
duplicate #116 |
No description provided.