Procházet zdrojové kódy

milestone

测试环境版本
reghao před 5 roky
rodič
revize
d660ad338a
18 změnil soubory, kde provedl 193 přidání a 76 odebrání
  1. 2 0
      dmaster/src/main/java/cn/reghao/autodop/dmaster/DmasterApplication.java
  2. 2 1
      dmaster/src/main/java/cn/reghao/autodop/dmaster/app/cache/BuildDeployCache.java
  3. 8 8
      dmaster/src/main/java/cn/reghao/autodop/dmaster/app/controller/BuildDeployController.java
  4. 3 2
      dmaster/src/main/java/cn/reghao/autodop/dmaster/app/controller/crud/OrchestrateCrudController.java
  5. 51 0
      dmaster/src/main/java/cn/reghao/autodop/dmaster/app/interceptor/AppIntegrateReinitInterceptor.java
  6. 1 3
      dmaster/src/main/java/cn/reghao/autodop/dmaster/app/interceptor/MethodTimeInterceptor.java
  7. 17 4
      dmaster/src/main/java/cn/reghao/autodop/dmaster/app/interceptor/WebhookInterceptor.java
  8. 16 10
      dmaster/src/main/java/cn/reghao/autodop/dmaster/app/service/BuildDeployDispatcher.java
  9. 1 1
      dmaster/src/main/java/cn/reghao/autodop/dmaster/app/service/BuildService.java
  10. 28 1
      dmaster/src/main/java/cn/reghao/autodop/dmaster/app/service/crud/BuildDeployAppCrudService.java
  11. 42 1
      dmaster/src/main/java/cn/reghao/autodop/dmaster/app/service/crud/orchestarte/AppCrudService.java
  12. 1 1
      dmaster/src/main/java/cn/reghao/autodop/dmaster/app/service/log/BuildDeployLogService.java
  13. 2 6
      dmaster/src/main/java/cn/reghao/autodop/dmaster/common/config/CachingConfig.java
  14. 1 1
      dmaster/src/main/java/cn/reghao/autodop/dmaster/common/config/WebMvcConfig.java
  15. 6 0
      dmaster/src/main/java/cn/reghao/autodop/dmaster/common/db/CrudOps.java
  16. 0 21
      dmaster/src/main/java/cn/reghao/autodop/dmaster/common/interceptor/WebhookSource.java
  17. 1 5
      dmaster/src/main/resources/application.yml
  18. 11 11
      scripts/test1.json

+ 2 - 0
dmaster/src/main/java/cn/reghao/autodop/dmaster/DmasterApplication.java

@@ -6,10 +6,12 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.autoconfigure.domain.EntityScan;
 import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
 import org.springframework.boot.web.servlet.server.ConfigurableServletWebServerFactory;
+import org.springframework.cache.annotation.EnableCaching;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.ComponentScan;
 import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
 
+//@EnableCaching
 @SpringBootApplication
 @EnableJpaRepositories
 @EntityScan({"cn.reghao.autodop.dmaster", "cn.reghao.autodop.common"})

+ 2 - 1
dmaster/src/main/java/cn/reghao/autodop/dmaster/app/cache/BuildDeployCache.java

@@ -8,6 +8,7 @@ import cn.reghao.autodop.dmaster.app.repository.orchestration.AppOrchestrationRe
 import cn.reghao.autodop.dmaster.app.repository.orchestration.ProjOrchestrationRepository;
 import cn.reghao.autodop.dmaster.cluster.entity.data.MachineInfo;
 import cn.reghao.autodop.dmaster.cluster.repository.MachineInfoRepository;
