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

jpoth pushed a commit to branch release-1.9.x
in repository https://gitbox.apache.org/repos/asf/camel-k.git

commit 8e76dc113640cbb9911b274120cbe459dacf45fb
Author: John Poth <poth.j...@gmail.com>
AuthorDate: Tue May 24 09:31:40 2022 +0200

    feat(cli): Add option to skip uploading POM from JAR  when uploading 
artifacts to the image registry
    
    (cherry picked from commit f5e39aaa4dcf97ce9ef9fd4e0d8517ca0a35f61f)
---
 e2e/registry/registry_maven_wagon_test.go |  2 +-
 pkg/cmd/run.go                            | 16 ++++++++++++----
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/e2e/registry/registry_maven_wagon_test.go 
b/e2e/registry/registry_maven_wagon_test.go
index 7a978d46d..4abebc239 100644
--- a/e2e/registry/registry_maven_wagon_test.go
+++ b/e2e/registry/registry_maven_wagon_test.go
@@ -50,7 +50,7 @@ func TestImageRegistryIsAMavenRepository(t *testing.T) {
                t.Run("image registry is a maven repository", func(t 
*testing.T) {
                        // Create integration that should decrypt an encrypted 
message to "foobar" and log it
                        name := "foobar-decryption"
-                       jar, err := 
filepath.Abs("files/sample-decryption-1.0.jar")
+                       jar, err := 
filepath.Abs("files/sample-decryption-1.0.jar?skipPOM=true")
                        assert.Nil(t, err)
                        pom, err := 
filepath.Abs("files/sample-decryption-1.0.pom")
                        assert.Nil(t, err)
diff --git a/pkg/cmd/run.go b/pkg/cmd/run.go
index 249460dce..2e55e1a99 100644
--- a/pkg/cmd/run.go
+++ b/pkg/cmd/run.go
@@ -94,7 +94,7 @@ func newCmdRun(rootCmdOptions *RootCmdOptions) 
(*cobra.Command, *runCmdOptions)
 
        cmd.Flags().String("name", "", "The integration name")
        cmd.Flags().StringArrayP("connect", "c", nil, "A Service that the 
integration should bind to, specified as 
[[apigroup/]version:]kind:[namespace/]name")
-       cmd.Flags().StringArrayP("dependency", "d", nil, "A dependency that 
should be included, e.g., \"-d camel-mail\" for a Camel component, \"-d 
mvn:org.my:app:1.0\" for a Maven dependency or 
\"file://localPath[?targetPath=<path>&registry=<registry 
URL>&skipChecksums=<true>]\" for local files (experimental)")
+       cmd.Flags().StringArrayP("dependency", "d", nil, "A dependency that 
should be included, e.g., \"-d camel-mail\" for a Camel component, \"-d 
mvn:org.my:app:1.0\" for a Maven dependency or 
\"file://localPath[?targetPath=<path>&registry=<registry 
URL>&skipChecksums=<true>&skipPOM=<true>]\" for local files (experimental)")
        cmd.Flags().BoolP("wait", "w", false, "Wait for the integration to be 
running")
        cmd.Flags().StringP("kit", "k", "", "The kit used to run the 
integration")
        cmd.Flags().StringArrayP("property", "p", nil, "Add a runtime property 
or properties file (syntax: 
[my-key=my-value|file:/path/to/my-conf.properties])")
@@ -817,6 +817,10 @@ func (o *runCmdOptions) skipChecksums() bool {
        return o.RegistryOptions.Get("skipChecksums") == "true"
 }
 
+func (o *runCmdOptions) skipPom() bool {
+       return o.RegistryOptions.Get("skipPOM") == "true"
+}
+
 func (o *runCmdOptions) getTargetPath() string {
        return o.RegistryOptions.Get("targetPath")
 }
@@ -913,9 +917,13 @@ func (o *runCmdOptions) uploadPomFromJar(gav 
maven.Dependency, path string, plat
                        }
                }
                if pomExtracted {
-                       gav.Type = "pom"
-                       // Swallow error as this is not a mandatory step
-                       o.uploadAsMavenArtifact(gav, pomPath, platform, ns, 
options, cmd)
+                       if o.skipPom() {
+                               o.PrintfVerboseOutf(cmd, "Skipping uploading 
extracted POM from %s \n", path)
+                       } else {
+                               gav.Type = "pom"
+                               // Swallow error as this is not a mandatory step
+                               o.uploadAsMavenArtifact(gav, pomPath, platform, 
ns, options, cmd)
+                       }
                }
                return nil
        })

Reply via email to