Ver código fonte

fix:增加了gitlaburl

xuxiaopang 2 anos atrás
pai
commit
c41c9daf20

+ 2 - 0
api/src/main/java/cn/seecoder/api/ApplicationProperties.java

@@ -30,6 +30,8 @@ public class ApplicationProperties {
 
 	@Data
 	public static class Gitlab {
+		@NotEmpty
+		private String url;
 
 		@NotEmpty
 		private String host;

+ 1 - 1
web/src/main/java/cn/seecoder/web/core/pipeline/handler/JavaImageBuildHandler.java

@@ -69,7 +69,7 @@ public class JavaImageBuildHandler extends AbstractHandler {
             //注:temp文件/目录系统会定时删,实际文件名喂 prefix + 它生成的suffix随机数,所以不会命名冲突
             directory = Files.createTempDirectory("seecoder-devcloud-");
             UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(repoUrl);
-            repoUrl = builder.scheme("http").host(applicationProperties.getGitlab().getHost().replace("http://","")).path(".git/").toUriString();
+            repoUrl = builder.scheme("http").host(applicationProperties.getGitlab().getUrl().replace("http://","")).path(".git/").toUriString();
             Git git = gitApi.clone(repoUrl, directory.toString());
             git.checkout().setCreateBranch(false).setStartPoint("origin/" + branchName).setName("origin/" + branchName).call();
         } catch (Exception e) {

+ 1 - 1
web/src/main/java/cn/seecoder/web/core/pipeline/handler/NodeImageBuildHandler.java

@@ -68,7 +68,7 @@ public class NodeImageBuildHandler extends AbstractHandler{
             //注:temp文件/目录系统会定时删,实际文件名喂 prefix + 它生成的suffix随机数,所以不会命名冲突
             directory = Files.createTempDirectory("seecoder-devcloud-");
             UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(repoUrl);
-            repoUrl = builder.scheme("http").host(applicationProperties.getGitlab().getHost().replace("http://","")).path(".git/").toUriString();
+            repoUrl = builder.scheme("http").host(applicationProperties.getGitlab().getUrl().replace("http://","")).path(".git/").toUriString();
             Git git = gitApi.clone(repoUrl, directory.toString());
             git.checkout().setName(branchName).call();
         } catch (Exception e) {

+ 1 - 1
web/src/main/java/cn/seecoder/web/core/pipeline/handler/SonarJavaImageBuildHandler.java

@@ -67,7 +67,7 @@ public class SonarJavaImageBuildHandler extends AbstractHandler {
         String repoUrl = project.getGitRemoteUrl();
         // convert url for local test
         UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(repoUrl);
-        repoUrl = builder.scheme("http").host(applicationProperties.getGitlab().getHost().replace("http://","")).path(".git/").toUriString();
+        repoUrl = builder.scheme("http").host(applicationProperties.getGitlab().getUrl().replace("http://","")).path(".git/").toUriString();
         BranchVO branch = branchService.getBranchByName(projectId, branchOrHash);
         String commitHash;
         boolean isBranch;