| @@ -144,7 +144,7 @@ public class NewDatasetServiceImpl implements NewDatasetService { | |||
| // 得到项目地址 | |||
| String projectUrl = gitCloneEndpoint + "/" + owner + "/" + repositoryName + ".git"; | |||
| // 创建master-dvc分支 | |||
| // 创建origin分支 | |||
| gitService.createBranch(token, owner, repositoryName, "origin", "master"); | |||
| dvcUtils.gitClone(localPath, projectUrl, "origin", gitLinkUsername, gitLinkPassword); | |||
| // 拼接生产的元数据后写入yaml文件 | |||
| @@ -154,7 +154,6 @@ public class NewDatasetServiceImpl implements NewDatasetService { | |||
| datasetVo.setId(gitlinIid); | |||
| datasetVo.setOwner(owner); | |||
| datasetVo.setRelativePaths(relatePath + "/dataset"); | |||
| // addDatasetSourceToDataVo(datasetVo); | |||
| YamlUtils.generateYamlFile(JsonUtils.objectToMap(datasetVo), localPath, "dataset"); | |||
| // dvc init 初始化 | |||
| @@ -174,53 +173,52 @@ public class NewDatasetServiceImpl implements NewDatasetService { | |||
| dvcUtils.dvcPush(localPath); | |||
| // 创建分支 | |||
| String branchName = datasetVo.getVersion(); | |||
| // 得到用户操作的路径 | |||
| String sourcePath = datasetVo.getDatasetVersionVos().get(0).getUrl(); | |||
| String relatePath1 = ci4sUsername + "/datasets/" + gitlinIid + "/" + repositoryName + "/" + branchName; | |||
| String localPath1 = localPathlocal + relatePath1; | |||
| String datasetPath1 = localPath1 + "/dataset"; | |||
| // 命令行操作 git clone 项目地址 | |||
| dvcUtils.gitClone(localPath1, projectUrl, "origin", gitLinkUsername, gitLinkPassword); | |||
| dvcUtils.refreshRemoteBranches(localPath1, gitLinkUsername, gitLinkPassword, "origin"); | |||
| //检查是否存在本地重名分支,有的话干掉 | |||
| dvcUtils.deleteLocalBranch(localPath1, branchName); | |||
| // 创建本地分支 | |||
| dvcUtils.createLocalBranchBasedOnMaster(localPath1, branchName); | |||
| //dvc checkout | |||
| dvcUtils.dvcPull(localPath1); | |||
| dvcUtils.dvcCheckout(localPath1); | |||
| String s3Path1 = bucketName + "/mini-model-management-platform-files" + "/" + relatePath1; | |||
| //删掉已存在文件夹 | |||
| dvcUtils.deleteDirectory(datasetPath1); | |||
| dvcUtils.moveFiles(sourcePath, datasetPath1); | |||
| // 拼接生产的元数据后写入yaml文件 | |||
| datasetVo.setUpdateTime(DateUtils.getTime()); | |||
| datasetVo.setUsage("<pre><code>" + | |||
| "# 克隆数据集配置文件与存储参数到本地\n" + | |||
| "git clone -b " + branchName + " " + projectUrl + "\n" + | |||
| "# 远程拉取配置文件\n" + | |||
| "dvc pull\n" + | |||
| "</code></pre>"); | |||
| datasetVo.setRelativePaths(relatePath1 + "/dataset"); | |||
| YamlUtils.generateYamlFile(JsonUtils.objectToMap(datasetVo), localPath1, "dataset"); | |||
| // CompletableFuture.supplyAsync(() -> { | |||
| // try { | |||
| // 配置远程S3地址 | |||
| dvcUtils.dvcRemoteAdd(localPath1, s3Path1); | |||
| dvcUtils.dvcConfigS3Credentials(localPath1, endpoint); | |||
| dvcUtils.dvcConfigS3Credentials2(localPath1, accessKeyId); | |||
| dvcUtils.dvcConfigS3Credentials3(localPath1, secretAccessKey); | |||
| // dvc 跟踪 | |||
| dvcUtils.dvcAdd(localPath1, "dataset"); | |||
| // git commit | |||
| dvcUtils.pushNewBranchToRemote(localPath1, gitLinkUsername, gitLinkPassword, branchName); | |||
| // dvc push 到远程S3 | |||
| dvcUtils.dvcPush(localPath1); | |||
| newCreateVersion(datasetVo); | |||
| // String branchName = datasetVo.getVersion(); | |||
| // | |||
| // // 得到用户操作的路径 | |||
| // String sourcePath = datasetVo.getDatasetVersionVos().get(0).getUrl(); | |||
| // String relatePath1 = ci4sUsername + "/datasets/" + gitlinIid + "/" + repositoryName + "/" + branchName; | |||
| // String localPath1 = localPathlocal + relatePath1; | |||
| // String datasetPath1 = localPath1 + "/dataset"; | |||
| // | |||
| // // 命令行操作 git clone 项目地址 | |||
| // dvcUtils.gitClone(localPath1, projectUrl, "origin", gitLinkUsername, gitLinkPassword); | |||
| // dvcUtils.refreshRemoteBranches(localPath1, gitLinkUsername, gitLinkPassword, "origin"); | |||
| // // 创建本地分支 | |||
| // dvcUtils.createLocalBranchBasedOnMaster(localPath1, branchName); | |||
| // //dvc checkout | |||
| // dvcUtils.dvcPull(localPath1); | |||
| // dvcUtils.dvcCheckout(localPath1); | |||
| // | |||
| // String s3Path1 = bucketName + "/mini-model-management-platform-files" + "/" + relatePath1; | |||
| // //删掉已存在文件夹 | |||
| // dvcUtils.deleteDirectory(datasetPath1); | |||
| // dvcUtils.moveFiles(sourcePath, datasetPath1); | |||
| // // 拼接生产的元数据后写入yaml文件 | |||
| // datasetVo.setUpdateTime(DateUtils.getTime()); | |||
| // datasetVo.setUsage("<pre><code>" + | |||
| // "# 克隆数据集配置文件与存储参数到本地\n" + | |||
| // "git clone -b " + branchName + " " + projectUrl + "\n" + | |||
| // "# 远程拉取配置文件\n" + | |||
| // "dvc pull\n" + | |||
| // "</code></pre>"); | |||
| // datasetVo.setRelativePaths(relatePath1 + "/dataset"); | |||
| // YamlUtils.generateYamlFile(JsonUtils.objectToMap(datasetVo), localPath1, "dataset"); | |||
| // | |||
| //// CompletableFuture.supplyAsync(() -> { | |||
| //// try { | |||
| // // 配置远程S3地址 | |||
| // dvcUtils.dvcRemoteAdd(localPath1, s3Path1); | |||
| // dvcUtils.dvcConfigS3Credentials(localPath1, endpoint); | |||
| // dvcUtils.dvcConfigS3Credentials2(localPath1, accessKeyId); | |||
| // dvcUtils.dvcConfigS3Credentials3(localPath1, secretAccessKey); | |||
| // // dvc 跟踪 | |||
| // dvcUtils.dvcAdd(localPath1, "dataset"); | |||
| // // git commit | |||
| // dvcUtils.pushNewBranchToRemote(localPath1, gitLinkUsername, gitLinkPassword, branchName); | |||
| // // dvc push 到远程S3 | |||
| // dvcUtils.dvcPush(localPath1); | |||
| // } catch (Exception e) { | |||
| // logger.error(e.getMessage(), e); | |||
| // throw new RuntimeException(e.getMessage()); | |||
| @@ -267,10 +265,6 @@ public class NewDatasetServiceImpl implements NewDatasetService { | |||
| Map projectDetail = gitService.getProjectDetail(owner, repositoryName, token); | |||
| //克隆 | |||
| // List<Map<String, Object>> brancheList = gitService.getBrancheList(token, owner, repositoryName); | |||
| // String oldBranch = (String) brancheList.stream() | |||
| // .filter(branch -> !"master".equals(branch.get("name"))).collect(Collectors.toList()).get(0).get("name"); | |||
| dvcUtils.gitClone(localPath, projectUrl, "origin", gitLinkUsername, gitLinkPassword); | |||
| dvcUtils.refreshRemoteBranches(localPath, gitLinkUsername, gitLinkPassword, "origin"); | |||