Showing
1 changed file
with
15 additions
and
1 deletions
@@ -6,11 +6,14 @@ import com.model.DockerProjectModel; | @@ -6,11 +6,14 @@ import com.model.DockerProjectModel; | ||
6 | import com.monitor.model.request.DockerJenkinsReq; | 6 | import com.monitor.model.request.DockerJenkinsReq; |
7 | import com.monitor.model.response.BaseResponse; | 7 | import com.monitor.model.response.BaseResponse; |
8 | import com.monitor.mysql.mapper.DockerProjectMapper; | 8 | import com.monitor.mysql.mapper.DockerProjectMapper; |
9 | +import com.monitor.other.maliciousip.ctrl.MaliciousIpController; | ||
9 | import com.monitor.other.worksystem.dock.qq.DockerServerDeployService; | 10 | import com.monitor.other.worksystem.dock.qq.DockerServerDeployService; |
10 | import com.monitor.other.worksystem.model.WebHooksReleaseBO; | 11 | import com.monitor.other.worksystem.model.WebHooksReleaseBO; |
11 | import com.monitor.other.worksystem.service.DockerProjectService; | 12 | import com.monitor.other.worksystem.service.DockerProjectService; |
12 | import com.offbytwo.jenkins.model.JobWithDetails; | 13 | import com.offbytwo.jenkins.model.JobWithDetails; |
13 | import org.apache.commons.lang.StringUtils; | 14 | import org.apache.commons.lang.StringUtils; |
15 | +import org.slf4j.Logger; | ||
16 | +import org.slf4j.LoggerFactory; | ||
14 | import org.springframework.beans.factory.annotation.Autowired; | 17 | import org.springframework.beans.factory.annotation.Autowired; |
15 | import org.springframework.stereotype.Controller; | 18 | import org.springframework.stereotype.Controller; |
16 | import org.springframework.web.bind.annotation.RequestBody; | 19 | import org.springframework.web.bind.annotation.RequestBody; |
@@ -26,6 +29,9 @@ import java.util.concurrent.CompletableFuture; | @@ -26,6 +29,9 @@ import java.util.concurrent.CompletableFuture; | ||
26 | @RequestMapping("/dockerProject") | 29 | @RequestMapping("/dockerProject") |
27 | public class DockerProjectCtrl { | 30 | public class DockerProjectCtrl { |
28 | 31 | ||
32 | + | ||
33 | + Logger log = LoggerFactory.getLogger(DockerProjectCtrl.class); | ||
34 | + | ||
29 | @Autowired | 35 | @Autowired |
30 | private DockerProjectService dockerProjectService; | 36 | private DockerProjectService dockerProjectService; |
31 | 37 | ||
@@ -85,15 +91,19 @@ public class DockerProjectCtrl { | @@ -85,15 +91,19 @@ public class DockerProjectCtrl { | ||
85 | public BaseResponse gitWebHook(@RequestBody WebHooksReleaseBO webHooksReleaseBO) { | 91 | public BaseResponse gitWebHook(@RequestBody WebHooksReleaseBO webHooksReleaseBO) { |
86 | BaseResponse rtn=new BaseResponse<>(); | 92 | BaseResponse rtn=new BaseResponse<>(); |
87 | if (!webHooksReleaseBO.getRef().contains("master")&&StringUtils.isBlank(webHooksReleaseBO.getProjectName())) { | 93 | if (!webHooksReleaseBO.getRef().contains("master")&&StringUtils.isBlank(webHooksReleaseBO.getProjectName())) { |
94 | + log.info("gitWebHook 非master分支或者项目名为空"); | ||
88 | return rtn; | 95 | return rtn; |
89 | } | 96 | } |
90 | - | 97 | + log.info("gitWebHook begin"); |
91 | DockerProjectModel model=dockerProjectMapper.selectByProjectName(webHooksReleaseBO.getProjectName()); | 98 | DockerProjectModel model=dockerProjectMapper.selectByProjectName(webHooksReleaseBO.getProjectName()); |
99 | + log.info("gitWebHook model {} ",model); | ||
92 | if (isRealChange(webHooksReleaseBO)&&model!=null) { | 100 | if (isRealChange(webHooksReleaseBO)&&model!=null) { |
93 | //异步 | 101 | //异步 |
102 | + log.info("gitWebHook isRealChange is true "); | ||
94 | CompletableFuture.runAsync(new Runnable() { | 103 | CompletableFuture.runAsync(new Runnable() { |
95 | @Override | 104 | @Override |
96 | public void run() { | 105 | public void run() { |
106 | + log.info("gitWebHook run "); | ||
97 | //Docker-Deploy-GitHook | 107 | //Docker-Deploy-GitHook |
98 | DockerJenkinsReq dockerJenkinsReq=new DockerJenkinsReq(); | 108 | DockerJenkinsReq dockerJenkinsReq=new DockerJenkinsReq(); |
99 | dockerJenkinsReq.setDeployName(model.getProjectName()); | 109 | dockerJenkinsReq.setDeployName(model.getProjectName()); |
@@ -103,9 +113,13 @@ public class DockerProjectCtrl { | @@ -103,9 +113,13 @@ public class DockerProjectCtrl { | ||
103 | dockerJenkinsReq.setUserMail(webHooksReleaseBO.getUser_email()); | 113 | dockerJenkinsReq.setUserMail(webHooksReleaseBO.getUser_email()); |
104 | dockerJenkinsReq.setImageSource(model.getDockerOnlineImageStore()); | 114 | dockerJenkinsReq.setImageSource(model.getDockerOnlineImageStore()); |
105 | dockerJenkinsReq.setNodeEnv("yoho-online"); | 115 | dockerJenkinsReq.setNodeEnv("yoho-online"); |
116 | + | ||
117 | + log.info("gitWebHook run {} ",dockerJenkinsReq); | ||
106 | dockerProjectService.jenkinsBuild(dockerJenkinsReq); | 118 | dockerProjectService.jenkinsBuild(dockerJenkinsReq); |
107 | } | 119 | } |
108 | }); | 120 | }); |
121 | + }else{ | ||
122 | + log.info("gitWebHook isRealChange is false "); | ||
109 | } | 123 | } |
110 | 124 | ||
111 | return rtn; | 125 | return rtn; |
-
Please register or login to post a comment