pull 代码异常记录tpiIDD

This commit is contained in:
jiangzhongxiang 2019-05-21 15:09:27 +08:00
parent 5a532e7b93
commit e81b80c287
1 changed files with 14 additions and 14 deletions

View File

@ -87,8 +87,8 @@ public class GameService {
try {
FileUtils.forceMkdir(file);
} catch (IOException e) {
logger.error("克隆失败,创建版本库所在工作目录失败{}", e);
throw new GameException("克隆失败,创建版本库所在工作目录失败:" + e);
logger.error("克隆失败,创建版本库所在工作目录" + tpiWorkSpace + "失败", e);
throw new GameException("克隆失败,创建版本库所在工作目录失败:" + e.getMessage());
}
}
@ -108,7 +108,7 @@ public class GameService {
3);
if (result.getInteger("exitStatus") != 0) {
logger.error("克隆失败e: {}", result);
logger.error("tpmGitURL:{} 克隆失败e: {}", tpmGitURL, result);
throw new GameException("克隆失败,版本库地址:" + tpmGitURL);
}
@ -135,7 +135,7 @@ public class GameService {
// pull 操作之前如果tpi本地版本库不存在则克隆主机名为origin
int isRepoExist = ShellUtil.executeAndGetExitStatus("ls " + tpiRepoPath).getInteger("exitStatus");
if (isRepoExist != 0) {
logger.warn("版本库不存在,先克隆! tpiGitURL: {}", tpiGitURL);
logger.warn("版本库不存在,先克隆! tpiGitURL: {}, tpiID: {}", tpiGitURL, tpiID);
gitClone(path, tpiGitURL, "origin", tpiRepoName);
}
@ -144,18 +144,18 @@ public class GameService {
.executeAndGetExitStatus("cd " + tpiRepoPath + " && git remote | grep ^origin$");
if (remoteExist.getInteger("exitStatus") != 0) {
if (remoteExist.getString("out").contains("fatal")) {
logger.warn("版本库不完整先进行init操作");
logger.warn("版本库不完整先进行init操作, tpiID: {}, tpiGitURL {}", tpiID, tpiGitURL);
ShellUtil.execute("cd " + tpiRepoPath + " && git init");
}
logger.warn("origin主机名不存在先添加主机名及其git地址remoteName: {}, tpiGitURL: {}", "origin", tpiGitURL);
logger.warn("origin主机名不存在先添加主机名及其git地址remoteName: {}, tpiGitURL: {}, tpiID: {}", "origin", tpiGitURL, tpiID);
JSONObject addRemote = ShellUtil
.executeAndGetExitStatus("cd " + tpiRepoPath + " && git remote add origin " + tpiGitURL, 3);
if (addRemote.getInteger("exitStatus") != 0) {
logger.error("origin主机名不存在,添加主机名失败");
throw new GameException("origin主机名不存在无法完成pull操作");
logger.error("origin主机名不存在,添加主机名失败, tpiGitURL: {}, tpiID: {}", tpiGitURL, tpiID);
throw new GameException("origin主机名不存在无法完成pull操作,tpiID:" + tpiID);
} else {
logger.debug("origin主机名不存在,添加主机名成功");
logger.debug("origin主机名不存在,添加主机名成功, tpiGitURL: {}, tpiID: {}", tpiGitURL, tpiID);
}
}
@ -170,8 +170,8 @@ public class GameService {
logger.debug("##----> gitpull 结束,总耗时间为:" + (currentPullEnd - currentPullStart));
if (result.getInteger("exitStatus") != 0) {
logger.info("pullCommand: {}", pullCommand);
logger.info("output: {}", result.getString("out"));
logger.info("pullCommand: {}, tpiID: {}", pullCommand, tpiID);
logger.info("output: {}, tpiID: {}", result.getString("out"), tpiID);
// 如果pull失败先check一下看是不是远端版本库HEAD丢失如果是进行修复
check(tpiID, tpiGitURL);
@ -179,7 +179,7 @@ public class GameService {
// 重新clone
gitClone(path, tpiGitURL, "origin", tpiRepoName);
logger.debug("gitPull冲突重新clone结束");
logger.debug("gitPull冲突重新clone结束, tpiGitURL: {}, tpiID: {}", tpiGitURL, tpiID);
} else {
// 判段是否成功拉取到更新
@ -195,9 +195,9 @@ public class GameService {
}
if (rePullTimes == 0) {
logger.error("版本库有更新2s之内拉取版本库更新失败");
logger.error("版本库有更新2s之内拉取版本库更新失败, tpiGitURL: {}, tpiID: {}", tpiGitURL, tpiID);
} else {
logger.debug("pull成功");
logger.debug("pull成功, tpiGitURL: {}, tpiID: {}", tpiGitURL, tpiID);
}
}