Showing
1 changed file
with
8 additions
and
3 deletions
@@ -20,6 +20,7 @@ import org.springframework.web.bind.annotation.ResponseBody; | @@ -20,6 +20,7 @@ import org.springframework.web.bind.annotation.ResponseBody; | ||
20 | import java.util.ArrayList; | 20 | import java.util.ArrayList; |
21 | import java.util.List; | 21 | import java.util.List; |
22 | import java.util.Map; | 22 | import java.util.Map; |
23 | +import java.util.concurrent.CompletableFuture; | ||
23 | 24 | ||
24 | @Controller | 25 | @Controller |
25 | @RequestMapping("/dockerProject") | 26 | @RequestMapping("/dockerProject") |
@@ -84,12 +85,15 @@ public class DockerProjectCtrl { | @@ -84,12 +85,15 @@ public class DockerProjectCtrl { | ||
84 | public BaseResponse gitWebHook(@RequestBody WebHooksReleaseBO webHooksReleaseBO) { | 85 | public BaseResponse gitWebHook(@RequestBody WebHooksReleaseBO webHooksReleaseBO) { |
85 | BaseResponse rtn=new BaseResponse<>(); | 86 | BaseResponse rtn=new BaseResponse<>(); |
86 | if (!webHooksReleaseBO.getRef().contains("master")&&StringUtils.isBlank(webHooksReleaseBO.getProjectName())) { | 87 | if (!webHooksReleaseBO.getRef().contains("master")&&StringUtils.isBlank(webHooksReleaseBO.getProjectName())) { |
87 | - rtn.setData(""); | ||
88 | return rtn; | 88 | return rtn; |
89 | } | 89 | } |
90 | 90 | ||
91 | DockerProjectModel model=dockerProjectMapper.selectByProjectName(webHooksReleaseBO.getProjectName()); | 91 | DockerProjectModel model=dockerProjectMapper.selectByProjectName(webHooksReleaseBO.getProjectName()); |
92 | if (isRealChange(webHooksReleaseBO)&&model!=null) { | 92 | if (isRealChange(webHooksReleaseBO)&&model!=null) { |
93 | + //异步 | ||
94 | + CompletableFuture.runAsync(new Runnable() { | ||
95 | + @Override | ||
96 | + public void run() { | ||
93 | //Docker-Deploy-GitHook | 97 | //Docker-Deploy-GitHook |
94 | DockerJenkinsReq dockerJenkinsReq=new DockerJenkinsReq(); | 98 | DockerJenkinsReq dockerJenkinsReq=new DockerJenkinsReq(); |
95 | dockerJenkinsReq.setDeployName(model.getProjectName()); | 99 | dockerJenkinsReq.setDeployName(model.getProjectName()); |
@@ -99,8 +103,9 @@ public class DockerProjectCtrl { | @@ -99,8 +103,9 @@ public class DockerProjectCtrl { | ||
99 | dockerJenkinsReq.setUserMail(webHooksReleaseBO.getUser_email()); | 103 | dockerJenkinsReq.setUserMail(webHooksReleaseBO.getUser_email()); |
100 | dockerJenkinsReq.setImageSource(model.getDockerOnlineImageStore()); | 104 | dockerJenkinsReq.setImageSource(model.getDockerOnlineImageStore()); |
101 | dockerJenkinsReq.setNodeEnv("yoho-online"); | 105 | dockerJenkinsReq.setNodeEnv("yoho-online"); |
102 | - String id=dockerProjectService.jenkinsBuild(dockerJenkinsReq); | ||
103 | - rtn.setData(id); | 106 | + dockerProjectService.jenkinsBuild(dockerJenkinsReq); |
107 | + } | ||
108 | + }); | ||
104 | } | 109 | } |
105 | 110 | ||
106 | return rtn; | 111 | return rtn; |
-
Please register or login to post a comment