Authored by qinchao

docker发布pch5优化

... ... @@ -124,22 +124,48 @@ public class DockerBuildCtrl {
/**
* 把node项目的az2区域切换到gray
*
* @env 发布环境 ,拦截器记录操作日志用
* @branch 分支 ,拦截器记录操作日志用
* @return
*/
@RequestMapping(value = "/switchDockerNodeAz2")
@ResponseBody
public BaseResponse switchDockerNodeAz2(String project_name,String onlineOrGray) {
public BaseResponse switchDockerNodeAz2(String project_name,String onlineOrGray,String env,String branch) {
if(!"online".equals(onlineOrGray)&&!"gray".equals(onlineOrGray)){
return new BaseResponse(201,"不支持参数onlineOrGray:"+onlineOrGray);
}
String projectType;
String inGrayKey;
if("yohoblk-wap".equals(project_name)){
projectType="blk";
inGrayKey="inGray_blk";
}else if("yohobuywap-node".equals(project_name)){
projectType="wap";
inGrayKey="inGray_wap";
}else if("yohobuy-node".equals(project_name)){
projectType="pc";
inGrayKey="inGray_pc";
}else{
return new BaseResponse(201,"不支持参数:"+project_name);
}
BaseResponse queryStatusResponse=httpRestClient.defaultGet("/pch5DockerSwitch/getDockerElbStatus", BaseResponse.class);
if(queryStatusResponse!=null&&queryStatusResponse.getCode()==200){
Map<String,Object> resultMap=(Map<String,Object>)queryStatusResponse.getData();
if(resultMap.containsKey(inGrayKey)){
boolean inGray=(Boolean)resultMap.get(inGrayKey);
if("gray".equals(onlineOrGray)&&inGray){
//目标是切换到灰度,当前已经是灰度了,所以直接返回
return new BaseResponse();
}
if("online".equals(onlineOrGray)&&inGray==false){
//目标是切换到online,当前已经关闭灰度了,所以直接返回
return new BaseResponse();
}
}
}
Map map = new HashMap<>();
map.put("projectType",projectType);
map.put("onlineOrGray",onlineOrGray);
... ...
... ... @@ -334,6 +334,8 @@
type: "post",
url: contextPath+"/dockerBuild/switchDockerNodeAz2",
data: {
env:$("#environment_name").val(),
branch:$("#branch_name").val(),
project_name: $("#az2AutoSwitchOnlineCheck_project").val(),
onlineOrGray:"online"
},
... ...
... ... @@ -685,7 +685,7 @@
var dialog = $("<div>").appendTo($("body"));
var alertContent="发布开始前会自动启用az2-"+param.project_name+"灰度环境,确定发布?";
if("master"==param.branch_name){
alertContent="发布成功后会自动关闭az2-"+param.project_name+"灰度环境,确定发布?";
//alertContent="发布成功后会自动关闭az2-"+param.project_name+"灰度环境,确定发布?";
param.az2AutoSwitchOnlineCheck="az2AutoSwitchOnlineCheck";
mirrorAndDeploy(param);
}else{
... ... @@ -717,6 +717,8 @@
type: "post",
url: contextPath+"/dockerBuild/switchDockerNodeAz2",
data: {
env:param.environment_name,
branch:param.branch_name,
project_name: param.project_name,
onlineOrGray:"gray"
},
... ...