|
|
@@ -3,11 +3,14 @@ package cn.reghao.autodop.dmaster.app.controller;
|
|
|
import cn.reghao.autodop.dmaster.app.entity.log.BuildDeployLog;
|
|
|
import cn.reghao.autodop.dmaster.app.entity.log.BuildLog;
|
|
|
import cn.reghao.autodop.dmaster.app.entity.log.DeployLog;
|
|
|
+import cn.reghao.autodop.dmaster.app.entity.orchestration.AppOrchestration;
|
|
|
import cn.reghao.autodop.dmaster.app.service.AppBuildService;
|
|
|
import cn.reghao.autodop.dmaster.app.service.tools.updater.CommitLog;
|
|
|
import cn.reghao.autodop.dmaster.app.vo.AppToBuild;
|
|
|
import cn.reghao.autodop.dmaster.app.vo.PageList;
|
|
|
import cn.reghao.autodop.dmaster.app.vo.log.BuildLogVO;
|
|
|
+import cn.reghao.autodop.dmaster.app.vo.log.CommitLogVO;
|
|
|
+import cn.reghao.autodop.dmaster.app.vo.log.DeployLogVO;
|
|
|
import cn.reghao.autodop.dmaster.app.vo.result.BuildResult;
|
|
|
import cn.reghao.autodop.dmaster.app.service.OssService;
|
|
|
import cn.reghao.autodop.dmaster.app.service.build.BuildDispatcher;
|
|
|
@@ -36,7 +39,7 @@ import java.util.stream.Collectors;
|
|
|
@Slf4j
|
|
|
@Api(tags = "应用构建部署接口")
|
|
|
@RestController
|
|
|
-@RequestMapping("/api/app")
|
|
|
+@RequestMapping("/api/app/bd")
|
|
|
public class AppBuildController {
|
|
|
private AppBuildService buildService;
|
|
|
private BuildDispatcher buildDispatcher;
|
|
|
@@ -51,11 +54,11 @@ public class AppBuildController {
|
|
|
// TODO 添加一个 from 参数来表示构建部署请求来自何处,是主动构建还是自动构建
|
|
|
@ApiOperation(value = "构建部署应用")
|
|
|
@ApiImplicitParams(
|
|
|
- @ApiImplicitParam(name="appId", value="一个或多个应用(多个应用间使用 , 分隔)",
|
|
|
- paramType="path", dataType = "String")
|
|
|
+ @ApiImplicitParam(name="appId", value="应用标识(多个应用间使用 , 分隔)",
|
|
|
+ paramType="query", dataType = "String")
|
|
|
)
|
|
|
- @PostMapping("/pipeline/{appId}")
|
|
|
- public String buildAndDeploy(@PathVariable("appId") String appId) throws Exception {
|
|
|
+ @PostMapping("/pipeline")
|
|
|
+ public String buildAndDeploy(@RequestParam("appId") String appId) throws Exception {
|
|
|
Set<String> apps = checkArgs(appId);
|
|
|
List<BuildDeployLog> buildDeployLogs;
|
|
|
if (apps.size() == 0) {
|
|
|
@@ -72,11 +75,11 @@ public class AppBuildController {
|
|
|
|
|
|
@ApiOperation(value = "构建应用")
|
|
|
@ApiImplicitParams(
|
|
|
- @ApiImplicitParam(name="appId", value="一个或多个应用(多个应用间使用 , 分隔)",
|
|
|
- paramType="path", dataType = "String")
|
|
|
+ @ApiImplicitParam(name="appId", value="应用标识(多个应用间使用 , 分隔)",
|
|
|
+ paramType="query", dataType = "String")
|
|
|
)
|
|
|
- @PostMapping("/build/{appId}")
|
|
|
- public String build(@PathVariable("appId") String appId) throws Exception {
|
|
|
+ @PostMapping("/build")
|
|
|
+ public String build(@RequestParam("appId") String appId) throws Exception {
|
|
|
Set<String> apps = checkArgs(appId);
|
|
|
List<BuildDeployLog> buildDeployLogs;
|
|
|
if (apps.size() == 0) {
|
|
|
@@ -104,8 +107,7 @@ public class AppBuildController {
|
|
|
|
|
|
@ApiOperation(value = "部署 OSS 资源")
|
|
|
@ApiImplicitParams(
|
|
|
- @ApiImplicitParam(name="appId", value="一个或多个应用(多个应用间使用 , 分隔)",
|
|
|
- paramType="path", dataType = "String")
|
|
|
+ @ApiImplicitParam(name="appId", value="应用标识", paramType="query", dataType = "String")
|
|
|
)
|
|
|
@PostMapping("/deploy/oss/{appId}")
|
|
|
public String deployOss(@PathVariable("appId") String appId) throws SVNException {
|
|
|
@@ -127,7 +129,7 @@ public class AppBuildController {
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "待构建的应用列表")
|
|
|
- @GetMapping("/build/list")
|
|
|
+ @GetMapping("/list")
|
|
|
public ResponseEntity<String> buildList(/*@RequestParam("env") String env
|
|
|
@RequestParam("page") int page, @RequestParam("size") int size*/) {
|
|
|
//PageRequest pageRequest = PageRequest.of(page-1, size);
|
|
|
@@ -141,23 +143,35 @@ public class AppBuildController {
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "")
|
|
|
- @GetMapping("/build/commitlog")
|
|
|
+ @GetMapping("/logs/commit")
|
|
|
public ResponseEntity<String> commitLog() {
|
|
|
- List<CommitLog> res = buildService.commitLogs();
|
|
|
- return ResponseEntity.ok().body(WebResult.success(res));
|
|
|
+ List<CommitLogVO> res = buildService.commitLogs();
|
|
|
+ PageList<CommitLogVO> logs = new PageList<>();
|
|
|
+ logs.setList(res);
|
|
|
+ logs.setSize(res.size());
|
|
|
+
|
|
|
+ return ResponseEntity.ok().body(WebResult.success(logs));
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "")
|
|
|
- @GetMapping("/build/buildlog")
|
|
|
+ @GetMapping("/logs/build")
|
|
|
public ResponseEntity<String> buildLog() {
|
|
|
List<BuildLogVO> res = buildService.buildLogs();
|
|
|
- return ResponseEntity.ok().body(WebResult.success(res));
|
|
|
+ PageList<BuildLogVO> logs = new PageList<>();
|
|
|
+ logs.setList(res);
|
|
|
+ logs.setSize(res.size());
|
|
|
+
|
|
|
+ return ResponseEntity.ok().body(WebResult.success(logs));
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "")
|
|
|
- @GetMapping("/deploy/deploylog")
|
|
|
+ @GetMapping("/logs/deploy")
|
|
|
public ResponseEntity<String> deployLog() {
|
|
|
- List<DeployLog> res = buildService.deployLogs();
|
|
|
- return ResponseEntity.ok().body(WebResult.success(res));
|
|
|
+ List<DeployLogVO> res = buildService.deployLogs();
|
|
|
+ PageList<DeployLogVO> logs = new PageList<>();
|
|
|
+ logs.setList(res);
|
|
|
+ logs.setSize(res.size());
|
|
|
+
|
|
|
+ return ResponseEntity.ok().body(WebResult.success(logs));
|
|
|
}
|
|
|
}
|