|
|
@@ -3,7 +3,7 @@ package cn.reghao.devops.mgr.ops.build.service;
|
|
|
import cn.reghao.devops.common.docker.DockerImpl;
|
|
|
import cn.reghao.devops.common.docker.model.DockerAuth;
|
|
|
import cn.reghao.devops.mgr.ops.build.db.repository.RepoAuthConfigRepository;
|
|
|
-import cn.reghao.devops.mgr.ops.build.model.dto.DockerAuthDto;
|
|
|
+import cn.reghao.devops.mgr.ops.build.model.dto.DockerRegistryDto;
|
|
|
import cn.reghao.devops.mgr.ops.build.model.po.RepoAuthConfig;
|
|
|
import cn.reghao.devops.mgr.ops.docker.db.repository.DockerRegistryRepository;
|
|
|
import cn.reghao.devops.mgr.ops.build.model.po.DockerRegistry;
|
|
|
@@ -26,15 +26,15 @@ public class DockerRegistryService {
|
|
|
this.repoAuthConfigRepository = repoAuthConfigRepository;
|
|
|
}
|
|
|
|
|
|
- public Result addOrUpdate(DockerAuthDto dockerAuthDto) {
|
|
|
- String repoAuthName = dockerAuthDto.getRepoAuthName();
|
|
|
+ public Result addOrUpdate(DockerRegistryDto dockerRegistryDto) {
|
|
|
+ String repoAuthName = dockerRegistryDto.getRepoAuthName();
|
|
|
RepoAuthConfig repoAuthConfig = repoAuthConfigRepository.findByName(repoAuthName);
|
|
|
if (repoAuthConfig == null) {
|
|
|
return Result.fail(String.format("RepoAuthName %s not exists", repoAuthName));
|
|
|
}
|
|
|
|
|
|
DockerAuth dockerAuth = new DockerAuth();
|
|
|
- dockerAuth.setRegistryUrl(dockerAuthDto.getRegistryUrl());
|
|
|
+ dockerAuth.setRegistryUrl(dockerRegistryDto.getRegistryUrl());
|
|
|
dockerAuth.setUsername(repoAuthConfig.getUsername());
|
|
|
dockerAuth.setPassword(repoAuthConfig.getPassword());
|
|
|
DockerImpl docker = new DockerImpl();
|
|
|
@@ -43,7 +43,7 @@ public class DockerRegistryService {
|
|
|
String registryUrl = dockerAuth.getRegistryUrl();
|
|
|
DockerRegistry dockerRegistry = dockerAuthRepository.findByRegistryUrl(registryUrl);
|
|
|
if (dockerRegistry == null) {
|
|
|
- dockerRegistry = new DockerRegistry(registryUrl, repoAuthConfig);
|
|
|
+ dockerRegistry = new DockerRegistry(dockerRegistryDto, repoAuthConfig);
|
|
|
dockerAuthRepository.save(dockerRegistry);
|
|
|
return Result.success();
|
|
|
}
|