Authored by qinchao

gitwebhook

... ... @@ -20,6 +20,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
@Controller
@RequestMapping("/dockerProject")
... ... @@ -84,12 +85,15 @@ public class DockerProjectCtrl {
public BaseResponse gitWebHook(@RequestBody WebHooksReleaseBO webHooksReleaseBO) {
BaseResponse rtn=new BaseResponse<>();
if (!webHooksReleaseBO.getRef().contains("master")&&StringUtils.isBlank(webHooksReleaseBO.getProjectName())) {
rtn.setData("");
return rtn;
}
DockerProjectModel model=dockerProjectMapper.selectByProjectName(webHooksReleaseBO.getProjectName());
if (isRealChange(webHooksReleaseBO)&&model!=null) {
//异步
CompletableFuture.runAsync(new Runnable() {
@Override
public void run() {
//Docker-Deploy-GitHook
DockerJenkinsReq dockerJenkinsReq=new DockerJenkinsReq();
dockerJenkinsReq.setDeployName(model.getProjectName());
... ... @@ -99,8 +103,9 @@ public class DockerProjectCtrl {
dockerJenkinsReq.setUserMail(webHooksReleaseBO.getUser_email());
dockerJenkinsReq.setImageSource(model.getDockerOnlineImageStore());
dockerJenkinsReq.setNodeEnv("yoho-online");
String id=dockerProjectService.jenkinsBuild(dockerJenkinsReq);
rtn.setData(id);
dockerProjectService.jenkinsBuild(dockerJenkinsReq);
}
});
}
return rtn;
... ...