+import org.springframework.cache.annotation.Cacheable;
 import org.springframework.stereotype.Service;
 
 /**
@@ -33,7 +34,7 @@ public class BuildDeployCache {
         this.buildLogRepository = buildLogRepository;
     }
 
-    // TODO @Cacheable(cacheNames = "app", key = "#appId")
+    @Cacheable(cacheNames = "buildDeployCache", key = "#appId")
     public AppOrchestration findByAppId(String appId) {
         AppOrchestration app = appRepository.findByIsDeleteFalseAndAppId(appId);
         return app;

+ 8 - 8
dmaster/src/main/java/cn/reghao/autodop/dmaster/app/controller/BuildDeployController.java

@@ -41,6 +41,14 @@ public class BuildDeployController {
         this.buildDeployDispatcher = buildDeployDispatcher;
     }
 
+    @ApiOperation(value = "某个环境需要构建部署的应用")
+    @GetMapping("/list")
+    public ResponseEntity<String> buildList(@RequestParam("page") int page, @RequestParam("size") int size,
+                                            @RequestParam("env") String env) {
+        PageList<BuildDeployAppVO> pageList = buildService.buildList(page, size, EnvType.valueOf(env).name());
+        return ResponseEntity.ok().body(WebResult.success(pageList));
+    }
+
     @ApiOperation(value = "构建部署应用")
     @ApiImplicitParams(@ApiImplicitParam(name="appId", value="应用 ID", paramType="query", dataType = "String"))
     @PostMapping("/update")
@@ -68,14 +76,6 @@ public class BuildDeployController {
         return WebResult.success(BuildDeployAppVO.of(buildDeployApp));
     }
 
-    @ApiOperation(value = "某个环境需要构建部署的应用")
-    @GetMapping("/list")
-    public ResponseEntity<String> buildList(@RequestParam("page") int page, @RequestParam("size") int size,
-                                            @RequestParam("env") String env) {
-        PageList<BuildDeployAppVO> pageList = buildService.buildList(page, size, EnvType.valueOf(env).name());
-        return ResponseEntity.ok().body(WebResult.success(pageList));
-    }
-
     @GetMapping("/deployed_app")
     public ResponseEntity<String> deployedApp(@RequestParam("appId") String appId,
                                               @RequestParam("page") int page, @RequestParam("size") int size) {

+ 3 - 2
dmaster/src/main/java/cn/reghao/autodop/dmaster/app/controller/crud/OrchestrateCrudController.java

@@ -70,8 +70,9 @@ public class OrchestrateCrudController {
     @ApiOperation(value = "修改应用编排")
     @PutMapping("/app")
     public ResponseEntity<String> modifyAppOrchestration(@RequestBody String json) throws Exception {
-        AppOrchestration app = (AppOrchestration) JsonConverter.jsonToObject(json, AppOrchestration.class);
-        appCrudService.addOrUpdate(app);
+        AppVO appVO = (AppVO) JsonConverter.jsonToObject(json, AppVO.class);
+        AppOrchestration app = AppVO.to(appVO);
+        appCrudService.update(app);
         return ResponseEntity.ok().body(WebResult.success("ok"));
     }
 

+ 51 - 0
dmaster/src/main/java/cn/reghao/autodop/dmaster/app/interceptor/AppIntegrateReinitInterceptor.java

@@ -0,0 +1,51 @@
+package cn.reghao.autodop.dmaster.app.interceptor;
+
+import cn.reghao.autodop.dmaster.app.entity.config.orchestration.AppOrchestration;
+import lombok.extern.slf4j.Slf4j;
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.aspectj.lang.annotation.Around;
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.Pointcut;
+import org.aspectj.lang.reflect.MethodSignature;
+import org.springframework.stereotype.Component;
+
+import java.util.Set;
+import java.util.concurrent.ConcurrentSkipListSet;
+
+/**
+ * 若 AppOrchestration 发生修改,则重新初始化 AppIntegrate
+ *
+ * @author reghao
+ * @date 2020-03-06 16:04:27
+ */
+@Slf4j
+@Component
+@Aspect
+public class AppIntegrateReinitInterceptor {
+    private Set<String> changedApp = new ConcurrentSkipListSet<>();
+    // 拦截 cn.reghao.autodop.dmaster.app.service.crud.orchestarte 包中的所有方法
+    private final static String POINT = "execution (* cn.reghao.autodop.dmaster.app.service.crud.orchestarte..*.*(..))";
+
+    @Pointcut(POINT)
+    public void reinit(){
+        // TODO 这个方法中可以做些什么?
+    }
+
+    @Around("reinit()")
+    public Object around(ProceedingJoinPoint joinPoint) throws Throwable {
+        MethodSignature signature = (MethodSignature) joinPoint.getSignature();
+        String methodName = signature.getName();
+        Object[] args = joinPoint.getArgs();
+        if ("update".equals(methodName) && args[0] instanceof AppOrchestration) {
+            AppOrchestration app = (AppOrchestration) args[0];
+            String appId = app.getAppId();
+            changedApp.add(appId);
+        }
+
+        return joinPoint.proceed(joinPoint.getArgs());
+    }
+
+    public boolean isAppChanged(String appId) {
+        return changedApp.remove(appId);
+    }
+}

