|
|
|
@@ -1,11 +1,6 @@ |
|
|
|
package com.ruoyi.platform.service.impl; |
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
|
import cn.hutool.core.date.DateUtil; |
|
|
|
import cn.hutool.core.util.IdUtil; |
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
import cn.hutool.http.HttpResponse; |
|
|
|
import cn.hutool.http.HttpUtil; |
|
|
|
import com.alibaba.fastjson2.JSON; |
|
|
|
import com.ruoyi.common.core.utils.DateUtils; |
|
|
|
import com.ruoyi.common.security.utils.SecurityUtils; |
|
|
|
@@ -31,7 +26,6 @@ import org.springframework.data.domain.Page; |
|
|
|
import org.springframework.data.domain.PageImpl; |
|
|
|
import org.springframework.data.domain.PageRequest; |
|
|
|
import org.springframework.http.HttpHeaders; |
|
|
|
import org.springframework.http.HttpRequest; |
|
|
|
import org.springframework.http.MediaType; |
|
|
|
import org.springframework.http.ResponseEntity; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
@@ -754,6 +748,35 @@ public class NewDatasetServiceImpl implements NewDatasetService { |
|
|
|
return "发布成功"; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void privateToPublic(NewDatasetVo newDatasetVo) throws Exception { |
|
|
|
//获取版本列表信息,每一个版本的配置文件都要更改 |
|
|
|
String token = gitService.checkoutToken(); |
|
|
|
List<Map<String, Object>> brancheList = gitService.getBrancheList(token, newDatasetVo.getOwner(), newDatasetVo.getIdentifier()); |
|
|
|
for (Map<String, Object> branch : brancheList) { |
|
|
|
if (branch.get("name").equals("master")) { |
|
|
|
continue; |
|
|
|
} |
|
|
|
//获取每个版本的配置信息 |
|
|
|
Map<String, Object> branchConfig = YamlUtils.loadYamlFile(localPathlocal + newDatasetVo.getOwner() + "/datasets/" + newDatasetVo.getId() + "/" + newDatasetVo.getIdentifier() + "/" + branch.get("name") + "/dataset.yaml"); |
|
|
|
branchConfig.put("is_public", "true"); |
|
|
|
|
|
|
|
//更新每个版本的配置信息 |
|
|
|
LoginUser loginUser = SecurityUtils.getLoginUser(); |
|
|
|
String ci4sUsername = loginUser.getUsername(); |
|
|
|
String repositoryName = newDatasetVo.getIdentifier(); |
|
|
|
String branchName = newDatasetVo.getVersion(); |
|
|
|
String relatePath = ci4sUsername + "/datasets/" + newDatasetVo.getId() + "/" + repositoryName + "/" + branchName; |
|
|
|
String localPath = localPathlocal + relatePath; |
|
|
|
YamlUtils.generateYamlFile(JsonUtils.objectToMap(branchConfig), localPath, "dataset"); |
|
|
|
} |
|
|
|
Map projectDetail = gitService.getProjectDetail(newDatasetVo.getOwner(), newDatasetVo.getIdentifier(), token); |
|
|
|
Map<String, Object> param = new HashMap<>(); |
|
|
|
param.put("id", projectDetail.get("project_id")); |
|
|
|
param.put("is_public", true); |
|
|
|
gitService.updateProjectDetail(param,newDatasetVo.getOwner(),newDatasetVo.getIdentifier(),token); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 从Map列表中提取"v+数字"格式的版本号并升级 |
|
|
|
* |
|
|
|
|