1
0
370774330@qq.com 5 лет назад
Родитель
Сommit
6ace2df310

+ 6 - 1
core/src/main/java/seecoder/devcloud/core/pipeline/Context.java

@@ -24,6 +24,8 @@ public class Context {
 
     private String pipelineName;
 
+    private String templateName;
+
 
     /**
      * 流水线所属namespace
@@ -42,5 +44,8 @@ public class Context {
     @Builder.Default
     private Map<String, String> configs = new HashMap<>();
 
-
+    /**
+     * 整个构建流程的记录, 每一个模块的各种运行信息(正常运行的结果,异常信息)都应该写入这里
+     */
+    private String result;
 }

+ 1 - 1
core/src/main/java/seecoder/devcloud/core/pipeline/Handler.java

@@ -11,7 +11,7 @@ public interface Handler {
 
     void invoke(Context context);
 
-    void process(Context context);
+    void process(Context context) throws PipelineException;
 
     void invokeNext(Context context);
 

+ 49 - 0
core/src/main/java/seecoder/devcloud/core/pipeline/template/PipelineTemplateTable.java

@@ -0,0 +1,49 @@
+package seecoder.devcloud.core.pipeline.template;
+
+import seecoder.devcloud.core.pipeline.PipelineException;
+
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+
+/**
+ * @author PuHong Weng
+ * @date 2021/3/16
+ * @description: 记录了pipeline的所有可用模板名
+ */
+public class PipelineTemplateTable {
+
+    private static final String TEMPLATE_DOCKERFILE_PREFIX = "TEMPLATE_DOCKERFILE_";
+    private static final String TEMPLATE_CONFIG_JSON_PREFIX = "TEMPLATE_CONFIG_JSON__";
+
+    private static final HashSet<String> templateNames;
+
+    /**
+     * 需要添加模板类型在这里添加,然后根据需求添加对应的imagename、dockerfile、configjson等
+     * todo
+     */
+    static {
+        templateNames = new HashSet<String>();
+        templateNames.add("JAVA8");
+
+    }
+
+    public static void validateTemplateName(String name) throws PipelineException {
+        if (!templateNames.contains(name)){
+            throw new PipelineException("pipeline模板名不存在");
+        }
+    }
+
+    public static String getTemplateDockerfileName(String templateName){
+        return TEMPLATE_DOCKERFILE_PREFIX + templateName;
+    }
+
+
+    public static String getTemplateConfigJsonName(String templateName){
+        return TEMPLATE_DOCKERFILE_PREFIX + templateName;
+    }
+
+    public static List<String> getTemplateList(){
+        return 
+    }
+}

+ 4 - 13
web/src/main/resources/application-wph.yml

@@ -42,20 +42,11 @@ seecoder:
   git:
     password: mock
     username: mock
-
-  jenkins:
-    host: http://192.168.68.79:8082
-    username: root
-    token: 11d7b9e4c1acac481904c25813e2ec1f0a
   docker:
-    registry: 192.168.68.79:18082
+    host: unix:///var/run/docker.sock
+    registry: 192.168.99.105:30060
+    registryUsername: admin
+    registryPassword: admin
 
 
 
-  registry:
-    host: 192.168.68.79:18082
-    username: admin
-    password: admin123
-    nexus-server: 192.168.68.79:18081
-    repo-name: sec-repo
-    clean-up-task: 83bb8249-71e8-4367-83b3-50c6f7518860