+ 1 - 3
dmaster/src/main/java/cn/reghao/autodop/dmaster/common/interceptor/MethodTimeInterceptor.java → dmaster/src/main/java/cn/reghao/autodop/dmaster/app/interceptor/MethodTimeInterceptor.java

@@ -1,12 +1,10 @@
-package cn.reghao.autodop.dmaster.common.interceptor;
+package cn.reghao.autodop.dmaster.app.interceptor;
 
 import lombok.extern.slf4j.Slf4j;
 import org.aspectj.lang.ProceedingJoinPoint;
 import org.aspectj.lang.annotation.Around;
-import org.aspectj.lang.annotation.Aspect;
 import org.aspectj.lang.annotation.Pointcut;
 import org.aspectj.lang.reflect.MethodSignature;
-import org.springframework.stereotype.Component;
 import org.springframework.util.StopWatch;
 
 /**

+ 17 - 4
dmaster/src/main/java/cn/reghao/autodop/dmaster/common/interceptor/WebhookInterceptor.java → dmaster/src/main/java/cn/reghao/autodop/dmaster/app/interceptor/WebhookInterceptor.java

@@ -1,4 +1,4 @@
-package cn.reghao.autodop.dmaster.common.interceptor;
+package cn.reghao.autodop.dmaster.app.interceptor;
 
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.lang.Nullable;
@@ -17,9 +17,8 @@ import javax.servlet.http.HttpServletResponse;
 @Component
 public class WebhookInterceptor implements HandlerInterceptor {
     @Override
-    public boolean preHandle(HttpServletRequest request,
-                             HttpServletResponse response,
-                             Object handler) throws Exception {
+    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
+            throws Exception {
         String source = request.getParameter("source");
         switch (WebhookSource.valueOf(source)) {
             case codeup:
@@ -55,4 +54,18 @@ public class WebhookInterceptor implements HandlerInterceptor {
                                 Object handler, @Nullable Exception ex) throws Exception {
         log.info("afterCompletion");
     }
+
+    enum WebhookSource {
+        codeup("Codeup"), gogs("Gogs"), git("Git"), svn("SVN");
+
+        private String value;
+
+        WebhookSource(String value) {
+            this.value = value;
+        }
+
+        public String getValue() {
+            return value;
+        }
+    }
 }

+ 16 - 10
dmaster/src/main/java/cn/reghao/autodop/dmaster/app/service/BuildDeployDispatcher.java

@@ -5,6 +5,7 @@ import cn.reghao.autodop.dmaster.app.constant.BuildStage;
 import cn.reghao.autodop.dmaster.app.entity.config.NotifierConfig;
 import cn.reghao.autodop.dmaster.app.entity.deploy.DeployConfig;
 import cn.reghao.autodop.dmaster.app.entity.log.*;
+import cn.reghao.autodop.dmaster.app.interceptor.AppIntegrateReinitInterceptor;
 import cn.reghao.autodop.dmaster.app.service.build.AppIntegrate;
 import cn.reghao.autodop.dmaster.app.service.deploy.AppDeployer;
 import cn.reghao.autodop.dmaster.app.entity.config.orchestration.AppOrchestration;
@@ -30,6 +31,7 @@ import java.util.concurrent.*;
 @Slf4j
 @Service
 public class BuildDeployDispatcher {
+    private AppIntegrateReinitInterceptor reinitInterceptor;
     // TODO 多线程访问的集合
     private Set<String> onBuilding = new ConcurrentSkipListSet<>();
     private Set<String> onDeploying = new ConcurrentSkipListSet<>();
@@ -39,8 +41,9 @@ public class BuildDeployDispatcher {
     private NotifyService notifyService;
     private AppDeployer appDeployer;
 
-    public BuildDeployDispatcher(BuildDeployCache cache, BuildDeployLogConsumer log,
-                                 NotifyService notify, AppDeployer appDeployer) {
+    public BuildDeployDispatcher(AppIntegrateReinitInterceptor reinitInterceptor, BuildDeployCache cache,
+                                 BuildDeployLogConsumer log, NotifyService notify, AppDeployer appDeployer) {
+        this.reinitInterceptor = reinitInterceptor;
         this.cache = cache;
         this.logConsumer = log;
         this.notifyService = notify;
@@ -62,20 +65,23 @@ public class BuildDeployDispatcher {
             return BuildDeployApp.onBuilding(appId);
         }
 
-        // TODO AppOrchestration 修改后需要重新初始化 AppIntegrate,尝试使用 AOP 来完成
         AppIntegrate appIntegrate = integrateMap.get(appId);
-        if (appIntegrate == null) {
+        if (appIntegrate != null) {
+            if (reinitInterceptor.isAppChanged(appId)) {
+                AppOrchestration app = cache.findByAppId(appId);
+                appIntegrate.reInit(app);
+            }
+        } else {
             AppOrchestration app = cache.findByAppId(appId);
-            if (app != null) {
-                appIntegrate = new AppIntegrate(app);
-                integrateMap.put(appId, appIntegrate);
-            } else {
+            if (app == null) {
                 onBuilding.remove(appId);
                 throw new Exception(appId + " 不存在...");
             }
+            appIntegrate = new AppIntegrate(app);
+            integrateMap.put(appId, appIntegrate);
         }
 
-        // TODO 抛出异常时从 onBuilding 中移除当前应用
+        // TODO 抛出异常时从 onBuilding 和 onDeploying 中移除当前应用
         BuildLog buildLog = buildPipeline(appIntegrate);
         logConsumer.addBuildLog(buildLog);
         onBuilding.remove(appId);
@@ -96,7 +102,7 @@ public class BuildDeployDispatcher {
 
     /**
      * 更新 -> 编译 -> 打包 -> 构建流水线
-     * TODO 检测超时
+     * TODO 检测超时,避免阻塞
      *
      * @date 2019-11-07 下午10:14
      */

