new_educoder_dev需要git权限
This commit is contained in:
parent
dd403ecc32
commit
761aa5a630
|
@ -62,6 +62,12 @@ public class AppConfig {
|
|||
|
||||
@Value("${gpuImage}")
|
||||
private String gpuImage;
|
||||
|
||||
@Value("${gitUsername}")
|
||||
private String gitUsername;
|
||||
|
||||
@Value("${gitPassword}")
|
||||
private String gitPassword;
|
||||
|
||||
@Value("${vncPort}")
|
||||
private Integer vncPort;
|
||||
|
@ -154,6 +160,22 @@ public class AppConfig {
|
|||
this.gpuImage = gpuImage;
|
||||
}
|
||||
|
||||
public String getGitUsername() {
|
||||
return gitUsername;
|
||||
}
|
||||
|
||||
public void setGitUsername(String gitUsername) {
|
||||
this.gitUsername = gitUsername;
|
||||
}
|
||||
|
||||
public String getGitPassword() {
|
||||
return gitPassword;
|
||||
}
|
||||
|
||||
public void setGitPassword(String gitPassword) {
|
||||
this.gitPassword = gitPassword;
|
||||
}
|
||||
|
||||
public Integer getVncPort() {
|
||||
return vncPort;
|
||||
}
|
||||
|
|
|
@ -248,10 +248,10 @@ public class GameHelper {
|
|||
public static String getTooManyTimesResult(int caseSize, int maxTimes) {
|
||||
String hint = "输出消息次数超限,最多输出%d次";
|
||||
hint = String.format(hint, maxTimes);
|
||||
|
||||
|
||||
return getResult(hint, caseSize, null, null);
|
||||
}
|
||||
|
||||
|
||||
public static String getResult(String hint, int caseSize, String downloadStatus, String createPodStatus) {
|
||||
hint = Base64Util.encode(hint);
|
||||
|
||||
|
@ -354,4 +354,12 @@ public class GameHelper {
|
|||
return timeCost;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取加权限的gitURL: 加上超级用户的用户名密码
|
||||
* 形如:https://edugit:xinedugit@bdgit.educoder.net/educoder/mnf6b7z3.git
|
||||
*/
|
||||
public static String appendGitUrlWithUser(String gitUsername, String gitPassword, String gitUrl) {
|
||||
return new StringBuffer(gitUrl).insert(gitUrl.indexOf("//") + 2, gitUsername + ":" + gitPassword + "@")
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -73,6 +73,7 @@ public class GameController {
|
|||
|
||||
// 对当前TPI,从TPM clone 版本库
|
||||
tpmGitURL = Base64Util.decode(tpmGitURL);
|
||||
tpmGitURL = GameHelper.appendGitUrlWithUser(appConfig.getGitUsername(), appConfig.getGitPassword(), tpmGitURL);
|
||||
gameService.gitClone(tpiWorkSpace, tpmGitURL, "remote_origin", tpiRepoName);
|
||||
|
||||
response.put("code", 0);
|
||||
|
@ -123,6 +124,7 @@ public class GameController {
|
|||
|
||||
// 参数处理
|
||||
tpiGitURL = Base64Util.decode(tpiGitURL);
|
||||
tpiGitURL = GameHelper.appendGitUrlWithUser(appConfig.getGitUsername(), appConfig.getGitPassword(), tpiGitURL);
|
||||
needPortMapping = needPortMapping == null ? 0 : needPortMapping;
|
||||
timeLimit = timeLimit == null ? Integer.parseInt(appConfig.getDefaultTimeLimit()) : timeLimit;
|
||||
testCases = Base64Util.decode(testCases);
|
||||
|
@ -271,7 +273,9 @@ public class GameController {
|
|||
JSONObject response = new JSONObject();
|
||||
|
||||
tpiGitURL = Base64Util.decode(tpiGitURL);
|
||||
tpiGitURL = GameHelper.appendGitUrlWithUser(appConfig.getGitUsername(), appConfig.getGitPassword(), tpiGitURL);
|
||||
tpmGitURL = Base64Util.decode(tpmGitURL);
|
||||
tpmGitURL = GameHelper.appendGitUrlWithUser(appConfig.getGitUsername(), appConfig.getGitPassword(), tpmGitURL);
|
||||
String tpiRepoName = GameHelper.getRepoName(tpiGitURL);
|
||||
String path = appConfig.getWorkspace() + File.separator + "myshixun_" + tpiID;
|
||||
|
||||
|
|
|
@ -60,5 +60,9 @@ secretKey=priEn3UwXfJs3PmyXnSG
|
|||
#GPU \u955c\u50cf
|
||||
gpuImage=ubuntu-nvidia
|
||||
|
||||
#git\u7528\u6237\u540d\u53ca\u5bc6\u7801
|
||||
gitUsername=edugit
|
||||
gitPassword=xinedugit#
|
||||
|
||||
#novnc port
|
||||
vncPort=6901
|
Loading…
Reference in New Issue