From 5dcb95fa11f17ff95e382f00512ae641f3d022ba Mon Sep 17 00:00:00 2001 From: fanshuai <1141904845@qq.com> Date: Tue, 23 Apr 2024 15:55:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=81=94=E7=BD=91BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ruoyi/platform/service/impl/ImageServiceImpl.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ImageServiceImpl.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ImageServiceImpl.java index 7748c95..7b4b777 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ImageServiceImpl.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ImageServiceImpl.java @@ -317,9 +317,8 @@ public class ImageServiceImpl implements ImageService { String logs2 = k8sClientUtil.executeCommand(pod,"docker load -i "+filePath); // 在容器里执行 docker tag name:tag nexus3.kube-system.svc:8083/imageName:imageTag if (StringUtils.isNoneBlank(logs2)){ - String substring = logs2.substring(logs2.lastIndexOf(harborUrl)); - String cleanedString = substring.replaceAll("(\\r|\\n)", ""); - String tagCmd = "docker tag " + cleanedString + " " + harborUrl + "/" + repository + "/" + username + "/" + imageName + ":" + imageTag; + String substring = logs2.substring(logs2.indexOf(":")+1).trim(); + String tagCmd = "docker tag " + substring + " " + harborUrl + "/" + repository + "/" + username + "/" + imageName + ":" + imageTag; String imageUrl = harborUrl + "/" + repository + "/" + username + "/" + imageName + ":" + imageTag; String pushCmd = "docker push " + imageUrl; String sizeCmd = "docker inspect --format='{{.Size}}' " + imageUrl;