You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by as...@apache.org on 2021/04/02 10:59:44 UTC

[camel-k] branch master updated (07fb419 -> 2acb950)

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

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


    from 07fb419  Updated CHANGELOG.md
     new eaa290a  doc: Add Maven configuration page
     new e25d59c  chore: Remove Maven configuration section from README
     new 076d31d  doc: Add Maven CA certificates documentation
     new 9156284  test: Remove verbose option from Nexus repository API request
     new c9ee97f  chore: Parse Maven repository name attribute
     new 6182c2f  doc: Complete Maven repository extra attributes
     new 2acb950  test: Assert no dependencies are downloaded from mirrored repository

The 7 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:
 README.adoc                                      |  88 -------------
 docs/modules/ROOT/nav.adoc                       |   1 +
 docs/modules/ROOT/pages/configuration/maven.adoc | 153 +++++++++++++++++++++++
 e2e/common/build/maven_ca_secret_test.go         |  23 ++--
 pkg/util/maven/maven_project.go                  |  11 +-
 5 files changed, 173 insertions(+), 103 deletions(-)
 create mode 100644 docs/modules/ROOT/pages/configuration/maven.adoc

[camel-k] 05/07: chore: Parse Maven repository name attribute

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

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

commit c9ee97f3987deaf194ada2bbdce00828eac23632
Author: Antonin Stefanutti <an...@stefanutti.fr>
AuthorDate: Fri Apr 2 09:29:39 2021 +0200

    chore: Parse Maven repository name attribute
---
 pkg/util/maven/maven_project.go | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/pkg/util/maven/maven_project.go b/pkg/util/maven/maven_project.go
index 068065b..ddf020f 100644
--- a/pkg/util/maven/maven_project.go
+++ b/pkg/util/maven/maven_project.go
@@ -23,7 +23,6 @@ import (
 	"strings"
 )
 
