...
|
...
|
@@ -232,6 +232,7 @@ |
|
|
<script src="<%=basePath%>js/select2.min.js"></script>
|
|
|
<script src="<%=basePath%>js/custom.js"></script>
|
|
|
<script src="<%=basePath %>/js/unicorn.js"></script>
|
|
|
<script src="<%=basePath %>js/layer/v311/layer.js" type="text/javascript"></script>
|
|
|
<script src="<%=basePath %>script/common/genarate_left_panel.js?v=<%=ProjectConstant.MENU_VERSION %>"></script>
|
|
|
<script type="text/javascript">
|
|
|
$("#li_project").addClass("active open");
|
...
|
...
|
@@ -580,7 +581,7 @@ |
|
|
function deployOrRollback() {
|
|
|
var operate = $("input[name='operate']:checked").val();
|
|
|
if ("Deploy" == operate) {//发布
|
|
|
mirrorAndDeploy();
|
|
|
beginDeploy();
|
|
|
}else {
|
|
|
rollback();
|
|
|
}
|
...
|
...
|
@@ -624,18 +625,17 @@ |
|
|
|
|
|
}
|
|
|
|
|
|
function mirrorAndDeploy() {
|
|
|
function mirrorAndDeploy(param) {
|
|
|
$("#confirmBtn").attr("disabled","disabled");
|
|
|
$("#cancelBtn").attr("disabled","disabled");
|
|
|
var param={};
|
|
|
param.operate_name=$("input[name='operate_name']").val();
|
|
|
param.project_id=$("input[name='project_id']").val();
|
|
|
param.project_name=$("input[name='project_name']").val();
|
|
|
param.environment_name=$("input[name='environment_name']").val();
|
|
|
param.branch_name=$("input[name='branch_name']").val();
|
|
|
param.workid_name=$("input[name='workid_name']").val();
|
|
|
param.clusters_name=$("input[name='clusters_name']").val();
|
|
|
param.clusters_text=$("input[name='clusters_text']").val();
|
|
|
|
|
|
var layerMirror=layer.open( {
|
|
|
type:3,
|
|
|
//area: ['800px', '500px'],
|
|
|
content:"镜像制作中",
|
|
|
time: 0 //不自动关闭
|
|
|
});
|
|
|
|
|
|
$.ajax({
|
|
|
url: contextPath + "dockerBuild/mirrorAndDeploy",
|
|
|
type: "post",
|
...
|
...
|
@@ -648,6 +648,7 @@ |
|
|
param.failMsg=response.message;
|
|
|
GobalStandardPost( contextPath+ "dockerBuild/toBuildView",param);
|
|
|
}else{
|
|
|
layer.close(layerMirror);
|
|
|
//失败
|
|
|
if(response==null){
|
|
|
mirrorFail("制作镜像失败!");
|
...
|
...
|
@@ -658,11 +659,90 @@ |
|
|
}
|
|
|
},
|
|
|
error: function (e) {
|
|
|
layer.close(layerMirror);
|
|
|
mirrorFail(e);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
function beginDeploy(){
|
|
|
var param={};
|
|
|
param.operate_name=$("input[name='operate_name']").val();
|
|
|
param.project_id=$("input[name='project_id']").val();
|
|
|
param.project_name=$("input[name='project_name']").val();
|
|
|
param.environment_name=$("input[name='environment_name']").val();
|
|
|
param.branch_name=$("input[name='branch_name']").val();
|
|
|
param.workid_name=$("input[name='workid_name']").val();
|
|
|
param.clusters_name=$("input[name='clusters_name']").val();
|
|
|
param.clusters_text=$("input[name='clusters_text']").val();
|
|
|
//三个node项目发布灰度环境时,如果发master分支,自动加到online,如果非master分支,自动断开
|
|
|
param.az2AutoSwitchOnlineCheck="";
|
|
|
|
|
|
if(param.environment_name.indexOf("gray")>0 &&
|
|
|
("yohoblk-wap"==param.project_name||"yohobuywap-node"==param.project_name||"yohobuy-node"==param.project_name)){
|
|
|
$('#confirmSubmitDivId').modal('hide');
|
|
|
var dialog = $("<div>").appendTo($("body"));
|
|
|
var alertContent="发布开始前会自动启用az2-"+param.project_name+"灰度环境,确定发布?";
|
|
|
if("master"==param.branch_name){
|
|
|
alertContent="发布成功后会自动关闭az2-"+param.project_name+"灰度环境,确定发布?";
|
|
|
param.az2AutoSwitchOnlineCheck="az2AutoSwitchOnlineCheck";
|
|
|
}
|
|
|
dialog.dialog({
|
|
|
title: "你确定执行发布吗",
|
|
|
backdrop: "static",
|
|
|
content: alertContent,
|
|
|
buttons: [{
|
|
|
text: "否",
|
|
|
className: "btn-danger",
|
|
|
onclick: function () {
|
|
|
dialog.dialog("hide");
|
|
|
$('#confirmSubmitDivId').modal('show');
|
|
|
}
|
|
|
}, {
|
|
|
text: "是",
|
|
|
className: "btn-success",
|
|
|
onclick: function () {
|
|
|
dialog.dialog("hide");
|
|
|
|
|
|
var layerSwitch=layer.open( {
|
|
|
type:3,
|
|
|
//area: ['800px', '500px'],
|
|
|
content:" 切换中",
|
|
|
time: 0 //不自动关闭
|
|
|
});
|
|
|
|
|
|
$.ajax({
|
|
|
type: "post",
|
|
|
url: contextPath+"/dockerBuild/switchDcokerNodeAz2",
|
|
|
data: {
|
|
|
project_name: param.project_name,
|
|
|
onlineOrGray:"gray"
|
|
|
},
|
|
|
dataType: "json",
|
|
|
success: function(resp){
|
|
|
layer.close(layerSwitch);
|
|
|
if(resp.code==200){
|
|
|
mirrorAndDeploy(param);
|
|
|
}else{
|
|
|
localAlert("错误","az2切换灰度环境失败:"+resp.message);
|
|
|
}
|
|
|
},
|
|
|
error: function(){
|
|
|
layer.close(layerSwitch);
|
|
|
localAlert("错误","az2切换灰度环境异常");
|
|
|
|
|
|
}
|
|
|
});
|
|
|
|
|
|
}
|
|
|
}]
|
|
|
});
|
|
|
}else{
|
|
|
mirrorAndDeploy(param);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
function mirrorFail(msg) {
|
|
|
console.log(msg);
|
|
|
$("#confirmBtn").removeAttr("disabled");
|
...
|
...
|
|