|
@@ -0,0 +1,66 @@
|
|
|
|
|
+package seecoder.devcloud.web.controller.pipeline;
|
|
|
|
|
+
|
|
|
|
|
+import io.swagger.annotations.Api;
|
|
|
|
|
+import io.swagger.annotations.ApiImplicitParam;
|
|
|
|
|
+import io.swagger.annotations.ApiImplicitParams;
|
|
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
|
|
|
+import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
+import seecoder.devcloud.web.model.vo.Response;
|
|
|
|
|
+import seecoder.devcloud.web.model.vo.pipeline.DeploymentInfoVO;
|
|
|
|
|
+import seecoder.devcloud.web.service.pipeline.DeploymentService;
|
|
|
|
|
+
|
|
|
|
|
+import java.util.List;
|
|
|
|
|
+
|
|
|
|
|
+/**
|
|
|
|
|
+ * @author PuHong Weng
|
|
|
|
|
+ * @date 2021/3/12
|
|
|
|
|
+ * @description:
|
|
|
|
|
+ */
|
|
|
|
|
+@RestController("/deployments")
|
|
|
|
|
+@ResponseBody
|
|
|
|
|
+@Api(value = "流水线部署的实例")
|
|
|
|
|
+public class DeploymentController {
|
|
|
|
|
+
|
|
|
|
|
+ private final DeploymentService deploymentService;
|
|
|
|
|
+
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ public DeploymentController(DeploymentService deploymentService) {
|
|
|
|
|
+ this.deploymentService = deploymentService;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @ApiOperation(value = "获取项目所有部署的实例信息", httpMethod = "GET")
|
|
|
|
|
+ @ApiImplicitParam(name = "projectId", dataType = "int")
|
|
|
|
|
+ public Response<List<DeploymentInfoVO>> retrieveDeploymentInfos(@RequestParam("projectId")Integer projectId){
|
|
|
|
|
+ return Response.buildSuccess(deploymentService.retrieveDeploymentInfos(projectId));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ @ApiOperation(value = "执行流水线构建实例", httpMethod = "POST")
|
|
|
|
|
+ @ApiImplicitParams({
|
|
|
|
|
+ @ApiImplicitParam(name = "projectId", dataType = "int"),
|
|
|
|
|
+ @ApiImplicitParam(name = "pipelineId", dataType = "int")
|
|
|
|
|
+ })
|
|
|
|
|
+ public Response deploy(@RequestParam("projectId")Integer projectId,
|
|
|
|
|
+ @RequestParam("pipelineId")Integer pipelineId){
|
|
|
|
|
+ deploymentService.deploy(projectId,pipelineId);
|
|
|
|
|
+ return Response.buildSuccess();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 执行一条pipepine
|
|
|
|
|
+ * todo 异步/异步异常捕获刷新result
|
|
|
|
|
+ */
|
|
|
|
|
+ @ApiOperation(value = "删除一个实例", httpMethod = "DELETE")
|
|
|
|
|
+ @ApiImplicitParams({
|
|
|
|
|
+ @ApiImplicitParam(name = "projectId", dataType = "int"),
|
|
|
|
|
+ @ApiImplicitParam(name = "pipelineId", dataType = "int")
|
|
|
|
|
+ })
|
|
|
|
|
+ public Response delete(@RequestParam("projectId")Integer projectId,
|
|
|
|
|
+ @RequestParam("pipelineId")Integer pipelineId){
|
|
|
|
|
+ deploymentService.deploy(projectId,pipelineId);
|
|
|
|
|
+ return Response.buildSuccess();
|
|
|
|
|
+ }
|
|
|
|
|
+}
|