...
|
...
|
@@ -137,12 +137,15 @@ var souProtectedFromCount; |
|
|
var souDesiredCapacity;
|
|
|
var souMinSize;
|
|
|
var souMaxSize;
|
|
|
//需要发布的版本
|
|
|
var souBranch;
|
|
|
//修改伸缩组
|
|
|
function changeServer(scalingGroupId, groupName, protectedFromCount, desiredCapacity, minSize, maxSize){
|
|
|
scalingGroupName = groupName;
|
|
|
souScalingGroupId = scalingGroupId;
|
|
|
souProtectedFromCount = protectedFromCount;
|
|
|
souDesiredCapacity = desiredCapacity;
|
|
|
//souDesiredCapacity = 2;
|
|
|
souMinSize = minSize;
|
|
|
souMaxSize = maxSize;
|
|
|
|
...
|
...
|
@@ -161,6 +164,12 @@ function changeServer(scalingGroupId, groupName, protectedFromCount, desiredCapa |
|
|
}
|
|
|
|
|
|
function changeOk(){
|
|
|
//分支版本
|
|
|
souBranch = $("#branch").val();
|
|
|
if(souBranch == "" || souBranch == undefined){
|
|
|
alert("需要发布的分支版本不能为空");
|
|
|
return;
|
|
|
}
|
|
|
//异常处理
|
|
|
if(souScalingGroupId == "" || souScalingGroupId == undefined
|
|
|
|| souProtectedFromCount == "" || souProtectedFromCount == undefined
|
...
|
...
|
@@ -277,38 +286,24 @@ function refCloudMessage(showMessage, serverCount){ |
|
|
clearInterval(intervalIndex);
|
|
|
}else{
|
|
|
var returnJson = data.data[0];
|
|
|
if(showMessage == "缩容"){
|
|
|
if(returnJson.msg != "success"){
|
|
|
if(count == 0){
|
|
|
writeToText(returnJson.desciption);
|
|
|
}else{
|
|
|
writeToText("......");
|
|
|
}
|
|
|
}else{
|
|
|
writeToText("第 1 步:" + showMessage + " 成功!");
|
|
|
$("#closeButton").removeAttr("disabled");
|
|
|
clearInterval(intervalIndex);
|
|
|
|
|
|
|
|
|
if(returnJson.succInsList == undefined || returnJson.succInsList.length != serverCount){
|
|
|
if(count == 0){
|
|
|
writeToText(returnJson.desciption);
|
|
|
}else{
|
|
|
writeToText("......");
|
|
|
}
|
|
|
}else{
|
|
|
writeToText("第 1 步:" + showMessage + " 成功!");
|
|
|
writeToText("...")
|
|
|
clearInterval(intervalIndex);
|
|
|
if(showMessage == "缩容"){
|
|
|
unDeploy();
|
|
|
writeToText("结束..........");
|
|
|
return;
|
|
|
}
|
|
|
}else{
|
|
|
if(returnJson.succInsList == undefined || returnJson.succInsList.length != 2){
|
|
|
if(count == 0){
|
|
|
writeToText(returnJson.desciption);
|
|
|
}else{
|
|
|
writeToText("......");
|
|
|
}
|
|
|
}else{
|
|
|
writeToText("第 1 步:" + showMessage + " 成功!");
|
|
|
writeToText("...")
|
|
|
clearInterval(intervalIndex);
|
|
|
//扩容成功后执行
|
|
|
deploy(returnJson.succInsList);
|
|
|
writeToText("结束..........");
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -356,8 +351,6 @@ function deploy(instanceIds){ |
|
|
}
|
|
|
writeToText("正在发布系统,请稍后...");
|
|
|
deployProject(ips);
|
|
|
writeToText("第 3 步:系统部署成功!");
|
|
|
deployLaster();
|
|
|
}
|
|
|
|
|
|
//发布成功和失败都执行
|
...
|
...
|
@@ -411,6 +404,64 @@ function getIpByInstanceIds(instanceIds){ |
|
|
|
|
|
//3:根据ip发布项目
|
|
|
function deployProject(ips){
|
|
|
$.ajax({
|
|
|
url: '/autoScalingTool/deployQcloudProject?projectName='+scalingGroupName+'&ips='+ips+'&branch=' + souBranch + '&environment=qcloud',
|
|
|
type: 'POST',
|
|
|
dataType: 'json',
|
|
|
async: false,
|
|
|
success: function (data) {
|
|
|
if (!data || data.code != 200) {
|
|
|
alert(data.message);
|
|
|
}else{
|
|
|
//同步获取消息
|
|
|
deployProjectGetMsg(data.data.setMessageids.split(',')[0]);
|
|
|
}
|
|
|
},
|
|
|
error: function (data) {
|
|
|
writeToText('系统异常!');
|
|
|
deployLaster();
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
//3.1:发布项目的同时获取发布的消息
|
|
|
function deployProjectGetMsg(msgId){
|
|
|
var intervalIndexMsg = setInterval(function() {
|
|
|
$.ajax({
|
|
|
url: 'project/getbuildmsg?messageid=' + msgId+"&project="+scalingGroupName,
|
|
|
type: 'POST',
|
|
|
dataType: 'json',
|
|
|
success: function (data3) {
|
|
|
var obj2 = eval("(" + data3 + ")");
|
|
|
var messagedata = obj2.data;
|
|
|
|
|
|
if ((messagedata.message != "") && (messagedata.message != null) && (messagedata.message != undefined)) {
|
|
|
writeToText(messagedata.message);
|
|
|
}
|
|
|
|
|
|
//code为2 ,则结束
|
|
|
var code = obj2.code;
|
|
|
if (code == 2) {
|
|
|
writeToText("第 3 步:系统部署成功!");
|
|
|
|
|
|
clearInterval(intervalIndexMsg);
|
|
|
//集成测试
|
|
|
deployLaster();
|
|
|
|
|
|
writeToText("结束..........");
|
|
|
}
|
|
|
},
|
|
|
error: function (e) {
|
|
|
alert('系统异常');
|
|
|
clearInterval(intervalIndexMsg);
|
|
|
deployLaster();
|
|
|
}
|
|
|
});
|
|
|
}, 3000);
|
|
|
}
|
|
|
|
|
|
//4:集成测试
|
|
|
function test(){
|
|
|
|
|
|
}
|
|
|
|
...
|
...
|
|