|
|
@@ -3,6 +3,7 @@ package cn.reghao.devops.mgr.ops.app.service.impl;
|
|
|
import cn.reghao.devops.mgr.ops.app.db.query.AppBuildRepository;
|
|
|
import cn.reghao.devops.mgr.ops.build.model.po.RepoAuthConfig;
|
|
|
import cn.reghao.devops.mgr.ops.app.db.repository.AppConfigRepository;
|
|
|
+import cn.reghao.devops.mgr.ops.build.service.BuildDirService;
|
|
|
import cn.reghao.devops.mgr.ops.builder.db.repository.BuildLogRepository;
|
|
|
import cn.reghao.devops.mgr.ops.app.model.dto.AppConfigDto;
|
|
|
import cn.reghao.devops.mgr.ops.app.model.dto.AppConfigUpdateDto;
|
|
|
@@ -39,16 +40,18 @@ public class AppBuildServiceImpl implements AppBuildService {
|
|
|
private final AppDeployService appDeployService;
|
|
|
private final GitClient gitClient;
|
|
|
private final AppBuildRepository appBuildRepository;
|
|
|
+ private BuildDirService buildDirService;
|
|
|
|
|
|
public AppBuildServiceImpl(AppConfigRepository appConfigRepository, BuildLogRepository buildLogRepository,
|
|
|
BuildConfigChecker buildConfigChecker, AppDeployService appDeployService,
|
|
|
- GitClient gitClient, AppBuildRepository appBuildRepository) {
|
|
|
+ GitClient gitClient, AppBuildRepository appBuildRepository, BuildDirService buildDirService) {
|
|
|
this.appConfigRepository = appConfigRepository;
|
|
|
this.buildLogRepository = buildLogRepository;
|
|
|
this.buildConfigChecker = buildConfigChecker;
|
|
|
this.appDeployService = appDeployService;
|
|
|
this.gitClient = gitClient;
|
|
|
this.appBuildRepository = appBuildRepository;
|
|
|
+ this.buildDirService = buildDirService;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -166,17 +169,7 @@ public class AppBuildServiceImpl implements AppBuildService {
|
|
|
|
|
|
@Override
|
|
|
public Result clearLocalRepo(String appId) {
|
|
|
- // TODO 保证 app 没有处在构建状态
|
|
|
- String localRepo = LocalBuildDir.localRepo + File.separator + appId;
|
|
|
- File dir = new File(localRepo);
|
|
|
- try {
|
|
|
- if (dir.exists()) {
|
|
|
- FileUtils.cleanDirectory(dir);
|
|
|
- }
|
|
|
-
|
|
|
- return Result.result(ResultStatus.SUCCESS);
|
|
|
- } catch (IOException e) {
|
|
|
- return Result.result(ResultStatus.FAIL, e.getMessage());
|
|
|
- }
|
|
|
+ Result result = buildDirService.eraseLocalRepo(appId);
|
|
|
+ return result;
|
|
|
}
|
|
|
}
|