Explorar o código

AppConfig 字段变更
将 codeDirname 修改为 projDirname, 表示项目目录名
将 appDirPath 修改为 appRootPath, 表示应用根目录在项目中的相对路径

reghao %!s(int64=4) %!d(string=hai) anos
pai
achega
b9ac226cb4

+ 2 - 2
dmaster/src/main/java/cn/reghao/autodop/dmaster/app/model/dto/NewApp.java

@@ -25,7 +25,7 @@ public class NewApp implements Serializable {
     @NotBlank(message = "仓库分支不能为空白字符串")
     private String newRepoBranch;
     @NotBlank(message = "应用代码目录名不能为空白字符串")
-    private String newCodeDirname;
+    private String newProjDirname;
     private String newDockerfile;
 
     public AppConfig app(AppConfig from) {
@@ -35,7 +35,7 @@ public class NewApp implements Serializable {
         from.setAppRepo(newAppRepo);
         from.setRepoBranch(newRepoBranch);
         from.setRepoBranch(newRepoBranch);
-        from.setCodeDirname(newCodeDirname);
+        from.setProjDirname(newProjDirname);
         from.setDockerfile(newDockerfile);
 
         from.setId(null);

+ 4 - 3
dmaster/src/main/java/cn/reghao/autodop/dmaster/app/model/po/config/AppConfig.java

@@ -42,9 +42,10 @@ public class AppConfig extends BaseEntity<Integer> implements Cloneable {
 
     // TODO 操作系统类型和版本,CPU 架构
     /* 构建配置 */
-    @NotBlank(message = "代码目录名不能为空白字符串")
-    private String codeDirname;
-    private String appDirPath;
+    @NotBlank(message = "项目目录名不能为空白字符串")
+    private String projDirname;
+    @NotNull
+    private String appRootPath;
     private String execBinName;
     private Integer httpPort;
     private String healthCheck;

+ 6 - 2
dmaster/src/main/java/cn/reghao/autodop/dmaster/app/service/AppBuilder.java

@@ -25,6 +25,8 @@ import lombok.AllArgsConstructor;
 import lombok.Data;
 import lombok.extern.slf4j.Slf4j;
 
+import java.io.File;
+
 /**
  * 应用构建部署,每个应用持有一个对象
  *
@@ -105,7 +107,7 @@ public class AppBuilder {
                 codeCompiler = new ShellCompiler(compilerConfig);
                 break;
             case maven:
-                String appDirPath = app.getCodeDirname() + app.getAppDirPath();
+                String appDirPath = app.getProjDirname() + app.getAppRootPath();
                 codeCompiler = new MavenCompiler(compilerConfig.getHomePath(), app.getEnv(), appDirPath);
                 break;
             case docker:
@@ -173,6 +175,8 @@ public class AppBuilder {
     }
 
     public String pack() throws Exception {
+        String appDirPath = compileDir() + File.separator + app.getAppRootPath();
+
         return codePacker.pack(app.getAppId(), latestCommitInfo.getCommitId(), compileDir());
     }
 
@@ -181,7 +185,7 @@ public class AppBuilder {
     }
 
     private String compileDir() {
-        return appCompileDir + "/" + app.getCodeDirname();
+        return appCompileDir + "/" + app.getProjDirname();
     }
 
     @Data

+ 4 - 4
dmaster/src/main/resources/templates/app/config/app/add.html

@@ -94,22 +94,22 @@
             </tr>
             <tr>
                 <th>
-                    <label class="layui-form-label required">代码目录</label>
+                    <label class="layui-form-label required">项目目录名</label>
                 </th>
                 <td>
                     <div class="layui-form-item">
                         <div class="layui-input-inline">
-                            <input class="layui-input" type="text" name="codeDirname"  placeholder="请输入代码目录" required th:value="${app?.codeDirname}">
+                            <input class="layui-input" type="text" name="projDirname"  placeholder="请输入项目目录名" required th:value="${app?.projDirname}">
                         </div>
                     </div>
                 </td>
                 <th>
-                    <label class="layui-form-label required">应用目录路径</label>
+                    <label class="layui-form-label required">应用目录路径</label>
                 </th>
                 <td>
                     <div class="layui-form-item">
                         <div class="layui-input-inline">
-                            <input class="layui-input" type="text" name="appDirPath"  placeholder="请输入应用目录相对路径" required th:value="${app?.appDirPath}">
+                            <input class="layui-input" type="text" name="appRootPath"  placeholder="请输入应用根目录相对路径(可选)" required th:value="${app?.appRootPath}">
                         </div>
                     </div>
                 </td>

+ 2 - 2
dmaster/src/main/resources/templates/app/config/app/copy.html

@@ -41,9 +41,9 @@
             </div>
         </div>
         <div class="layui-form-item">
-            <label class="layui-form-label required">新应用代码目录名</label>
+            <label class="layui-form-label required">新应用项目目录名</label>
             <div class="layui-input-inline">
-                <input class="layui-input" type="text" name="newCodeDirname" placeholder="请输入新应用代码目录名">
+                <input class="layui-input" type="text" name="newProjDirname" placeholder="请输入新应用代码目录名">
             </div>
         </div>
         <div class="layui-form-item">

+ 4 - 4
dmaster/src/main/resources/templates/app/config/app/detail.html

@@ -27,10 +27,10 @@
                 <td th:text="${app.repoBranch}"></td>
             </tr>
             <tr>
-                <th>代码目录</th>
-                <td th:text="${app.codeDirname}"></td>
-                <th>应用目录路径</th>
-                <td th:text="${app.appDirPath}"></td>
+                <th>项目目录名</th>
+                <td th:text="${app.projDirname}"></td>
+                <th>应用路径</th>
+                <td th:text="${app.appRootPath}"></td>
                 <th>可执行文件名</th>
                 <td th:text="${app.execBinName}"></td>
                 <th>Dockerfile</th>