修改联网BUG
This commit is contained in:
parent
6619f4082a
commit
1acc84aa9c
|
@ -116,7 +116,7 @@ public class ImageController extends BaseController {
|
|||
* @return 删除是否成功
|
||||
*/
|
||||
@DeleteMapping("{id}")
|
||||
public GenericsAjaxResult<String> deleteById(@PathVariable("id") Integer id) {
|
||||
public GenericsAjaxResult<String> deleteById(@PathVariable("id") Integer id) throws Exception {
|
||||
return genericsSuccess(this.imageService.removeById(id));
|
||||
}
|
||||
|
||||
|
|
|
@ -274,9 +274,9 @@ public class ImageServiceImpl implements ImageService {
|
|||
String logs2 = k8sClientUtil.executeCommand(pod,"docker pull "+ netPath);
|
||||
// 在容器里执行 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[] lines = logs2.split("\n");
|
||||
String lastLine = lines[lines.length - 1].trim();
|
||||
String tagCmd = "docker tag " + lastLine + " " + harborUrl + "/" + repository + "/" + username + "/" + imageName + ":" + imageTag;
|
||||
String imageUrl = harborUrl + "/" + repository + "/" + username + "/" + imageName + ":" + imageTag;
|
||||
String pushCmd = "docker push " + imageUrl;
|
||||
String sizeCmd = "docker inspect --format='{{.Size}}' " + imageUrl;
|
||||
|
|
Loading…
Reference in New Issue