+ 1 - 1
dmaster/src/main/java/cn/reghao/autodop/dmaster/app/service/BuildService.java

@@ -11,7 +11,7 @@ import cn.reghao.autodop.dmaster.app.repository.log.CommitLogRepository;
 import cn.reghao.autodop.dmaster.app.repository.log.DeployLogRepository;
 import cn.reghao.autodop.dmaster.app.entity.log.CommitLog;
 import cn.reghao.autodop.dmaster.common.db.PageList;
-import cn.reghao.autodop.dmaster.app.service.crud.log.BuildDeployAppCrudService;
+import cn.reghao.autodop.dmaster.app.service.crud.BuildDeployAppCrudService;
 import cn.reghao.autodop.dmaster.app.vo.CurrentRunningCommit;
 import cn.reghao.autodop.dmaster.app.vo.SuccessfullyBuildVO;
 import cn.reghao.autodop.dmaster.app.vo.log.*;

+ 28 - 1
dmaster/src/main/java/cn/reghao/autodop/dmaster/app/service/crud/log/BuildDeployAppCrudService.java → dmaster/src/main/java/cn/reghao/autodop/dmaster/app/service/crud/BuildDeployAppCrudService.java

@@ -1,9 +1,12 @@
-package cn.reghao.autodop.dmaster.app.service.crud.log;
+package cn.reghao.autodop.dmaster.app.service.crud;
 
 import cn.reghao.autodop.dmaster.common.db.CrudOps;
 import cn.reghao.autodop.dmaster.common.db.PageList;
 import cn.reghao.autodop.dmaster.app.entity.log.BuildDeployApp;
 import cn.reghao.autodop.dmaster.app.repository.log.BuildDeployAppRepository;
