|
|
|
@@ -24,7 +24,6 @@ import org.springframework.beans.factory.annotation.Value; |
|
|
|
import org.springframework.data.domain.Page; |
|
|
|
import org.springframework.data.domain.PageImpl; |
|
|
|
import org.springframework.data.domain.PageRequest; |
|
|
|
import org.springframework.scheduling.annotation.Async; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
import org.springframework.web.multipart.MultipartFile; |
|
|
|
@@ -182,12 +181,12 @@ public class ImageServiceImpl implements ImageService { |
|
|
|
// } |
|
|
|
List<ImageVersion> imageVersions = imageVersionService.queryByImageId(id); |
|
|
|
|
|
|
|
for (ImageVersion imageVersion : imageVersions) { |
|
|
|
for (ImageVersion imageVersion :imageVersions) { |
|
|
|
dockerClientUtil.removeImage(imageVersion.getUrl(), imageVersion.getHostIp()); |
|
|
|
} |
|
|
|
|
|
|
|
image.setState(0); |
|
|
|
return this.imageDao.update(image) > 0 ? "删除成功" : "删除失败"; |
|
|
|
return this.imageDao.update(image) > 0 ? "删除成功" : "删除失败"; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
@@ -368,18 +367,10 @@ public class ImageServiceImpl implements ImageService { |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional |
|
|
|
@Async |
|
|
|
public String saveImage(ImageVo imageVo) { |
|
|
|
Image oldImage = imageDao.getByName(imageVo.getName()); |
|
|
|
if (oldImage != null) { |
|
|
|
List<ImageVersion> oldImageVersions = imageVersionDao.queryByImageId(oldImage.getId()); |
|
|
|
for (ImageVersion oldImageVersion : oldImageVersions) { |
|
|
|
if(oldImageVersion.getTagName().equals(imageVo.getTagName())){ |
|
|
|
throw new IllegalStateException("镜像tag不能重复"); |
|
|
|
} |
|
|
|
} |
|
|
|
if (imageDao.getByName(imageVo.getName()) != null) { |
|
|
|
throw new IllegalStateException("镜像名称已存在"); |
|
|
|
} |
|
|
|
|
|
|
|
LoginUser loginUser = SecurityUtils.getLoginUser(); |
|
|
|
String username = loginUser.getUsername().toLowerCase(); |
|
|
|
String podName = username + "-editor-pod" + "-" + imageVo.getDevEnvironmentId().toString(); |
|
|
|
|