isula-build: add repo to local image when output is docker

Signed-off-by: jingxiaolu <lujingxiao@huawei.com>
This commit is contained in:
jingxiaolu 2021-11-17 22:22:54 +08:00
parent 08a2e11c57
commit bd20a6e1c1
5 changed files with 55 additions and 3 deletions

View File

@ -1 +1 @@
0.9.5-20
0.9.5-21

View File

@ -1 +1 @@
91914cb21b35c8fb6f19bffb964cbf339b2db424
ec7c7a741944af0725c3446c6fe09513269a18c7

View File

@ -2,7 +2,7 @@
Name: isula-build
Version: 0.9.5
Release: 20
Release: 21
Summary: A tool to build container images
License: Mulan PSL V2
URL: https://gitee.com/openeuler/isula-build
@ -85,6 +85,12 @@ fi
/usr/share/bash-completion/completions/isula-build
%changelog
* Wed Nov 17 2021 jingxiaolu <lujingxiao@huawei.com> - 0.9.5-21
- Type:enhancement
- CVE:NA
- SUG:restart
- DESC:add repo to local image when output transporter is docker://
* Wed Nov 10 2021 DCCooper <1866858@gmail.com> - 0.9.5-20
- Type:enhancement
- CVE:NA

View File

@ -0,0 +1,45 @@
From c39db6aff78c1da4d6004c5ea92058121e706092 Mon Sep 17 00:00:00 2001
From: xingweizheng <xingweizheng@huawei.com>
Date: Wed, 27 Oct 2021 20:13:59 +0800
Subject: [PATCH] add repo to local image when output transporter is docker://
---
builder/dockerfile/builder.go | 2 +-
builder/dockerfile/builder_test.go | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/builder/dockerfile/builder.go b/builder/dockerfile/builder.go
index df8c6ce..7fff71b 100644
--- a/builder/dockerfile/builder.go
+++ b/builder/dockerfile/builder.go
@@ -627,7 +627,7 @@ func parseOutputTag(output string) string {
if repo == "" {
return ""
}
- tag = repoAndTag[len(repo):]
+ tag = strings.TrimLeft(repoAndTag, "/")
}
return tag
diff --git a/builder/dockerfile/builder_test.go b/builder/dockerfile/builder_test.go
index c2fec6c..20cca43 100644
--- a/builder/dockerfile/builder_test.go
+++ b/builder/dockerfile/builder_test.go
@@ -1300,12 +1300,12 @@ func TestParseTag(t *testing.T) {
{
name: "docker output",
output: "docker://localhost:5000/isula/test:latest",
- tag: "isula/test:latest",
+ tag: "localhost:5000/isula/test:latest",
},
{
name: "docker output",
output: "docker://localhost:5000/isula/test",
- tag: "isula/test",
+ tag: "localhost:5000/isula/test",
},
{
name: "invalid docker output",
--
1.8.3.1

View File

@ -53,3 +53,4 @@ patch/0087-bugfix-optimize-function-IsExist.patch
patch/0088-bugfix-loaded-images-cover-existing-images-name-and-.patch
patch/0089-isula-build-fix-panic-when-using-image-ID-to-save-se.patch
patch/0090-enhancement-add-log-info-to-show-the-image-layer-num.patch
patch/0091-add-repo-to-local-image-when-output-transporter-is-d.patch