+import org.springframework.cache.annotation.CacheConfig;
+import org.springframework.cache.annotation.CacheEvict;
+import org.springframework.cache.annotation.CachePut;
 import org.springframework.data.domain.Page;
 import org.springframework.data.domain.PageRequest;
 import org.springframework.data.domain.Sort;
@@ -15,6 +18,7 @@ import java.time.LocalDateTime;
  * @author reghao
  * @date 2021-02-19 16:39:29
  */
+//@CacheConfig(cacheNames = {"buildDeployAppCache"})
 @Service
 public class BuildDeployAppCrudService implements CrudOps<BuildDeployApp> {
     private BuildDeployAppRepository buildDeployAppRepository;
@@ -23,6 +27,29 @@ public class BuildDeployAppCrudService implements CrudOps<BuildDeployApp> {
         this.buildDeployAppRepository = buildDeployAppRepository;
     }
 
+    //@CachePut(cacheNames = { "app" }, key = "#buildDeployApp.appId")
+    @Override
+    public void add(BuildDeployApp buildDeployApp) {
+        BuildDeployApp entity = buildDeployAppRepository.findByAppId(buildDeployApp.getAppId());
+        if (entity == null) {
+            buildDeployApp.setIsDelete(false);
+            buildDeployAppRepository.save(buildDeployApp);
+        }
+    }
+
+    //@CacheEvict(cacheNames = { "app" }, key = "#buildDeployApp.appId")
+    @Override
+    public void update(BuildDeployApp buildDeployApp) {
+        BuildDeployApp entity = buildDeployAppRepository.findByAppId(buildDeployApp.getAppId());
+        if (entity != null) {
+            buildDeployApp.setId(entity.getId());
+            buildDeployApp.setCreateTime(entity.getCreateTime());
+            buildDeployApp.setUpdateTime(LocalDateTime.now());
+            buildDeployApp.setIsDelete(false);
+            buildDeployAppRepository.save(buildDeployApp);
+        }
+    }
+
     @Override
     public void addOrUpdate(BuildDeployApp buildDeployApp) throws Exception {
         BuildDeployApp entity = buildDeployAppRepository.findByAppId(buildDeployApp.getAppId());

+ 42 - 1
dmaster/src/main/java/cn/reghao/autodop/dmaster/app/service/crud/orchestarte/AppCrudService.java

@@ -5,8 +5,11 @@ import cn.reghao.autodop.dmaster.common.db.PageList;
 import cn.reghao.autodop.dmaster.app.entity.log.BuildDeployApp;
 import cn.reghao.autodop.dmaster.app.entity.config.orchestration.AppOrchestration;
 import cn.reghao.autodop.dmaster.app.repository.orchestration.AppOrchestrationRepository;
-import cn.reghao.autodop.dmaster.app.service.crud.log.BuildDeployAppCrudService;
+import cn.reghao.autodop.dmaster.app.service.crud.BuildDeployAppCrudService;
 import cn.reghao.autodop.dmaster.app.service.crud.SharedEntityChecker;
+import org.springframework.cache.annotation.CacheConfig;
+import org.springframework.cache.annotation.CacheEvict;
+import org.springframework.cache.annotation.CachePut;
 import org.springframework.data.domain.Page;
 import org.springframework.data.domain.PageRequest;
 import org.springframework.data.domain.Sort;
@@ -18,6 +21,7 @@ import java.time.LocalDateTime;
  * @author reghao
  * @date 2020-11-10 21:58:00
  */
+//@CacheConfig(cacheNames = {"appCache"})
 @Service
 public class AppCrudService implements CrudOps<AppOrchestration> {
     private AppOrchestrationRepository appRepository;
@@ -32,6 +36,41 @@ public class AppCrudService implements CrudOps<AppOrchestration> {
         this.buildDeployAppCrudService = buildDeployAppCrudService;
     }
 
+    @Override
+    public void add(AppOrchestration app) throws Exception {
+        checkSharedEntity(app);
+        AppOrchestration appEntity = appRepository.findByIsDeleteFalseAndAppId(app.getAppId());
+        if (appEntity == null) {
+            app.setIsDelete(false);
+            appRepository.save(app);
+            buildDeployAppCrudService.add(BuildDeployApp.of(app));
+        }
+    }
+
+    @Override
+    public void update(AppOrchestration app) throws Exception {
+        checkSharedEntity(app);
+        AppOrchestration appEntity = appRepository.findByIsDeleteFalseAndAppId(app.getAppId());
+        if (appEntity != null) {
+            app.setId(appEntity.getId());
+            app.setCreateTime(appEntity.getCreateTime());
+            app.setUpdateTime(LocalDateTime.now());
+            app.setIsDelete(false);
+            appRepository.save(app);
+            buildDeployAppCrudService.update(BuildDeployApp.of(app));
+        }
+    }
+
+    private void checkSharedEntity(AppOrchestration app) throws Exception {
+        if (app.getProj() != null) {
+            sharedEntityChecker.checkAndSetProj(app);
+        } else {
+            sharedEntityChecker.checkAndSetBuildConfig(app.getBuildConfig());
+        }
+        sharedEntityChecker.checkAndSetNotifier(app);
+        sharedEntityChecker.checkAndSetRole(app);
+    }
+
     @Override
     public void addOrUpdate(AppOrchestration app) throws Exception {
         if (app.getProj() != null) {
@@ -90,6 +129,7 @@ public class AppCrudService implements CrudOps<AppOrchestration> {
         app.setUpdateTime(null);
     }
 
+    //@Cacheable("appList")
     @Override
     public PageList<AppOrchestration> getByPage(int page, int size, String env) {
         // 默认按更新时间倒序
@@ -104,6 +144,7 @@ public class AppCrudService implements CrudOps<AppOrchestration> {
         return pageList;
     }
 
+    //@CacheEvict(cacheNames = { "app" }, key = "#uniqueKey")
     @Override
     public void delete(String uniqueKey) throws Exception {
         AppOrchestration appEntity = appRepository.findByIsDeleteFalseAndAppId(uniqueKey);

+ 1 - 1
dmaster/src/main/java/cn/reghao/autodop/dmaster/app/service/log/BuildDeployLogService.java

@@ -5,7 +5,7 @@ import cn.reghao.autodop.dmaster.app.repository.log.BuildLogRepository;
 import cn.reghao.autodop.dmaster.app.repository.log.CommitLogRepository;
 import cn.reghao.autodop.dmaster.app.repository.log.DeployLogRepository;
 import cn.reghao.autodop.dmaster.app.service.crud.log.AppStatusCrudService;
-import cn.reghao.autodop.dmaster.app.service.crud.log.BuildDeployAppCrudService;
+import cn.reghao.autodop.dmaster.app.service.crud.BuildDeployAppCrudService;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;

+ 2 - 6
dmaster/src/main/java/cn/reghao/autodop/dmaster/common/config/CachingConfig.java

@@ -31,12 +31,11 @@ public class CachingConfig {
         //cacheManager.setAllowNullValues(false);
         cacheManager.setCacheNames(cacheNames());
         //cacheManager.setCacheLoader(cacheLoader);
-
         return cacheManager;
     }
 
     /**
-     * TODO 添加缓存的名字
+     * 添加缓存的名字
      *
      * @param
      * @return
@@ -44,10 +43,7 @@ public class CachingConfig {
      */
     private List<String> cacheNames() {
         List<String> names = new ArrayList<>();
-        names.add("app");
-        names.add("proj");
-        names.add("buildDeployApp");
-
+        names.add("buildDeployCache");
         return names;
     }
 }

+ 1 - 1
dmaster/src/main/java/cn/reghao/autodop/dmaster/common/config/WebMvcConfig.java

@@ -1,6 +1,6 @@
 package cn.reghao.autodop.dmaster.common.config;
 
-import cn.reghao.autodop.dmaster.common.interceptor.WebhookInterceptor;
+import cn.reghao.autodop.dmaster.app.interceptor.WebhookInterceptor;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.http.converter.HttpMessageConverter;

+ 6 - 0
dmaster/src/main/java/cn/reghao/autodop/dmaster/common/db/CrudOps.java

@@ -9,6 +9,9 @@ import java.util.List;
  * @date 2020-06-25 01:34:27
  */
 public interface CrudOps<T> {
+    default void add(T t) throws Exception {
+    }
+
     void addOrUpdate(T t) throws Exception;
     default void batchaddOrUpdate(List<T> list) {
     }
@@ -24,6 +27,9 @@ public interface CrudOps<T> {
     default void get(String uniqueKey) {
     }
 
+    default void update(T t) throws Exception {
+    }
+
     void delete(String uniqueKey) throws Exception;
     default void batchDelete(String[] uniqueKeys) {
     }

+ 0 - 21
dmaster/src/main/java/cn/reghao/autodop/dmaster/common/interceptor/WebhookSource.java

@@ -1,21 +0,0 @@
-package cn.reghao.autodop.dmaster.common.interceptor;
-
-/**
- * 调用 webhook 的源
- *
- * @author reghao
- * @date 2019-10-18 14:31:29
- */
-public enum WebhookSource {
-    codeup("Codeup"), gogs("Gogs"), git("Git"), svn("SVN");
-
-    private String value;
-
-    WebhookSource(String value) {
-        this.value = value;
-    }
-
-    public String getValue() {
-        return value;
-    }
-}

+ 1 - 5
dmaster/src/main/resources/application.yml

@@ -38,8 +38,4 @@ oss:
   key: jYk8lOKwSCorFEz7
   secret: hzSrcew08V5zk58kVVgInV7OqbHyVc
   bucket: iquizoo
-  folder: eval3.x/alpha/eval_exercises/
-#rabbit:
-#  exchange: test
-#  routeKey: test
-#  queue: test
+  folder: eval3.x/alpha/eval_exercises/

+ 11 - 11
scripts/test1.json

@@ -1,24 +1,24 @@
 {
-  "appId": "calculate-score",
+  "appId": "dnkt-bplus",
   "env": "test",
-  "description": "算分服务",
+  "description": "大脑课堂",
   "alwaysBuild": true,
   "enable": true,
-  "appType": "dotnetCore",
-  "appRepo": "git@codeup.aliyun.com:5f1f8daf6207a1a8b17f6742/background/CalculateScoreService.git",
-  "branch": "develop",
-  "dirname": "CalculateScoreService",
-  "compileHome": "/IQuizoo.CalculateScoreService",
-  "dockerfile": "FROM debian10/dotnetcore/rt:5.0\n\nRUN cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \\\n    && echo 'Asia/Shanghai' >/etc/timezone\n\nENV ASPNETCORE_ENVIRONMENT Production\nENV ASPNETCORE_URLS http://172.16.45.65:8003;\n\nWORKDIR /app\nCOPY ./bin/Debug/net5.0/publish/ .\nENTRYPOINT [\"dotnet\", \"IQuizoo.CalculateScoreService.dll\"]",
+  "appType": "npm",
+  "appRepo": "git@codeup.aliyun.com:5f1f8daf6207a1a8b17f6742/FrontEnd/IQuizoo.Game.git",
+  "branch": "bplus",
+  "dirname": "IQuizoo.Game",
+  "compileHome": "/",
+  "dockerfile": "FROM debian10/nginx\n\nRUN sed -i 's/8080/8081/' /etc/nginx/conf.d/http.conf\nCOPY ./dist-test /opt/webroot/\n",
   "buildConfig": {
     "repo": "git-codeup",
-    "compiler": "dotnet5-dev",
+    "compiler": "none",
     "packer": "docker-test"
   },
   "deployConfigs": [],
   "runningConfig": {
-    "httpPort": 8003,
-    "healthCheck": "/health",
+    "httpPort": 8081,
+    "healthCheck": "/",
     "logConfigs": []
   },
   "notifier": "ding-dev"