Showing
6 changed files
with
199 additions
and
64 deletions
@@ -440,4 +440,5 @@ public class HttpUriContants { | @@ -440,4 +440,5 @@ public class HttpUriContants { | ||
440 | public static final String GET_DOCERK_INFO_BY_ID = "/dockerProject/getDockerInfoById"; | 440 | public static final String GET_DOCERK_INFO_BY_ID = "/dockerProject/getDockerInfoById"; |
441 | public static final String DEL_DOCKER_INFO_BYID = "/dockerProject/delDockerInfoById"; | 441 | public static final String DEL_DOCKER_INFO_BYID = "/dockerProject/delDockerInfoById"; |
442 | public static final String DOCKER_DEPLOY_ROLLBACK_BY_IMAGE="/dockerProject/deployByImageStore"; | 442 | public static final String DOCKER_DEPLOY_ROLLBACK_BY_IMAGE="/dockerProject/deployByImageStore"; |
443 | + public static final String DOCKER_DEPLOY_JENKINS_DEPLOY="/dockerProject/jenkinsDeploy"; | ||
443 | } | 444 | } |
@@ -28,6 +28,7 @@ public class ProjectEnvironment { | @@ -28,6 +28,7 @@ public class ProjectEnvironment { | ||
28 | dockerProjectTypeMap.put("ci","核心系统ci"); | 28 | dockerProjectTypeMap.put("ci","核心系统ci"); |
29 | dockerProjectTypeMap.put("ops","ops"); | 29 | dockerProjectTypeMap.put("ops","ops"); |
30 | dockerProjectTypeMap.put("erp","erp"); | 30 | dockerProjectTypeMap.put("erp","erp"); |
31 | + dockerProjectTypeMap.put("jenkins-deploy","jenkins-deploy"); | ||
31 | 32 | ||
32 | projectDeployTypeMap.put("git","git分支"); | 33 | projectDeployTypeMap.put("git","git分支"); |
33 | projectDeployTypeMap.put("image","镜像文件"); | 34 | projectDeployTypeMap.put("image","镜像文件"); |
@@ -45,11 +46,27 @@ public class ProjectEnvironment { | @@ -45,11 +46,27 @@ public class ProjectEnvironment { | ||
45 | 46 | ||
46 | 47 | ||
47 | public static List<String> getDockerEnvironments(String projectName){ | 48 | public static List<String> getDockerEnvironments(String projectName){ |
48 | - if(projectName!=null&&projectName.contains("yoho-shop-manage")){ | 49 | + if(projectName!=null&&projectName.contains("yohobuywap-node")){ |
49 | //该项目没有灰度 | 50 | //该项目没有灰度 |
50 | - return Arrays.asList("yoho-online"); | 51 | + return dockerEnvironments; |
51 | } | 52 | } |
52 | - return dockerEnvironments; | 53 | + if(projectName!=null&&projectName.contains("yohobuy-node")){ |
54 | + //该项目没有灰度 | ||
55 | + return dockerEnvironments; | ||
56 | + } | ||
57 | + if(projectName!=null&&projectName.contains("ufo-app-web")){ | ||
58 | + //该项目没有灰度 | ||
59 | + return dockerEnvironments; | ||
60 | + } | ||
61 | + if(projectName!=null&&projectName.contains("yoho-app-web")){ | ||
62 | + //该项目没有灰度 | ||
63 | + return dockerEnvironments; | ||
64 | + } | ||
65 | + if(projectName!=null&&projectName.contains("ultrainBlockApi")){ | ||
66 | + //该项目没有灰度 | ||
67 | + return dockerEnvironments; | ||
68 | + } | ||
69 | + return Arrays.asList("yoho-online"); | ||
53 | } | 70 | } |
54 | 71 | ||
55 | public static Map<String,String> getDockerProjectTypeMap(){ | 72 | public static Map<String,String> getDockerProjectTypeMap(){ |
@@ -151,6 +151,38 @@ public class DockerBuildCtrl { | @@ -151,6 +151,38 @@ public class DockerBuildCtrl { | ||
151 | return new ModelAndView("project/docker_build"); | 151 | return new ModelAndView("project/docker_build"); |
152 | } | 152 | } |
153 | 153 | ||
154 | + | ||
155 | + | ||
156 | + @RequestMapping("/toBuildViewNew") | ||
157 | + public ModelAndView toBuildViewNew(Model model,String project_id,String environment_name, String image_file_name, | ||
158 | + String branch_name,String workid_name, String buildId, HttpSession session) { | ||
159 | + List<Map<String,String>> buildInfoList=new ArrayList<>(); | ||
160 | + Map mapIds = new HashMap<>(); | ||
161 | + mapIds.put("ids",project_id); | ||
162 | + BaseResponse response=httpRestClient.defaultGet("/dockerProject/getDockerProjectMapByIds", BaseResponse.class, mapIds); | ||
163 | + Map projectMap=JSON.parseObject((String)response.getData(),Map.class); | ||
164 | + Map map=new HashMap(); | ||
165 | + map.put("projectId",project_id); | ||
166 | + map.put("buildId",buildId); | ||
167 | + map.put("projectInfo",projectMap.get(Integer.parseInt(project_id))); | ||
168 | + buildInfoList.add(map); | ||
169 | + | ||
170 | + model.addAttribute("environment_name", environment_name); | ||
171 | + model.addAttribute("clusters_name",""); | ||
172 | + model.addAttribute("clusters_text", ""); | ||
173 | + model.addAttribute("operate_name", "DEPLOY"); | ||
174 | + model.addAttribute("branch_name", branch_name); | ||
175 | + model.addAttribute("project_deploy_type", ""); | ||
176 | + model.addAttribute("image_file_name", image_file_name); | ||
177 | + model.addAttribute("workid_name", workid_name); | ||
178 | + model.addAttribute("rollbackfile_name", ""); | ||
179 | + model.addAttribute("buildIds", buildId); | ||
180 | + model.addAttribute("failMsg", ""); | ||
181 | + model.addAttribute("buildInfoList",JSONArray.toJSON(buildInfoList)); | ||
182 | + return new ModelAndView("project/docker_build"); | ||
183 | + } | ||
184 | + | ||
185 | + | ||
154 | /** | 186 | /** |
155 | * 把node项目的az2区域切换到gray | 187 | * 把node项目的az2区域切换到gray |
156 | * @env 发布环境 ,拦截器记录操作日志用 | 188 | * @env 发布环境 ,拦截器记录操作日志用 |
@@ -276,6 +308,26 @@ public class DockerBuildCtrl { | @@ -276,6 +308,26 @@ public class DockerBuildCtrl { | ||
276 | * | 308 | * |
277 | * @return | 309 | * @return |
278 | */ | 310 | */ |
311 | + @RequestMapping(value = "/jenkinsDeploy") | ||
312 | + @ResponseBody | ||
313 | + public BaseResponse jenkinsDeploy(String project_id,String workid_name, | ||
314 | + String environment_name,String image_file_name,String branch_name) { | ||
315 | + Map<String, String> map = new HashMap<>(); | ||
316 | + map.put("projectId", project_id); | ||
317 | + map.put("environment", environment_name); | ||
318 | + map.put("rollbackImageStore", image_file_name); | ||
319 | + map.put("branchName", branch_name); | ||
320 | + map.put("workId", workid_name); | ||
321 | + return httpRestClient.defaultGet(HttpUriContants.DOCKER_DEPLOY_JENKINS_DEPLOY, BaseResponse.class, map); | ||
322 | + } | ||
323 | + | ||
324 | + | ||
325 | + | ||
326 | + /** | ||
327 | + * deploy项目 | ||
328 | + * | ||
329 | + * @return | ||
330 | + */ | ||
279 | @RequestMapping(value = "/mirrorAndDeploy") | 331 | @RequestMapping(value = "/mirrorAndDeploy") |
280 | @ResponseBody | 332 | @ResponseBody |
281 | public BaseResponse mirrorAndDeploy(String project_id, String project_name, | 333 | public BaseResponse mirrorAndDeploy(String project_id, String project_name, |
@@ -311,7 +363,7 @@ public class DockerBuildCtrl { | @@ -311,7 +363,7 @@ public class DockerBuildCtrl { | ||
311 | dockerJenkinsReq.setBranch(branch_name); | 363 | dockerJenkinsReq.setBranch(branch_name); |
312 | dockerJenkinsReq.setReleaseWorkId(workid_name); | 364 | dockerJenkinsReq.setReleaseWorkId(workid_name); |
313 | if("deploy".equalsIgnoreCase(operate_name)){ | 365 | if("deploy".equalsIgnoreCase(operate_name)){ |
314 | - return httpRestClient.defaultPost("/dockerProject/mirrorAndDeploy",dockerJenkinsReq,BaseResponse.class); | 366 | + return httpRestClient.defaultPost("/dockerProject/mirrorAndDeploy",dockerJenkinsReq,BaseResponse.class); |
315 | } | 367 | } |
316 | BaseResponse rtnBaseResponse=new BaseResponse(201); | 368 | BaseResponse rtnBaseResponse=new BaseResponse(201); |
317 | rtnBaseResponse.setMessage("暂不支持的操作:"+operate_name); | 369 | rtnBaseResponse.setMessage("暂不支持的操作:"+operate_name); |
@@ -151,7 +151,7 @@ public class OuterIntfCtrl { | @@ -151,7 +151,7 @@ public class OuterIntfCtrl { | ||
151 | public BaseResponse updateJenkinsStatus(String ticketID,String jobID,String status) { | 151 | public BaseResponse updateJenkinsStatus(String ticketID,String jobID,String status) { |
152 | Map<String,String> map=new HashMap<>(); | 152 | Map<String,String> map=new HashMap<>(); |
153 | map.put("ticketID",ticketID); | 153 | map.put("ticketID",ticketID); |
154 | - map.put("jobID",jobID); | 154 | + map.put("jobID",jobID.replace(",","/")); |
155 | map.put("status",status); | 155 | map.put("status",status); |
156 | return httpClient.defaultGet("/dockerProject/updateJenkinsStatus",BaseResponse.class,map); | 156 | return httpClient.defaultGet("/dockerProject/updateJenkinsStatus",BaseResponse.class,map); |
157 | } | 157 | } |
@@ -159,7 +159,7 @@ | @@ -159,7 +159,7 @@ | ||
159 | <c:forEach items="${buildInfoList }" var="buildInfo"> | 159 | <c:forEach items="${buildInfoList }" var="buildInfo"> |
160 | <div style="float: left;height: 600px;"> | 160 | <div style="float: left;height: 600px;"> |
161 | <hr> | 161 | <hr> |
162 | - <div>当前项目:<input type="text" id="currentProject_${buildInfo.projectId}" value="${buildInfo.projectName}" readonly="readonly"> | 162 | + <div>当前项目:<input type="text" id="currentProject_${buildInfo.projectId}" value="${buildInfo.projectInfo.projectName}" readonly="readonly"> |
163 | </div> | 163 | </div> |
164 | <%--<div style="height: 50px" class="alert alert-warning" id="task-info-div_${dockerProject.id}"> | 164 | <%--<div style="height: 50px" class="alert alert-warning" id="task-info-div_${dockerProject.id}"> |
165 | </div>--%> | 165 | </div>--%> |
@@ -184,51 +184,72 @@ | @@ -184,51 +184,72 @@ | ||
184 | <script> | 184 | <script> |
185 | var buildInfoList = '${buildInfoList}'; | 185 | var buildInfoList = '${buildInfoList}'; |
186 | 186 | ||
187 | + <%--$(function () {--%> | ||
188 | + <%--console.log("project_deploy_type is "+"${project_deploy_type}");--%> | ||
189 | + <%--if("${operate_name}".toUpperCase()=="DEPLOY"&&"git"=="${project_deploy_type}"){--%> | ||
190 | + <%--if(buildInfoList!=null&&buildInfoList.length>0){--%> | ||
191 | + <%--var buildInfoListJson=JSON.parse(buildInfoList);--%> | ||
192 | + <%--//docek发布--%> | ||
193 | + <%--for(var i=0;i<buildInfoListJson.length;i++){--%> | ||
194 | + <%--buildDocker(buildInfoListJson[i]);--%> | ||
195 | + <%--}--%> | ||
196 | + <%--}--%> | ||
197 | + <%--}else{--%> | ||
198 | + <%--//回滚或者镜像发布--%> | ||
199 | + <%--if(buildInfoList!=null&&buildInfoList.length>0){--%> | ||
200 | + <%--var buildInfoListJson=JSON.parse(buildInfoList);--%> | ||
201 | + <%--//docek回滚--%> | ||
202 | + <%--for(var i=0;i<buildInfoListJson.length;i++){--%> | ||
203 | + <%--rollbackDocker(buildInfoListJson[i]);--%> | ||
204 | + <%--}--%> | ||
205 | + <%--}--%> | ||
206 | + <%--}--%> | ||
207 | + <%--});--%> | ||
208 | + | ||
187 | $(function () { | 209 | $(function () { |
188 | console.log("project_deploy_type is "+"${project_deploy_type}"); | 210 | console.log("project_deploy_type is "+"${project_deploy_type}"); |
189 | - if("${operate_name}".toUpperCase()=="DEPLOY"&&"git"=="${project_deploy_type}"){ | ||
190 | - if(buildInfoList!=null&&buildInfoList.length>0){ | ||
191 | - var buildInfoListJson=JSON.parse(buildInfoList); | ||
192 | - //docek发布 | ||
193 | - for(var i=0;i<buildInfoListJson.length;i++){ | ||
194 | - buildDocker(buildInfoListJson[i]); | ||
195 | - } | ||
196 | - } | ||
197 | - }else{ | ||
198 | - //回滚或者镜像发布 | ||
199 | - if(buildInfoList!=null&&buildInfoList.length>0){ | ||
200 | - var buildInfoListJson=JSON.parse(buildInfoList); | ||
201 | - //docek回滚 | ||
202 | - for(var i=0;i<buildInfoListJson.length;i++){ | ||
203 | - rollbackDocker(buildInfoListJson[i]); | ||
204 | - } | 211 | + if(buildInfoList!=null&&buildInfoList.length>0){ |
212 | + var buildInfoListJson=JSON.parse(buildInfoList); | ||
213 | + //docek回滚 | ||
214 | + for(var i=0;i<buildInfoListJson.length;i++){ | ||
215 | + jenkinsSearchDocker(buildInfoListJson[i]); | ||
205 | } | 216 | } |
206 | } | 217 | } |
207 | }); | 218 | }); |
208 | 219 | ||
209 | - function rollbackDocker(buildInfo){ | 220 | + function jenkinsSearchDocker(buildInfo){ |
210 | var textareaId=buildInfo.projectId; | 221 | var textareaId=buildInfo.projectId; |
211 | - writeToText(textareaId,"开始查询腾讯云发布结果,请等待.........."); | ||
212 | - //开始查询腾讯云deploy状态,延迟60秒再开始查询 | 222 | + writeToText(textareaId,"开始查询是否完成.........."); |
213 | setTimeout(function(){ | 223 | setTimeout(function(){ |
214 | - builderDocker_queryServiceStatus(buildInfo,textareaId); | 224 | + builderDocker_queryJenkinsStatus(buildInfo,textareaId); |
215 | }, 30000); | 225 | }, 30000); |
216 | } | 226 | } |
217 | 227 | ||
218 | 228 | ||
229 | + | ||
230 | + | ||
231 | +// function rollbackDocker(buildInfo){ | ||
232 | +// var textareaId=buildInfo.projectId; | ||
233 | +// writeToText(textareaId,"开始查询腾讯云发布结果,请等待.........."); | ||
234 | +// //开始查询腾讯云deploy状态,延迟60秒再开始查询 | ||
235 | +// setTimeout(function(){ | ||
236 | +// builderDocker_queryServiceStatus(buildInfo,textareaId); | ||
237 | +// }, 30000); | ||
238 | +// } | ||
239 | + | ||
240 | + | ||
219 | function buildDocker(buildInfo){ | 241 | function buildDocker(buildInfo){ |
220 | //镜像的制作状态 | 242 | //镜像的制作状态 |
221 | console.log(buildInfo); | 243 | console.log(buildInfo); |
222 | var textareaId=buildInfo.projectId; | 244 | var textareaId=buildInfo.projectId; |
223 | - builderDocker_queryJenkinsStatus(buildInfo,textareaId); | 245 | +// builderDocker_queryJenkinsStatus(buildInfo,textareaId); |
224 | 246 | ||
225 | } | 247 | } |
226 | 248 | ||
227 | function builderDocker_queryJenkinsStatus(buildInfo,textareaId) { | 249 | function builderDocker_queryJenkinsStatus(buildInfo,textareaId) { |
228 | var buildId=buildInfo.buildId; | 250 | var buildId=buildInfo.buildId; |
229 | var url = contextPath + 'dockerBuild/queryJenkinsStatus'; | 251 | var url = contextPath + 'dockerBuild/queryJenkinsStatus'; |
230 | - writeToText(textareaId,"镜像制作信息:"+buildId); | ||
231 | - writeToText(textareaId,"开始查询镜像制作是否完成.........."); | 252 | + writeToText(textareaId,"开始查询jenkins任务完成情况:"+buildId); |
232 | var count = 0; | 253 | var count = 0; |
233 | var errorTimes = 0; | 254 | var errorTimes = 0; |
234 | var intervalIndex = setInterval(function() { | 255 | var intervalIndex = setInterval(function() { |
@@ -245,26 +266,26 @@ | @@ -245,26 +266,26 @@ | ||
245 | errorTimes++; | 266 | errorTimes++; |
246 | if(errorTimes>5){ | 267 | if(errorTimes>5){ |
247 | clearInterval(intervalIndex); | 268 | clearInterval(intervalIndex); |
248 | - writeToText(textareaId,"发生错误data is null or data code !=200,查询镜像制作程序终止.........."); | 269 | + writeToText(textareaId,"发生错误data is null or data code !=200,查询jenkins程序终止.........."); |
249 | writeToText(textareaId,"data is "+data); | 270 | writeToText(textareaId,"data is "+data); |
250 | responseError(data); | 271 | responseError(data); |
251 | }else{ | 272 | }else{ |
252 | - writeToText(textareaId,"发生错误data is null or data code !=200,继续获取数据,请耐心等待, errorTimes =."+errorTimes); | 273 | + writeToText(textareaId,"发生错误data is null or data code !=200,查询jenkins程序终止, errorTimes =."+errorTimes); |
253 | writeToText(textareaId,"data is "+data); | 274 | writeToText(textareaId,"data is "+data); |
254 | } | 275 | } |
255 | }else{ | 276 | }else{ |
256 | if("SUCCESS"==data.data){ | 277 | if("SUCCESS"==data.data){ |
257 | clearInterval(intervalIndex); | 278 | clearInterval(intervalIndex); |
258 | - writeToText(textareaId,"镜像制作完成.........."); | ||
259 | - writeToText(textareaId,"开始查询腾讯云发布结果,请等待.........."); | 279 | + writeToText(textareaId,"jenkins发布完成且成功.........."); |
280 | + writeToText(textareaId,"构建的jenkinsJOB为:http://jenkins.yohops.com/job/"+data.message); | ||
260 | //开始查询腾讯云deploy状态,延迟60秒再开始查询 | 281 | //开始查询腾讯云deploy状态,延迟60秒再开始查询 |
261 | - setTimeout(function(){ | ||
262 | - builderDocker_queryServiceStatus(buildInfo,textareaId); | ||
263 | - }, 30000); | 282 | +// setTimeout(function(){ |
283 | +// builderDocker_queryServiceStatus(buildInfo,textareaId); | ||
284 | +// }, 30000); | ||
264 | }else if("FAILURE"==data.data){ | 285 | }else if("FAILURE"==data.data){ |
265 | clearInterval(intervalIndex); | 286 | clearInterval(intervalIndex); |
266 | - writeToText(textareaId,"镜像制作失败........."); | ||
267 | - writeToText(textareaId,"终止"); | 287 | + writeToText(textareaId,"jenkins发布完成但失败,失败原因麻烦查看如下的jenkins_job"); |
288 | + writeToText(textareaId,"构建的jenkinsJOB为:http://jenkins.yohops.com/job/"+data.message); | ||
268 | }else{ | 289 | }else{ |
269 | writeToText(textareaId,"............查询次数............"+count); | 290 | writeToText(textareaId,"............查询次数............"+count); |
270 | } | 291 | } |
@@ -645,28 +645,40 @@ | @@ -645,28 +645,40 @@ | ||
645 | 645 | ||
646 | //打开提交的确认界面 | 646 | //打开提交的确认界面 |
647 | function comfirmSubmit() { | 647 | function comfirmSubmit() { |
648 | + //判断是否为jenkins-deploy,若是则直接部署 | ||
649 | +// var projectTypes =$("input[name='projectTypes']:checked").val() | ||
650 | +// if("jenkins-deploy"==projectTypes){ | ||
651 | +// var param_jenkins={}; | ||
652 | +// param_jenkins.project_id=$('input[name="project1"]:checked').val(); | ||
653 | +// param_jenkins.environment_name=$("input[name='environments']:checked").val(); | ||
654 | +// param_jenkins.image_file_name=$("#imagesList").val(); | ||
655 | +// useJenkinsDeploy(param_jenkins); | ||
656 | +// return; | ||
657 | +// } | ||
658 | + | ||
648 | var operate = $("input[name='operate']:checked").val(); | 659 | var operate = $("input[name='operate']:checked").val(); |
649 | var environment = $("input[name='environments']:checked").val(); | 660 | var environment = $("input[name='environments']:checked").val(); |
650 | var projectDeployType = $("#projectDeployType").val(); | 661 | var projectDeployType = $("#projectDeployType").val(); |
651 | - //获取集群 | 662 | + //获取集群,基本上从后台读取了 |
652 | var clustersName=new Array(); | 663 | var clustersName=new Array(); |
653 | var clustersText=new Array(); | 664 | var clustersText=new Array(); |
654 | - if("yoho-online"==environment){ | ||
655 | - $('input[name="dockerOnlineClusterId"]:checked').each(function () { | ||
656 | - clustersName.push($(this).val());//向数组中添加元素 | ||
657 | - clustersText.push($(this).next().text()); | ||
658 | - }); | ||
659 | - }else{ | ||
660 | - $('input[name="dockerGrayClusterId"]:checked').each(function () { | ||
661 | - clustersName.push($(this).val());//向数组中添加元素 | ||
662 | - clustersText.push($(this).next().text()); | ||
663 | - }); | ||
664 | - } | ||
665 | - | ||
666 | - if (clustersName.length == 0) { | ||
667 | - alert("请选择发布集群"); | 665 | + if (""==environment) { |
666 | + alert("请选择发布环境"); | ||
668 | return; | 667 | return; |
669 | } | 668 | } |
669 | + | ||
670 | +// if("yoho-online"==environment){ | ||
671 | +// $('input[name="dockerOnlineClusterId"]:checked').each(function () { | ||
672 | +// clustersName.push($(this).val());//向数组中添加元素 | ||
673 | +// clustersText.push($(this).next().text()); | ||
674 | +// }); | ||
675 | +// }else{ | ||
676 | +// $('input[name="dockerGrayClusterId"]:checked').each(function () { | ||
677 | +// clustersName.push($(this).val());//向数组中添加元素 | ||
678 | +// clustersText.push($(this).next().text()); | ||
679 | +// }); | ||
680 | +// } | ||
681 | + | ||
670 | var projects = new Array(); | 682 | var projects = new Array(); |
671 | var projectNames = new Array(); | 683 | var projectNames = new Array(); |
672 | if ("Deploy" == operate) {//发布 | 684 | if ("Deploy" == operate) {//发布 |
@@ -685,8 +697,8 @@ | @@ -685,8 +697,8 @@ | ||
685 | 697 | ||
686 | var branch = $("input[name='branch']").val(); | 698 | var branch = $("input[name='branch']").val(); |
687 | var imageFile=$("#imagesList").val(); | 699 | var imageFile=$("#imagesList").val(); |
688 | - var uploadCDN = $("#uploadCDN").val(); | ||
689 | - var cdnBranch = $("#cdnBranch").val(); | 700 | +// var uploadCDN = $("#uploadCDN").val(); |
701 | +// var cdnBranch = $("#cdnBranch").val(); | ||
690 | if(projectDeployType=="image"){ | 702 | if(projectDeployType=="image"){ |
691 | $("#comfirm_deploy_content_div_image").show(); | 703 | $("#comfirm_deploy_content_div_image").show(); |
692 | branch=""; | 704 | branch=""; |
@@ -694,12 +706,12 @@ | @@ -694,12 +706,12 @@ | ||
694 | alert("请填写镜像文件"); | 706 | alert("请填写镜像文件"); |
695 | return; | 707 | return; |
696 | } | 708 | } |
697 | - if(uploadCDN==1){ | ||
698 | - if(!cdnBranch){ | ||
699 | - alert("请填写上传CDN分支"); | ||
700 | - return; | ||
701 | - } | ||
702 | - } | 709 | +// if(uploadCDN==1){ |
710 | +// if(!cdnBranch){ | ||
711 | +// alert("请填写上传CDN分支"); | ||
712 | +// return; | ||
713 | +// } | ||
714 | +// } | ||
703 | }else if(projectDeployType=="git"){ | 715 | }else if(projectDeployType=="git"){ |
704 | $("#comfirm_deploy_content_div_git").show(); | 716 | $("#comfirm_deploy_content_div_git").show(); |
705 | if (!branch) { | 717 | if (!branch) { |
@@ -764,12 +776,43 @@ | @@ -764,12 +776,43 @@ | ||
764 | function deployOrRollback() { | 776 | function deployOrRollback() { |
765 | var operate = $("input[name='operate']:checked").val(); | 777 | var operate = $("input[name='operate']:checked").val(); |
766 | if ("Deploy" == operate) {//发布 | 778 | if ("Deploy" == operate) {//发布 |
767 | - beginDeploy(); | 779 | +// beginDeploy(); |
780 | + useJenkinsDeploy(); | ||
768 | }else { | 781 | }else { |
769 | rollback(); | 782 | rollback(); |
770 | } | 783 | } |
771 | } | 784 | } |
772 | 785 | ||
786 | + function useJenkinsDeploy() { | ||
787 | + var param={}; | ||
788 | + param.project_id=$("input[name='project_id']").val(); | ||
789 | + param.environment_name=$("input[name='environment_name']").val(); | ||
790 | + param.image_file_name=$("input[name='image_file_name']").val(); | ||
791 | + param.branch_name=$("input[name='branch_name']").val(); | ||
792 | + param.workid_name=$("input[name='workid_name']").val(); | ||
793 | + | ||
794 | +// param.operate_name=$("input[name='operate_name']").val(); | ||
795 | +// param.project_name=$("input[name='project_name']").val(); | ||
796 | +// param.project_deploy_type=$("input[name='project_deploy_type']").val(); | ||
797 | +// param.workid_name=$("input[name='workid_name']").val(); | ||
798 | +// param.clusters_name=$("input[name='clusters_name']").val(); | ||
799 | +// param.clusters_text=$("input[name='clusters_text']").val(); | ||
800 | + $.ajax({ | ||
801 | + url: contextPath + "dockerBuild/jenkinsDeploy", | ||
802 | + type: "post", | ||
803 | + dataType: "json", | ||
804 | + data: param , | ||
805 | + success: function (response) { | ||
806 | + if(response!=null&&(response.code==200)){ | ||
807 | + param.buildId=response.data; | ||
808 | + GobalStandardPost( contextPath+ "dockerBuild/toBuildViewNew",param); | ||
809 | + }else{ | ||
810 | + mirrorFail(response.message); | ||
811 | + } | ||
812 | + } | ||
813 | + }); | ||
814 | + } | ||
815 | + | ||
773 | function rollback(){ | 816 | function rollback(){ |
774 | $("#confirmBtn").attr("disabled","disabled"); | 817 | $("#confirmBtn").attr("disabled","disabled"); |
775 | $("#cancelBtn").attr("disabled","disabled"); | 818 | $("#cancelBtn").attr("disabled","disabled"); |
@@ -790,6 +833,7 @@ | @@ -790,6 +833,7 @@ | ||
790 | data: param , | 833 | data: param , |
791 | success: function (response) { | 834 | success: function (response) { |
792 | if(response!=null&&(response.code==200)){ | 835 | if(response!=null&&(response.code==200)){ |
836 | + param.buildIds=response.data; | ||
793 | GobalStandardPost( contextPath+ "dockerBuild/toBuildView",param); | 837 | GobalStandardPost( contextPath+ "dockerBuild/toBuildView",param); |
794 | }else{ | 838 | }else{ |
795 | //失败 | 839 | //失败 |
@@ -860,8 +904,8 @@ | @@ -860,8 +904,8 @@ | ||
860 | param.workid_name=$("input[name='workid_name']").val(); | 904 | param.workid_name=$("input[name='workid_name']").val(); |
861 | param.clusters_name=$("input[name='clusters_name']").val(); | 905 | param.clusters_name=$("input[name='clusters_name']").val(); |
862 | param.clusters_text=$("input[name='clusters_text']").val(); | 906 | param.clusters_text=$("input[name='clusters_text']").val(); |
863 | - param.uploadCDN = $("#uploadCDN").val(); | ||
864 | - param.cdnBranch = $("#cdnBranch").val(); | 907 | +// param.uploadCDN = $("#uploadCDN").val(); |
908 | +// param.cdnBranch = $("#cdnBranch").val(); | ||
865 | console.log(param); | 909 | console.log(param); |
866 | //三个node项目发布灰度环境时,自动启用灰度,发布online环境时,自动关闭灰度 | 910 | //三个node项目发布灰度环境时,自动启用灰度,发布online环境时,自动关闭灰度 |
867 | param.az2AutoSwitchOnlineCheck=""; | 911 | param.az2AutoSwitchOnlineCheck=""; |
-
Please register or login to post a comment