|
|
@@ -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
|
|
|
+ }
|
|
|
+}
|