Request Client part of DingTalk Robot Command
Problem to solve
handle dingtalk messages
dingtalk command video
error message
-
gitlab 不是专业版时或者旗舰版 => Dingtalk bot is deactivated. Please upgrade your JiHu GitLab to Premium Plan -
gitlab 接收到钉钉消息,但发现没有打开钉钉 feature flag => Please enable the "dingtalk_integration" feature flag in JiHu GitLab. -
gitlab 手动消息,但验证后发现不是钉钉合法消息,=> Message verification failed. Please check your settings of Dingtalk integration in JiHu GitLab. -
gitlab 管理员没有在 admin -> settings -> general 中正确配置钉钉,=> Please contact your administrator to enable Dingtalk integration in Admin -Settings - General -
gitlab 管理员没有在 admin -> settings -> integration 中创建钉钉集成应用 => Please contact your administrator to enable Dingtalk integration in Admin -Settings - Integration -
gitlab 收到钉钉消息,发现用户没有绑定 => You need to connect your JiHu GitLab account before performing bot commands. Please connect your JiHu GitLab account.
Task List
validation
-
help command -
find project first, check project authroization -
response message
help in group channel
The following commands are available for DingTalk integration:
- @(bot name) (project-path) issue show (id)
- @(bot name) (project-path) issue new (title) ⇧ Shift+↵ Enter (description)
- @(bot name) (project-path) issue search (your query)
- @(bot name) (project-path) issue move (issue_id) to (project_path)
- @(bot name) (project-path) issue close (id)
- @(bot name) (project-path) issue comment (id) ⇧ Shift+↵ Enter (comment)
- @(bot name) (project-path) deploy (environment) to (target-environment)
- @(bot name) (project-path) run (command) (arguments)
For more information https://dingtalk-command-doc.com
help in bot personal channel
The following commands are available for DingTalk integration:
- (project-path) issue show (id)
- (project-path) issue new (title) ⇧ Shift+↵ Enter (description)
- (project-path) issue search (your query)
- (project-path) issue move (issue_id) to (project_path)
- (project-path) issue close (id)
- (project-path) issue comment (id) ⇧ Shift+↵ Enter (comment)
- (project-path) deploy (environment) to (target-environment)
- (project-path) run (command) (arguments)
For more information https://dingtalk-command-doc.com
-
not found command, 使用 I cannot understand your command. Type "@(bot name) help" to view all commands. -
not found project, 使用 I cannot find the project (project-path). -
user is deactivated => Your JiHu GitLab user account is locked. Please unlock it before performing bot commands. -
不允许在 project 上操作 => You are not allowed to perform bot commands.
issue new
-
success, return sample link type message -
failed, return error message -
success message format
-
issue new error => Failed to create the issue: title cannot be blank
issue show
-
response message format -
creator name and avatar -
creator name -
issue title and number, with clickable link -
issue status -
issue important props, assignee, milestone, labels, weight
-
-
success, return sample link type message -
confidential issue, respond to sender not in group chat -
not found, return not found message -
success message, -
not found issue, use I cannot find the issue (id)
issue search
-
found > 5=, only return first 5 issues, title and status with link in markdown type, need use \n
to separate new line -
search in group -
search in person, -
not found => I cannot find any issue related to (query)
issue move
-
success, show Moved issue #{old_link} to #{new_link}
, reuse issue message template -
old issue closed already, use I cannot move closed issue -
target project not found, use I cannot found target project (target_project_path) -
move failed, => Failed to move the issue: .... -
issue close
-
success, show close issue: #{issue link}
, reuse issue message template -
not found, 使用 I cannot not find the issue (id) -
already closed, -
success,
issue comment
-
success, show title
, showissue link
and comment content, slack show all content, we keep same -
not found, 使用 I cannot not find the issue (id) -
no permission create node, 使用 You are not allowed to perform the given bot command. -
create node failed, 使用 Failed to create the comment:... -
-
only quick actions, show quick actions results -
-
comments with quick actions, due to upstream limitation, no way to get the quick action result(need modify from upstream), so only show comment content -
-
wrong quick action will be consider as comment text -
-
quick action with wrong argument -
-
one correct and wrong quick action, will ignore wrong action, process correct quick action -
deploy
-
find from environments in project by from
-
find actions from from environment
andto
-
call action.play, generate deployment, return deployment url -
success, -
not found,
run
-
create Chat::Command, pass command
,arguments
andresponse_url
. response_url contains endpoint and corp_id, staff_id -
command will try to create pipeline, use Ci::CreatePipelineService to create CI::Build -
when CI::Build transit to succes/failed/canceled, it will run Ci::BuildFinishedWorker, then run ChatNotificationWorker if build.pipeline is created from chat -
ChatNotificationWorker will find responder for specific build, call responder.success/failure to send out message back -
build specific responder for dingtalk -
success, -
failed => The command could not be scheduled. Please confirm the ".gitlab-ci.yml" file defines a job with the name (command).
log
-
log for dingtalk api -
rescue grape error
message limitation
由 毛超 编辑于