feat: 构建结果群群机器人通知
This commit is contained in:
24
.drone.yml
24
.drone.yml
@@ -45,7 +45,29 @@ steps:
|
|||||||
path: /app/config
|
path: /app/config
|
||||||
commands:
|
commands:
|
||||||
- kubectl apply -f deployment.yml -n metis --kubeconfig=/app/config/base-taishan-kubectl.yml
|
- kubectl apply -f deployment.yml -n metis --kubeconfig=/app/config/base-taishan-kubectl.yml
|
||||||
|
-
|
||||||
|
- name: notify
|
||||||
|
image: plugins/webhook
|
||||||
|
environment:
|
||||||
|
WEBHOOK_URL:
|
||||||
|
from_secret: wechat_webhook_url
|
||||||
|
settings:
|
||||||
|
urls: https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=f2b3fcbc-e70f-4826-8b08-340518b3a96f
|
||||||
|
content_type: application/json
|
||||||
|
template: |
|
||||||
|
{
|
||||||
|
"msgtype": "markdown",
|
||||||
|
"markdown": {
|
||||||
|
"content": "{{#success build.status}}✅{{else}}❌{{/success}}**{{ repo.owner }}/{{ repo.name }}** (Build #{{build.number}})\n
|
||||||
|
>**构建结果**: {{ build.status }}
|
||||||
|
>**构建详情**: [点击查看]({{ build.link }})
|
||||||
|
>**代码分支**: {{ build.branch }}
|
||||||
|
>**提交标识**: {{ build.commit }}
|
||||||
|
>**提交发起**: {{ build.author }}
|
||||||
|
>**提交信息**: {{ build.message }}
|
||||||
|
"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
- name: config
|
- name: config
|
||||||
|
|||||||
@@ -16,9 +16,9 @@ public class ProcessDefinitionController {
|
|||||||
|
|
||||||
|
|
||||||
@PostMapping("/create")
|
@PostMapping("/create")
|
||||||
public Result<String> create(@RequestBody ProcessBo processBo) {
|
public Result<Long> create(@RequestBody ProcessBo processBo) {
|
||||||
processDefinitionFacade.create(processBo);
|
Long workflowId = processDefinitionFacade.create(processBo);
|
||||||
return Result.ok();
|
return Result.ok(workflowId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PutMapping("/update")
|
@PutMapping("/update")
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.metis.controller;
|
|||||||
import com.metis.flow.domain.bo.BuildApp;
|
import com.metis.flow.domain.bo.BuildApp;
|
||||||
import com.metis.flow.engine.AppFlowEngineRunnerService;
|
import com.metis.flow.engine.AppFlowEngineRunnerService;
|
||||||
import com.metis.flow.runner.FlowRunningContext;
|
import com.metis.flow.runner.FlowRunningContext;
|
||||||
|
import com.metis.flow.runner.RunnerResult;
|
||||||
import com.metis.flow.validator.ValidatorService;
|
import com.metis.flow.validator.ValidatorService;
|
||||||
import com.metis.result.Result;
|
import com.metis.result.Result;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@@ -28,9 +29,9 @@ public class TestController {
|
|||||||
|
|
||||||
|
|
||||||
@PostMapping("/run")
|
@PostMapping("/run")
|
||||||
public Result<String> run(@RequestBody FlowRunningContext context) {
|
public Result<RunnerResult> run(@RequestBody FlowRunningContext context) {
|
||||||
engineRunnerService.running(context);
|
RunnerResult running = engineRunnerService.running(context);
|
||||||
return Result.ok("测试成功");
|
return Result.ok(running);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -21,12 +21,13 @@ public class ProcessDefinitionFacade {
|
|||||||
*
|
*
|
||||||
* @param processBo 过程业务对象
|
* @param processBo 过程业务对象
|
||||||
*/
|
*/
|
||||||
public void create(ProcessBo processBo) {
|
public Long create(ProcessBo processBo) {
|
||||||
CreateApp createApp = CreateApp.builder()
|
CreateApp createApp = CreateApp.builder()
|
||||||
.name(processBo.getName())
|
.name(processBo.getName())
|
||||||
.graph(processBo.getGraph())
|
.graph(processBo.getGraph())
|
||||||
.build();
|
.build();
|
||||||
App app = appEngineService.create(createApp);
|
App app = appEngineService.create(createApp);
|
||||||
|
return app.getWorkflowId();
|
||||||
}
|
}
|
||||||
|
|
||||||
public App getByDeploymentId(Long deploymentId) {
|
public App getByDeploymentId(Long deploymentId) {
|
||||||
|
|||||||
Reference in New Issue
Block a user