-// NewProject --
 func NewProject() Project {
 	return Project{
 		XMLName:           xml.Name{Local: "project"},
@@ -34,7 +33,6 @@ func NewProject() Project {
 	}
 }
 
-// NewProjectWithGAV --
 func NewProjectWithGAV(group string, artifact string, version string) Project {
 	p := NewProject()
 	p.GroupID = group
@@ -46,7 +44,6 @@ func NewProjectWithGAV(group string, artifact string, version string) Project {
 	return p
 }
 
-// MarshalBytes --
 func (p Project) MarshalBytes() ([]byte, error) {
 	w := &bytes.Buffer{}
 	w.WriteString(xml.Header)
@@ -62,7 +59,6 @@ func (p Project) MarshalBytes() ([]byte, error) {
 	return w.Bytes(), nil
 }
 
-// LookupDependency --
 func (p *Project) LookupDependency(dep Dependency) *Dependency {
 	for i := range p.Dependencies {
 		// Check if the given dependency is already included in the dependency list
@@ -74,7 +70,6 @@ func (p *Project) LookupDependency(dep Dependency) *Dependency {
 	return nil
 }
 
-// ReplaceDependency --
 func (p *Project) ReplaceDependency(dep Dependency) {
 	for i, d := range p.Dependencies {
 		// Check if the given dependency is already included in the dependency list
@@ -118,7 +113,6 @@ func (p *Project) AddEncodedDependencyGAV(gav string) {
 	}
 }
 
-// AddDependencyExclusion --
 func (p *Project) AddDependencyExclusion(dep Dependency, exclusion Exclusion) {
 	if t := p.LookupDependency(dep); t != nil {
 		if t.Exclusions == nil {
@@ -136,7 +130,6 @@ func (p *Project) AddDependencyExclusion(dep Dependency, exclusion Exclusion) {
 	}
 }
 
-// AddDependencyExclusions --
 func (p *Project) AddDependencyExclusions(dep Dependency, exclusions ...Exclusion) {
 	for _, e := range exclusions {
 		p.AddDependencyExclusion(dep, e)
@@ -188,6 +181,8 @@ func NewRepository(repo string) Repository {
 				r.Releases.Enabled = false
 			case strings.HasPrefix(attribute, "id="):
 				r.ID = attribute[3:]
+			case strings.HasPrefix(attribute, "name="):
+				r.Name = attribute[5:]
 			case strings.HasPrefix(attribute, "checksumpolicy="):
 				r.Snapshots.ChecksumPolicy = attribute[15:]
 				r.Releases.ChecksumPolicy = attribute[15:]
@@ -198,7 +193,7 @@ func NewRepository(repo string) Repository {
 	return r
 }
 
-func NewMirror(repo string) Mirror{
+func NewMirror(repo string) Mirror {
 	m := Mirror{}
 	if idx := strings.Index(repo, "@"); idx != -1 {
 		m.URL = repo[:idx]

[camel-k] 04/07: test: Remove verbose option from Nexus repository API request

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

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

commit 9156284e7b48c97b0e8f3a65502b9524a7acd560
Author: Antonin Stefanutti <an...@stefanutti.fr>
AuthorDate: Thu Apr 1 15:56:47 2021 +0200

    test: Remove verbose option from Nexus repository API request
---
 e2e/common/build/maven_ca_secret_test.go | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/e2e/common/build/maven_ca_secret_test.go b/e2e/common/build/maven_ca_secret_test.go
index 13acf7f..67656a3 100644
--- a/e2e/common/build/maven_ca_secret_test.go
+++ b/e2e/common/build/maven_ca_secret_test.go
@@ -38,15 +38,15 @@ import (
 
 	. "github.com/onsi/gomega"
 	. "github.com/onsi/gomega/gstruct"
-	"k8s.io/client-go/kubernetes/scheme"
-	"k8s.io/client-go/tools/remotecommand"
-
-	ctrl "sigs.k8s.io/controller-runtime/pkg/client"
 
 	appsv1 "k8s.io/api/apps/v1"
 	corev1 "k8s.io/api/core/v1"
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 	"k8s.io/apimachinery/pkg/util/intstr"
+	"k8s.io/client-go/kubernetes/scheme"
+	"k8s.io/client-go/tools/remotecommand"
+
+	ctrl "sigs.k8s.io/controller-runtime/pkg/client"
 
 	. "github.com/apache/camel-k/e2e/support"
 	v1 "github.com/apache/camel-k/pkg/apis/camel/v1"
@@ -379,7 +379,7 @@ ProxyPreserveHost On
 
 		req.VersionedParams(&corev1.PodExecOptions{
 			Container: "nexus",
-			Command: []string{"curl", "-v",
+			Command: []string{"curl",
 				"-u", "admin:" + password.String(),
 				"-H", "Content-Type: application/json",
 				"--data", repository,

[camel-k] 06/07: doc: Complete Maven repository extra attributes

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

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

commit 6182c2ff0792c8e5971106b1dde571a81c17120a
Author: Antonin Stefanutti <an...@stefanutti.fr>
AuthorDate: Fri Apr 2 09:30:20 2021 +0200

    doc: Complete Maven repository extra attributes
---
 docs/modules/ROOT/pages/configuration/maven.adoc | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/docs/modules/ROOT/pages/configuration/maven.adoc b/docs/modules/ROOT/pages/configuration/maven.adoc
index fe4c35b..f56775d 100644
--- a/docs/modules/ROOT/pages/configuration/maven.adoc
+++ b/docs/modules/ROOT/pages/configuration/maven.adoc
@@ -59,6 +59,14 @@ The following attributes are supported:
 |===
 |Name |Type |Description
 
+| @id
+| string
+| Sets the repository `id`
+
+| @name
+| string
+| Sets the repository `name`
+
 | @snapshots
 | flag
 | Turns `snapshots.enabled` to `true`
@@ -67,9 +75,13 @@ The following attributes are supported:
 | flag
 | Turns `snapshots.enabled` to `false`
 
-| @id
+| @checksumpolicy
 | string
-| Sets the repository `id`
+| Sets the repository `checksumPolicy`
+
+| @mirrorOf
+| string
+| Declares the repository as a mirror of the repositories with matching ids
 
 |===
 
@@ -100,6 +112,8 @@ Results in generating the following `settings.xml` file:
 
 WARNING: The `--maven-settings` and `--maven-repository` options are mutually exclusive.
 
+You can find more information in the https://maven.apache.org/guides/introduction/introduction-to-repositories.html[Introduction to Repositories] from the Maven documentation.
+
 [[ca-certificates]]
 == CA Certificates
 

[camel-k] 03/07: doc: Add Maven CA certificates documentation

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

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

commit 076d31d2cbd72774030d98c8e53fe7d7a6cdc7da
Author: Antonin Stefanutti <an...@stefanutti.fr>
AuthorDate: Thu Apr 1 15:55:36 2021 +0200

    doc: Add Maven CA certificates documentation
---
 docs/modules/ROOT/pages/configuration/maven.adoc | 40 ++++++++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git a/docs/modules/ROOT/pages/configuration/maven.adoc b/docs/modules/ROOT/pages/configuration/maven.adoc
index 7d34a0a..fe4c35b 100644
--- a/docs/modules/ROOT/pages/configuration/maven.adoc
+++ b/docs/modules/ROOT/pages/configuration/maven.adoc
@@ -49,6 +49,8 @@ In case you only want to configure remote repositories, you can use the `--maven
 $ kamel install --maven-repository <repository_url>
 ----
 
+NOTE: Check the <<ca-certificates>> section, if these remote repositories require custom CA certificates.
+
 Extra attributes can be appended to the `repository_url`, using the `@` separator.
 The following attributes are supported:
 
@@ -97,3 +99,41 @@ Results in generating the following `settings.xml` file:
 ----
 
 WARNING: The `--maven-settings` and `--maven-repository` options are mutually exclusive.
+
+[[ca-certificates]]
+== CA Certificates
+
+The CA certificates, used by the Maven commands to connect to the remote Maven repositories, can be provided in a Secret.
+
+The `kubectl` CLI provides a convenient command, to create a Secret from a file, e.g.:
+
+[source,console]
+----
+$ kubectl create secret generic maven-ca-certs --from-file=ca.crt
+----
+
+The Secret can contain X.509 certificates, and PKCS#7 formatted certificate chains.
+A JKS formatted keystore is automatically created to store the CA certificate(s), and configured to be used as a trusted certificate(s) by the Maven commands.
+The root CA certificates are also imported into the created keystore.
+
+The created Secret can then be referenced in the IntegrationPlatform resource, from the `spec.build.maven.caSecret` field, e.g.:
+[source,yaml]
+----
+apiVersion: camel.apache.org/v1
+kind: IntegrationPlatform
+metadata:
+  name: camel-k
+spec:
+  build:
+    maven:
+      caSecret:
+        key: tls.crt
+        name: tls-secret
+----
+
+Alternatively, the Kamel CLI provides the `--maven-ca-secret` option, with the `install` command, that can be used to configure the Maven CA Secret at installation time, e.g.:
+
+[source,console]
+----
+$ kamel install --maven-ca-secret <secret_name>/<secret_key>
+----

[camel-k] 02/07: chore: Remove Maven configuration section from README

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

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

commit e25d59c0f54e1853249bd8d9f9d186f7c8dbc102
Author: Antonin Stefanutti <an...@stefanutti.fr>
AuthorDate: Thu Apr 1 15:17:04 2021 +0200

    chore: Remove Maven configuration section from README
---
 README.adoc | 88 -------------------------------------------------------------
 1 file changed, 88 deletions(-)

diff --git a/README.adoc b/README.adoc
index d8e61c4..1fe75e7 100644
--- a/README.adoc
+++ b/README.adoc
@@ -167,94 +167,6 @@ As example if you want to change the queue size of the seda component, you can u
 camel.component.seda.queueSize = 10
 ```
 
-==== Configure Maven settings
-
-Maven settings can be configured by providing a custom settings.xml through a ConfigMap or secret.
-The source for maven settings can be configured using either the `kamel` CLI at installation time or by editing Camel K's IntegrationPlatform:
-
-- cli:
-+
-.Syntax
-[source]
-----
-kamel install --maven-settings=configmap|secret:name[/key]
-----
-+
-.Example
-[source]
-----
-kamel cmd --maven-settings=configmap:maven-settings/settings.xml
-----
-
-- IntegrationPlatform:
-+
-[source,yaml]
-----
-apiVersion: camel.apache.org/v1
-kind: IntegrationPlatform
-metadata:
-  labels:
-    app: camel-k
-  name: camel-k
-spec:
-  build:
-    maven:
-      settings:
-        configMapKeyRef:
-          key: settings.xml
-          name: maven-settings
-----
-
-To quickly create a config map you can use the following command:
-
-[source]
-----
-kubectl create configmap maven-settings --from-file=settings.xml
-----
-
-
-As an installation shortcut, additional maven repositories can be alternatively added using the `--maven-repository` option
-
-
-[source]
-----
-kamel cmd --maven-repository http://repo1.my-company.com --maven-repository http://repo2.my-company.com
-----
-
-A repository url follows conventions used to configure additional repositories in https://karaf.apache.org[_Apache Karaf_] so it can be appended with zero or more of the following flags:
-
-* **@snapshots**: the repository contains snapshots
-* **@noreleases**: the repository does not contain any released artifacts
-* **@id=repository.id**: the id for the repository
-
-[source]
-----
-kamel install --maven-repository http://repository.apache.org/content/groups/snapshots-group@id=apache@snapshots@noreleases
-----
-
-This results in:
-
-[source,xml]
-----
-<repositories>
-  <repository>
-    <id>apache</id>
-    <url>http://repository.apache.org/content/groups/snapshots-group</url>
-    <snapshots>
-      <enabled>true</enabled>
-    </snapshots>
-    <releases>
-      <enabled>false</enabled>
-    </releases>
-  </repository>
-</repositories>
-----
-
-IMPORTANT
-====
-the options `--maven-settings` and `--maven-repository` are mutually exclusive
-====
-
 ==== Configure Integration Volumes
 
 It's possible to mount persistent volumes into integration containers by using the `-v` or `--volume` flag. The format of volume flag value is similar to that of the docker CLI. But instead of specifying a host path to mount from, you reference the name of a `PersistentVolumeClaim` that you have already configured within the cluster. E.g

[camel-k] 01/07: doc: Add Maven configuration page

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

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

commit eaa290a2436f43020d42cfab8685d0626cd2270f
Author: Antonin Stefanutti <an...@stefanutti.fr>
AuthorDate: Thu Apr 1 15:15:09 2021 +0200

    doc: Add Maven configuration page
---
 docs/modules/ROOT/nav.adoc                       |  1 +
 docs/modules/ROOT/pages/configuration/maven.adoc | 99 ++++++++++++++++++++++++
 2 files changed, 100 insertions(+)

diff --git a/docs/modules/ROOT/nav.adoc b/docs/modules/ROOT/nav.adoc
index 4961011..ea9558a 100644
--- a/docs/modules/ROOT/nav.adoc
+++ b/docs/modules/ROOT/nav.adoc
@@ -18,6 +18,7 @@
 * xref:cli/cli.adoc[CLI]
 ** xref:cli/modeline.adoc[Modeline]
 * xref:configuration/configuration.adoc[Configuration]
+** xref:configuration/maven.adoc[Maven]
 ** xref:configuration/components.adoc[Components]
 ** xref:configuration/logging.adoc[Logging]
 ** xref:configuration/dependencies.adoc[Dependencies]
diff --git a/docs/modules/ROOT/pages/configuration/maven.adoc b/docs/modules/ROOT/pages/configuration/maven.adoc
new file mode 100644
index 0000000..7d34a0a
--- /dev/null
+++ b/docs/modules/ROOT/pages/configuration/maven.adoc
@@ -0,0 +1,99 @@
+= Configure Maven
+
+== Maven Settings
+
+The Maven settings, used by the Camel K operator, can be provided in a ConfigMap or a Secret.
+
+The `kubectl` CLI provides convenient commands, to create a ConfigMap or a Secret from a file, e.g.:
+
+[source,console]
+----
+$ kubectl create configmap maven-settings --from-file=settings.xml
+----
+
+The created ConfigMap or Secret can then be referenced in the IntegrationPlatform resource, from the `spec.build.maven.settings` field, e.g.:
+
+[source,yaml]
+----
+apiVersion: camel.apache.org/v1
+kind: IntegrationPlatform
+metadata:
+  name: camel-k
+spec:
+  build:
+    maven:
+      settings:
+        configMapKeyRef:
+          key: settings.xml
+          name: maven-settings
+----
+
+The IntegrationPlatform resource can be edited directly, to reference the ConfigMap or the Secret that contains the Maven settings, e.g.:
+
+[source,console]
+----
+$ kubectl edit ip camel-k
+----
+
+Alternatively, the Kamel CLI provides the `--maven-settings` option, with the `install` command, that can be used to configure the Maven settings at installation time, e.g.:
+
+[source,console]
+----
+$ kamel install --maven-settings=configmap|secret:name[/key]
+----
+
+In case you only want to configure remote repositories, you can use the `--maven-repository` option, that automatically generates a `settings.xml` file and relieves from creating a ConfigMap or Secret, e.g.:
+
+[source,console]
+----
+$ kamel install --maven-repository <repository_url>
+----
+
+Extra attributes can be appended to the `repository_url`, using the `@` separator.
+The following attributes are supported:
+
+.Maven Repository Attributes
+[cols="1m,1,2"]
+|===
+|Name |Type |Description
+
+| @snapshots
+| flag
+| Turns `snapshots.enabled` to `true`
+
+| @noreleases
+| flag
+| Turns `snapshots.enabled` to `false`
+
+| @id
+| string
+| Sets the repository `id`
+
+|===
+
+For example, running the following command:
+
+[source,console]
+----
+$ kamel install --maven-repository https://repository.apache.org/content/groups/snapshots-group@id=apache@snapshots@noreleases
+----
+
+Results in generating the following `settings.xml` file:
+
+[source,xml]
+----
+<repositories>
+  <repository>
+    <id>apache</id>
+    <url>http://repository.apache.org/content/groups/snapshots-group</url>
+    <snapshots>
+      <enabled>true</enabled>
+    </snapshots>
+    <releases>
+      <enabled>false</enabled>
+    </releases>
+  </repository>
+</repositories>
+----
+
+WARNING: The `--maven-settings` and `--maven-repository` options are mutually exclusive.

[camel-k] 07/07: test: Assert no dependencies are downloaded from mirrored repository

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

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

commit 2acb9505f89e166170796739d7dd49dd9ea2b465
Author: Antonin Stefanutti <an...@stefanutti.fr>
AuthorDate: Fri Apr 2 10:02:40 2021 +0200

    test: Assert no dependencies are downloaded from mirrored repository
---
 e2e/common/build/maven_ca_secret_test.go | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/e2e/common/build/maven_ca_secret_test.go b/e2e/common/build/maven_ca_secret_test.go
index 67656a3..259592a 100644
--- a/e2e/common/build/maven_ca_secret_test.go
+++ b/e2e/common/build/maven_ca_secret_test.go
@@ -400,8 +400,8 @@ ProxyPreserveHost On
 
 		// Install Camel K with the Maven Central Nexus proxy and the corresponding Maven CA secret
 		Expect(Kamel("install", "-n", ns,
-			"--maven-repository", fmt.Sprintf(`https://%s/repository/maven-public/@id=central`, hostname),
-			"--maven-repository", fmt.Sprintf(`https://%s/repository/apache-snapshots/@id=apache-snapshots@snapshots`, hostname),
+			"--maven-repository", fmt.Sprintf(`https://%s/repository/maven-public/@id=central-internal@mirrorOf=central`, hostname),
+			"--maven-repository", fmt.Sprintf(`https://%s/repository/apache-snapshots/@id=apache-snapshots@snapshots@noreleases`, hostname),
 			"--maven-ca-secret", secret.Name+"/"+corev1.TLSCertKey,
 		).Execute()).To(Succeed())
 
@@ -415,6 +415,15 @@ ProxyPreserveHost On
 		Eventually(IntegrationCondition(ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
 		Eventually(IntegrationLogs(ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
 
+		// Assert no dependencies have been downloaded from the Maven central repository
+		// Note: this should be adapted for the Pod build strategy
+		pod := OperatorPod(ns)()
+		Expect(pod).NotTo(BeNil())
+
+		logs := Logs(ns, pod.Name, corev1.PodLogOptions{})()
+		Expect(logs).NotTo(BeEmpty())
+		Expect(logs).NotTo(ContainSubstring("Downloaded from central:"))
+
 		// Clean up
 		Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
 	})