版本库为空时先从备份版本库检测
This commit is contained in:
parent
ecad6ee293
commit
92c61d2845
|
@ -45,6 +45,9 @@ public class AppConfig {
|
|||
@Value("${gitIP}")
|
||||
private String gitIP;
|
||||
|
||||
@Value("${gitBackUpIP}")
|
||||
private String gitBackUpIP;
|
||||
|
||||
@Value("${outputSize}")
|
||||
private String outputSize;
|
||||
|
||||
|
@ -105,6 +108,10 @@ public class AppConfig {
|
|||
return gitIP;
|
||||
}
|
||||
|
||||
public String getGitBackUpIP() {
|
||||
return gitBackUpIP;
|
||||
}
|
||||
|
||||
public String getDockerMaster() {
|
||||
return dockerMaster;
|
||||
}
|
||||
|
|
|
@ -719,10 +719,19 @@ public class GameService {
|
|||
JSONObject result = ShellUtil.executeAndGetExitStatus(command);
|
||||
// 255是连接失败,如果连接成功wc -l总是执行的,对于前面文件夹为空或者不存在的情况,$?总是0,输出结果总是0
|
||||
if ((result.getInteger("exitStatus") == 0 && result.getString("out").equals("0"))) {
|
||||
logger.error("check方法,远程TPI版本库为空,tpiID: {}", tpiID);
|
||||
response.put("code", -2);
|
||||
response.put("msg", "finished");
|
||||
return response;
|
||||
// 如果版本库为空,考虑是迁移到了备份机上
|
||||
// ssh -p1122 git@10.9.54.50 "mv /home/git/repositories/2018/innov/yvqhfr7a.git/ /home/git/repositories/innov/"
|
||||
String mvCommand = "mv /home/git/repositories/2018/" + identifier + "/" + tpiRepoName + ".git"
|
||||
+ " /home/git/repositories/" + identifier + "/";
|
||||
command = "ssh -p1122 -o StrictHostKeyChecking=no git@" + appConfig.getGitBackUpIP() + " '" + mvCommand + "'";
|
||||
|
||||
// 若迁移不成功,判定版本库不存在错误
|
||||
if (ShellUtil.executeAndGetExitStatus(command).getInteger("exitStatus") != 0) {
|
||||
logger.error("check方法,远程TPI版本库为空,tpiID: {}", tpiID);
|
||||
response.put("code", -2);
|
||||
response.put("msg", "finished");
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
// 第二个步骤,检测远程版本库HEAD是否存在 (.git/refs/heads/master没内容就是HEAD丢失了,git branch
|
||||
|
|
|
@ -46,8 +46,9 @@ registry=10.9.105.90:5000
|
|||
cpuAllocatable=24000
|
||||
memAllocatable=46160
|
||||
|
||||
#IP
|
||||
#git 版本库IP
|
||||
gitIP=10.9.62.218
|
||||
gitBackUpIP=10.9.54.50
|
||||
|
||||
#编译结果最大长度
|
||||
outputSize=65535
|
||||
|
|
|
@ -42,6 +42,7 @@ registry=10.9.105.90:5000
|
|||
|
||||
#IP
|
||||
gitIP=10.9.73.116
|
||||
gitBackUpIP=10.9.73.116
|
||||
|
||||
#编译结果最大长度
|
||||
outputSize=65535
|
||||
|
|
Loading…
Reference in New Issue