parent
204e39774a
commit
c6cfad8fb9
|
|
@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModel;
|
|||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -25,4 +26,7 @@ public class CommonAssetAddToProductRepoVo {
|
|||
private String repoName;
|
||||
@ApiModelProperty(value = "组织标识", hidden = true)
|
||||
private String enterpriseIdentifier;
|
||||
@ApiModelProperty(value = "目录:上传文件的目录(例如/path/to/files/)")
|
||||
@NotNull(message = "目录不能为空")
|
||||
private String directory;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModel;
|
|||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -25,4 +26,7 @@ public class DockerComponentAddToProductRepoVo {
|
|||
private String repoName;
|
||||
@ApiModelProperty(value = "组织标识", hidden = true)
|
||||
private String enterpriseIdentifier;
|
||||
@ApiModelProperty(value = "目录:上传文件的目录(例如/path/to/files/)")
|
||||
@NotNull(message = "目录不能为空")
|
||||
private String directory;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,8 +26,9 @@ public interface IPmsProductLibraryAsyncService {
|
|||
* @param productRepo 产品库
|
||||
* @param repo 制品库
|
||||
* @param nexusAssetResultDataVoList 制品列表
|
||||
* @param directory
|
||||
*/
|
||||
void asyncAddCommonAssetToProductRepo(PmsProductLibraryRepositories productRepo, PmsProductLibraryRepositories repo, List<NexusAssetResultDataVo> nexusAssetResultDataVoList);
|
||||
void asyncAddCommonAssetToProductRepo(PmsProductLibraryRepositories productRepo, PmsProductLibraryRepositories repo, List<NexusAssetResultDataVo> nexusAssetResultDataVoList, String directory);
|
||||
|
||||
/**
|
||||
* 同步制品库制品到快照库
|
||||
|
|
@ -43,6 +44,7 @@ public interface IPmsProductLibraryAsyncService {
|
|||
* @param productRepo 产品库
|
||||
* @param repo 制品库
|
||||
* @param nexusComponentResultDataVoList Docker制品列表
|
||||
* @param directory
|
||||
*/
|
||||
void asyncAddDockerComponentToProductRepo(PmsProductLibraryRepositories productRepo, PmsProductLibraryRepositories repo, List<NexusComponentResultDataVo> nexusComponentResultDataVoList);
|
||||
void asyncAddDockerComponentToProductRepo(PmsProductLibraryRepositories productRepo, PmsProductLibraryRepositories repo, List<NexusComponentResultDataVo> nexusComponentResultDataVoList, String directory);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ public class PmsProductLibraryAsyncServiceImpl implements IPmsProductLibraryAsyn
|
|||
}
|
||||
|
||||
@Override
|
||||
public void asyncAddCommonAssetToProductRepo(PmsProductLibraryRepositories productRepo, PmsProductLibraryRepositories repo, List<NexusAssetResultDataVo> nexusAssetResultDataVoList) {
|
||||
public void asyncAddCommonAssetToProductRepo(PmsProductLibraryRepositories productRepo, PmsProductLibraryRepositories repo, List<NexusAssetResultDataVo> nexusAssetResultDataVoList, String directory) {
|
||||
CustomExecutorFactory.threadPoolExecutor.execute(() -> {
|
||||
pmsProductLibraryRepositoriesService.lockRepository(repo.getPmsEnterpriseIdentifier(), repo.getId());
|
||||
try {
|
||||
|
|
@ -94,7 +94,7 @@ public class PmsProductLibraryAsyncServiceImpl implements IPmsProductLibraryAsyn
|
|||
assetRawInputVo.setFileBytes(fileBytes);
|
||||
}
|
||||
assetRawInputVoList.add(assetRawInputVo);
|
||||
insertRawComponentToProductRepo(productRepo, repo, assetRawInputVoList, nexusAssetResultDataVo.getVersion(), customAttribute, nexusAssetResultDataVo.getDirectory());
|
||||
insertRawComponentToProductRepo(productRepo, repo, assetRawInputVoList, nexusAssetResultDataVo.getVersion(), customAttribute, directory);
|
||||
}
|
||||
} finally {
|
||||
pmsProductLibraryRepositoriesService.unlockRepository(repo.getPmsEnterpriseIdentifier(), repo.getId());
|
||||
|
|
@ -139,7 +139,7 @@ public class PmsProductLibraryAsyncServiceImpl implements IPmsProductLibraryAsyn
|
|||
}
|
||||
|
||||
@Override
|
||||
public void asyncAddDockerComponentToProductRepo(PmsProductLibraryRepositories productRepo, PmsProductLibraryRepositories repo, List<NexusComponentResultDataVo> nexusComponentResultDataVoList) {
|
||||
public void asyncAddDockerComponentToProductRepo(PmsProductLibraryRepositories productRepo, PmsProductLibraryRepositories repo, List<NexusComponentResultDataVo> nexusComponentResultDataVoList, String directory) {
|
||||
CustomExecutorFactory.threadPoolExecutor.execute(() -> {
|
||||
pmsProductLibraryRepositoriesService.lockRepository(repo.getPmsEnterpriseIdentifier(), repo.getId());
|
||||
try {
|
||||
|
|
@ -162,7 +162,7 @@ public class PmsProductLibraryAsyncServiceImpl implements IPmsProductLibraryAsyn
|
|||
assetRawInputVo.setFileBytes(sysFileBytes);
|
||||
assetRawInputVo.setAssetIdentifier(nexusComponentResultDataVo.getId());
|
||||
assetRawInputVoList.add(assetRawInputVo);
|
||||
insertRawComponentToProductRepo(productRepo, repo, assetRawInputVoList, nexusComponentResultDataVo.getVersion(), null, "");
|
||||
insertRawComponentToProductRepo(productRepo, repo, assetRawInputVoList, nexusComponentResultDataVo.getVersion(), null, directory);
|
||||
} catch (IOException e) {
|
||||
log.error("拉取Docker镜像失败:{}", e.getMessage());
|
||||
}
|
||||
|
|
@ -279,7 +279,7 @@ public class PmsProductLibraryAsyncServiceImpl implements IPmsProductLibraryAsyn
|
|||
componentRawInputVo.setVersion(version);
|
||||
componentRawInputVo.setAttributes(customAttribute);
|
||||
componentRawInputVo.setAssetList(assetRawInputVoList);
|
||||
componentRawInputVo.setDirectory(EscapeUtil.removeExtraSlashOfUrl(String.format("/%s/%s", repo.getAlias(), directory)));
|
||||
componentRawInputVo.setDirectory(directory);
|
||||
pmsProductLibraryComponentService.insertRawComponent(componentRawInputVo);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -145,7 +145,7 @@ public class PmsProductLibraryProductRepoServiceImpl implements IPmsProductLibra
|
|||
nexusAssetResultDataVoList.add(nexusAssetResultVo.getResult().getData());
|
||||
}
|
||||
}
|
||||
pmsProductLibraryAsyncService.asyncAddCommonAssetToProductRepo(productRepo, repo, nexusAssetResultDataVoList);
|
||||
pmsProductLibraryAsyncService.asyncAddCommonAssetToProductRepo(productRepo, repo, nexusAssetResultDataVoList, commonAssetAddToProductRepoVo.getDirectory());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -233,7 +233,7 @@ public class PmsProductLibraryProductRepoServiceImpl implements IPmsProductLibra
|
|||
nexusComponentResultDataVoList.add(nexusAssetResultVo.getResult().getData());
|
||||
}
|
||||
}
|
||||
pmsProductLibraryAsyncService.asyncAddDockerComponentToProductRepo(productRepo, repo, nexusComponentResultDataVoList);
|
||||
pmsProductLibraryAsyncService.asyncAddDockerComponentToProductRepo(productRepo, repo, nexusComponentResultDataVoList, dockerComponentAddToProductRepoVo.getDirectory());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue