You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by nf...@apache.org on 2021/01/21 08:51:04 UTC

[camel-k] branch master updated (72cc1dd -> 5b08073)

This is an automated email from the ASF dual-hosted git repository.

nferraro pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/camel-k.git.


    from 72cc1dd  Fix routes-discovery.enabled property name
     new c9f7ba1  Fix image location extraction.
     new 5b08073  Fix comment.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 pkg/cmd/util_containerization.go |  7 +++++--
 pkg/util/docker/docker.go        | 13 ++++++-------
 2 files changed, 11 insertions(+), 9 deletions(-)


[camel-k] 02/02: Fix comment.

Posted by nf...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nferraro pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-k.git

commit 5b08073054a43ee170e48e2e8329826a30984e42
Author: Doru Bercea <gh...@ibm.com>
AuthorDate: Wed Jan 20 18:09:00 2021 -0500

    Fix comment.
---
 pkg/util/docker/docker.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pkg/util/docker/docker.go b/pkg/util/docker/docker.go
index 6a777d3..812d8f1 100644
--- a/pkg/util/docker/docker.go
+++ b/pkg/util/docker/docker.go
@@ -153,6 +153,6 @@ func ExtractRegistryName(image string) (string, error) {
 		return "", errors.New("image path is too short, usage: registry/imageName or registry/*/imageName")
 	}
 
-	// Register name is given by the path to the image.
+	// Registry name is given by the path to the image.
 	return strings.Join(pathComponents[0:len(pathComponents)-1], containerFileSeparator), nil
 }


[camel-k] 01/02: Fix image location extraction.

Posted by nf...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nferraro pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-k.git

commit c9f7ba1699da2b2b6dbca91e3b039054945545cb
Author: Doru Bercea <gh...@ibm.com>
AuthorDate: Wed Jan 20 17:35:09 2021 -0500

    Fix image location extraction.
---
 pkg/cmd/util_containerization.go |  7 +++++--
 pkg/util/docker/docker.go        | 13 ++++++-------
 2 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/pkg/cmd/util_containerization.go b/pkg/cmd/util_containerization.go
index dcbd97a..f633a0e 100644
--- a/pkg/cmd/util_containerization.go
+++ b/pkg/cmd/util_containerization.go
@@ -87,7 +87,7 @@ func setDockerEnvVars(envVars []string) {
 	}
 }
 
-func createAndBuildBaseImage(ctx context.Context, containerRegistry string) error {
+func createAndBuildBaseImage(ctx context.Context) error {
 	// Create the base image Docker file.
 	err := docker.CreateBaseImageDockerFile()
 	if err != nil {
@@ -117,6 +117,9 @@ func createAndBuildIntegrationImage(ctx context.Context, containerRegistry strin
 	}
 
 	docker.RegistryName = containerRegistry
+
+	// If we build a normal image, i.e. not the base image, we need to parse
+	// the location where images will be pushed.
 	if !justBaseImage {
 		registryName, err := docker.ExtractRegistryName(image)
 		if err != nil {
@@ -127,7 +130,7 @@ func createAndBuildIntegrationImage(ctx context.Context, containerRegistry strin
 	}
 
 	// Create the Dockerfile and build the base image.
-	err := createAndBuildBaseImage(ctx, containerRegistry)
+	err := createAndBuildBaseImage(ctx)
 	if err != nil {
 		return err
 	}
diff --git a/pkg/util/docker/docker.go b/pkg/util/docker/docker.go
index 228332d..6a777d3 100644
--- a/pkg/util/docker/docker.go
+++ b/pkg/util/docker/docker.go
@@ -146,14 +146,13 @@ func ExtractRegistryName(image string) (string, error) {
 
 	// There must be at least two components in the path:
 	//  - docker.io/registry/imageName
-	//  - registry/imageName
+	//  - localhost:5000/<dir>/imageName
+	//  - localhost:5000/<dir>/.../<dir>/imageName
+	//  - localhost:5000/imageName
 	if len(pathComponents) < 2 {
-		return "", errors.New("image path is too short, usage: docker.io/registry/imageName or registry/imageName")
+		return "", errors.New("image path is too short, usage: registry/imageName or registry/*/imageName")
 	}
 
-	// Check if path starts with docker.io if not, add it.
-	if pathComponents[0] == "docker.io" {
-		return strings.Join(pathComponents[0:2], containerFileSeparator), nil
-	}
-	return "docker.io" + containerFileSeparator + pathComponents[1], nil
+	// Register name is given by the path to the image.
+	return strings.Join(pathComponents[0:len(pathComponents)-1], containerFileSeparator), nil
 }