...
|
...
|
@@ -159,7 +159,7 @@ |
|
|
<c:forEach items="${buildInfoList }" var="buildInfo">
|
|
|
<div style="float: left;height: 600px;">
|
|
|
<hr>
|
|
|
<div>当前项目:<input type="text" id="currentProject_${buildInfo.projectId}" value="${buildInfo.projectName}" readonly="readonly">
|
|
|
<div>当前项目:<input type="text" id="currentProject_${buildInfo.projectId}" value="${buildInfo.projectInfo.projectName}" readonly="readonly">
|
|
|
</div>
|
|
|
<%--<div style="height: 50px" class="alert alert-warning" id="task-info-div_${dockerProject.id}">
|
|
|
</div>--%>
|
...
|
...
|
@@ -184,51 +184,72 @@ |
|
|
<script>
|
|
|
var buildInfoList = '${buildInfoList}';
|
|
|
|
|
|
<%--$(function () {--%>
|
|
|
<%--console.log("project_deploy_type is "+"${project_deploy_type}");--%>
|
|
|
<%--if("${operate_name}".toUpperCase()=="DEPLOY"&&"git"=="${project_deploy_type}"){--%>
|
|
|
<%--if(buildInfoList!=null&&buildInfoList.length>0){--%>
|
|
|
<%--var buildInfoListJson=JSON.parse(buildInfoList);--%>
|
|
|
<%--//docek发布--%>
|
|
|
<%--for(var i=0;i<buildInfoListJson.length;i++){--%>
|
|
|
<%--buildDocker(buildInfoListJson[i]);--%>
|
|
|
<%--}--%>
|
|
|
<%--}--%>
|
|
|
<%--}else{--%>
|
|
|
<%--//回滚或者镜像发布--%>
|
|
|
<%--if(buildInfoList!=null&&buildInfoList.length>0){--%>
|
|
|
<%--var buildInfoListJson=JSON.parse(buildInfoList);--%>
|
|
|
<%--//docek回滚--%>
|
|
|
<%--for(var i=0;i<buildInfoListJson.length;i++){--%>
|
|
|
<%--rollbackDocker(buildInfoListJson[i]);--%>
|
|
|
<%--}--%>
|
|
|
<%--}--%>
|
|
|
<%--}--%>
|
|
|
<%--});--%>
|
|
|
|
|
|
$(function () {
|
|
|
console.log("project_deploy_type is "+"${project_deploy_type}");
|
|
|
if("${operate_name}".toUpperCase()=="DEPLOY"&&"git"=="${project_deploy_type}"){
|
|
|
if(buildInfoList!=null&&buildInfoList.length>0){
|
|
|
var buildInfoListJson=JSON.parse(buildInfoList);
|
|
|
//docek发布
|
|
|
for(var i=0;i<buildInfoListJson.length;i++){
|
|
|
buildDocker(buildInfoListJson[i]);
|
|
|
}
|
|
|
}
|
|
|
}else{
|
|
|
//回滚或者镜像发布
|
|
|
if(buildInfoList!=null&&buildInfoList.length>0){
|
|
|
var buildInfoListJson=JSON.parse(buildInfoList);
|
|
|
//docek回滚
|
|
|
for(var i=0;i<buildInfoListJson.length;i++){
|
|
|
rollbackDocker(buildInfoListJson[i]);
|
|
|
}
|
|
|
if(buildInfoList!=null&&buildInfoList.length>0){
|
|
|
var buildInfoListJson=JSON.parse(buildInfoList);
|
|
|
//docek回滚
|
|
|
for(var i=0;i<buildInfoListJson.length;i++){
|
|
|
jenkinsSearchDocker(buildInfoListJson[i]);
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
function rollbackDocker(buildInfo){
|
|
|
function jenkinsSearchDocker(buildInfo){
|
|
|
var textareaId=buildInfo.projectId;
|
|
|
writeToText(textareaId,"开始查询腾讯云发布结果,请等待..........");
|
|
|
//开始查询腾讯云deploy状态,延迟60秒再开始查询
|
|
|
writeToText(textareaId,"开始查询是否完成..........");
|
|
|
setTimeout(function(){
|
|
|
builderDocker_queryServiceStatus(buildInfo,textareaId);
|
|
|
builderDocker_queryJenkinsStatus(buildInfo,textareaId);
|
|
|
}, 30000);
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// function rollbackDocker(buildInfo){
|
|
|
// var textareaId=buildInfo.projectId;
|
|
|
// writeToText(textareaId,"开始查询腾讯云发布结果,请等待..........");
|
|
|
// //开始查询腾讯云deploy状态,延迟60秒再开始查询
|
|
|
// setTimeout(function(){
|
|
|
// builderDocker_queryServiceStatus(buildInfo,textareaId);
|
|
|
// }, 30000);
|
|
|
// }
|
|
|
|
|
|
|
|
|
function buildDocker(buildInfo){
|
|
|
//镜像的制作状态
|
|
|
console.log(buildInfo);
|
|
|
var textareaId=buildInfo.projectId;
|
|
|
builderDocker_queryJenkinsStatus(buildInfo,textareaId);
|
|
|
// builderDocker_queryJenkinsStatus(buildInfo,textareaId);
|
|
|
|
|
|
}
|
|
|
|
|
|
function builderDocker_queryJenkinsStatus(buildInfo,textareaId) {
|
|
|
var buildId=buildInfo.buildId;
|
|
|
var url = contextPath + 'dockerBuild/queryJenkinsStatus';
|
|
|
writeToText(textareaId,"镜像制作信息:"+buildId);
|
|
|
writeToText(textareaId,"开始查询镜像制作是否完成..........");
|
|
|
writeToText(textareaId,"开始查询jenkins任务完成情况:"+buildId);
|
|
|
var count = 0;
|
|
|
var errorTimes = 0;
|
|
|
var intervalIndex = setInterval(function() {
|
...
|
...
|
@@ -245,26 +266,26 @@ |
|
|
errorTimes++;
|
|
|
if(errorTimes>5){
|
|
|
clearInterval(intervalIndex);
|
|
|
writeToText(textareaId,"发生错误data is null or data code !=200,查询镜像制作程序终止..........");
|
|
|
writeToText(textareaId,"发生错误data is null or data code !=200,查询jenkins程序终止..........");
|
|
|
writeToText(textareaId,"data is "+data);
|
|
|
responseError(data);
|
|
|
}else{
|
|
|
writeToText(textareaId,"发生错误data is null or data code !=200,继续获取数据,请耐心等待, errorTimes =."+errorTimes);
|
|
|
writeToText(textareaId,"发生错误data is null or data code !=200,查询jenkins程序终止, errorTimes =."+errorTimes);
|
|
|
writeToText(textareaId,"data is "+data);
|
|
|
}
|
|
|
}else{
|
|
|
if("SUCCESS"==data.data){
|
|
|
clearInterval(intervalIndex);
|
|
|
writeToText(textareaId,"镜像制作完成..........");
|
|
|
writeToText(textareaId,"开始查询腾讯云发布结果,请等待..........");
|
|
|
writeToText(textareaId,"jenkins发布完成且成功..........");
|
|
|
writeToText(textareaId,"构建的jenkinsJOB为:http://jenkins.yohops.com/job/"+data.message);
|
|
|
//开始查询腾讯云deploy状态,延迟60秒再开始查询
|
|
|
setTimeout(function(){
|
|
|
builderDocker_queryServiceStatus(buildInfo,textareaId);
|
|
|
}, 30000);
|
|
|
// setTimeout(function(){
|
|
|
// builderDocker_queryServiceStatus(buildInfo,textareaId);
|
|
|
// }, 30000);
|
|
|
}else if("FAILURE"==data.data){
|
|
|
clearInterval(intervalIndex);
|
|
|
writeToText(textareaId,"镜像制作失败.........");
|
|
|
writeToText(textareaId,"终止");
|
|
|
writeToText(textareaId,"jenkins发布完成但失败,失败原因麻烦查看如下的jenkins_job");
|
|
|
writeToText(textareaId,"构建的jenkinsJOB为:http://jenkins.yohops.com/job/"+data.message);
|
|
|
}else{
|
|
|
writeToText(textareaId,"............查询次数............"+count);
|
|
|
}
|
...
|
...
|
|