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/06/02 06:39:51 UTC
[camel-k] branch main updated (89bb6a5 -> f177f70)
This is an automated email from the ASF dual-hosted git repository.
astefanutti pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git.
from 89bb6a5 Updated CHANGELOG.md
new f13ebec fix #2327: Honor maven-repository flag in the run command
new 33c8110 chore #2327: Add E2E test
new f177f70 chore #2327: Use structured Maven Repository
The 3 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:
config/crd/bases/camel.apache.org_builds.yaml | 39 +++++++++++
.../camel.apache.org_integrationplatforms.yaml | 78 ++++++++++++++++++++++
.../1.5.0-snapshot/camel.apache.org_builds.yaml | 39 +++++++++++
.../camel.apache.org_integrationplatforms.yaml | 78 ++++++++++++++++++++++
e2e/common/build/maven_ca_secret_test.go | 2 +-
.../maven_repository_test.go} | 39 +++++------
helm/camel-k/crds/crd-build.yaml | 39 +++++++++++
helm/camel-k/crds/crd-integration-platform.yaml | 78 ++++++++++++++++++++++
pkg/apis/camel/v1/common_types.go | 3 +-
.../camel/v1/maven_types.go} | 26 +++++---
pkg/apis/camel/v1/zz_generated.deepcopy.go | 37 ++++++++++
pkg/builder/quarkus.go | 3 +
pkg/cmd/util_dependencies.go | 2 +-
pkg/platform/defaults.go | 2 +-
pkg/resources/resources.go | 16 +++--
pkg/trait/builder.go | 9 ++-
pkg/util/camel/camel_dependencies.go | 6 +-
pkg/util/maven/maven_project.go | 10 +--
pkg/util/maven/maven_project_test.go | 13 ++--
pkg/util/maven/maven_settings.go | 9 +--
pkg/util/maven/maven_settings_test.go | 13 ++--
pkg/util/maven/maven_types.go | 32 +++------
22 files changed, 484 insertions(+), 89 deletions(-)
copy e2e/common/{structured_logs_test.go => build/maven_repository_test.go} (66%)
copy pkg/{client/camel/clientset/versioned/typed/camel/v1/generated_expansion.go => apis/camel/v1/maven_types.go} (53%)
[camel-k] 02/03: chore #2327: Add E2E test
Posted by as...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
astefanutti pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit 33c8110b40d8077f49f48e606fd76ba317b25bd6
Author: John Poth <po...@gmail.com>
AuthorDate: Tue May 25 16:32:33 2021 +0200
chore #2327: Add E2E test
---
e2e/common/build/maven_repository_test.go | 51 +++++++++++++++++++++++++++++++
1 file changed, 51 insertions(+)
diff --git a/e2e/common/build/maven_repository_test.go b/e2e/common/build/maven_repository_test.go
new file mode 100644
index 0000000..44d5af1
--- /dev/null
+++ b/e2e/common/build/maven_repository_test.go
@@ -0,0 +1,51 @@
+// +build integration
+
+// To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration"
+
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package build
+
+import (
+ "testing"
+
+ . "github.com/onsi/gomega"
+
+ v1 "k8s.io/api/core/v1"
+
+ . "github.com/apache/camel-k/e2e/support"
+ camelv1 "github.com/apache/camel-k/pkg/apis/camel/v1"
+)
+
+func TestRunExtraRepository(t *testing.T) {
+ WithNewTestNamespace(t, func(ns string) {
+ Expect(Kamel("install", "-n", ns).Execute()).To(Succeed())
+
+ name := "java"
+ Expect(Kamel("run", "-n", ns, "files/Java.java",
+ "--maven-repository", "https://maven.repository.redhat.com/ga@id=redhat",
+ "--dependency", "mvn:jakarta.annotation:jakarta.annotation-api:1.3.5.redhat-00002",
+ "--name", name,
+ ).Execute()).To(Succeed())
+
+ Eventually(IntegrationPodPhase(ns, name), TestTimeoutMedium).Should(Equal(v1.PodRunning))
+ Eventually(IntegrationCondition(ns, name, camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue))
+ Eventually(IntegrationLogs(ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+ Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
+ })
+}
[camel-k] 03/03: chore #2327: Use structured Maven Repository
Posted by as...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
astefanutti pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit f177f7052d6042058c63261cb811a91e07f0b8b9
Author: John Poth <po...@gmail.com>
AuthorDate: Tue Jun 1 11:54:53 2021 +0200
chore #2327: Use structured Maven Repository
---
config/crd/bases/camel.apache.org_builds.yaml | 37 +++++++++-
.../camel.apache.org_integrationplatforms.yaml | 78 ++++++++++++++++++++++
.../1.5.0-snapshot/camel.apache.org_builds.yaml | 39 +++++++++++
.../camel.apache.org_integrationplatforms.yaml | 78 ++++++++++++++++++++++
e2e/common/build/maven_ca_secret_test.go | 2 +-
helm/camel-k/crds/crd-build.yaml | 37 +++++++++-
helm/camel-k/crds/crd-integration-platform.yaml | 78 ++++++++++++++++++++++
pkg/apis/camel/v1/common_types.go | 2 +-
pkg/apis/camel/v1/maven_types.go | 34 ++++++++++
pkg/apis/camel/v1/zz_generated.deepcopy.go | 34 +++++++++-
pkg/builder/quarkus.go | 4 +-
pkg/cmd/util_dependencies.go | 2 +-
pkg/platform/defaults.go | 2 +-
pkg/resources/resources.go | 16 +++--
pkg/trait/builder.go | 6 +-
pkg/util/camel/camel_dependencies.go | 6 +-
pkg/util/maven/maven_project.go | 10 +--
pkg/util/maven/maven_project_test.go | 13 ++--
pkg/util/maven/maven_settings.go | 9 +--
pkg/util/maven/maven_settings_test.go | 13 ++--
pkg/util/maven/maven_types.go | 32 +++------
21 files changed, 470 insertions(+), 62 deletions(-)
diff --git a/config/crd/bases/camel.apache.org_builds.yaml b/config/crd/bases/camel.apache.org_builds.yaml
index fcc09a8..c5e6364 100644
--- a/config/crd/bases/camel.apache.org_builds.yaml
+++ b/config/crd/bases/camel.apache.org_builds.yaml
@@ -164,7 +164,42 @@ spec:
type: object
repositories:
items:
- type: string
+ description: Repository --
+ properties:
+ id:
+ type: string
+ name:
+ type: string
+ releases:
+ description: RepositoryPolicy --
+ properties:
+ checksumPolicy:
+ type: string
+ enabled:
+ type: boolean
+ updatePolicy:
+ type: string
+ required:
+ - enabled
+ type: object
+ snapshots:
+ description: RepositoryPolicy --
+ properties:
+ checksumPolicy:
+ type: string
+ enabled:
+ type: boolean
+ updatePolicy:
+ type: string
+ required:
+ - enabled
+ type: object
+ url:
+ type: string
+ required:
+ - id
+ - url
+ type: object
type: array
settings:
description: A reference to the ConfigMap or Secret
diff --git a/config/crd/bases/camel.apache.org_integrationplatforms.yaml b/config/crd/bases/camel.apache.org_integrationplatforms.yaml
index 9282305..9c9779f 100644
--- a/config/crd/bases/camel.apache.org_integrationplatforms.yaml
+++ b/config/crd/bases/camel.apache.org_integrationplatforms.yaml
@@ -113,6 +113,45 @@ spec:
type: string
description: The Maven properties.
type: object
+ repositories:
+ items:
+ description: Repository --
+ properties:
+ id:
+ type: string
+ name:
+ type: string
+ releases:
+ description: RepositoryPolicy --
+ properties:
+ checksumPolicy:
+ type: string
+ enabled:
+ type: boolean
+ updatePolicy:
+ type: string
+ required:
+ - enabled
+ type: object
+ snapshots:
+ description: RepositoryPolicy --
+ properties:
+ checksumPolicy:
+ type: string
+ enabled:
+ type: boolean
+ updatePolicy:
+ type: string
+ required:
+ - enabled
+ type: object
+ url:
+ type: string
+ required:
+ - id
+ - url
+ type: object
+ type: array
settings:
description: A reference to the ConfigMap or Secret key that
contains the Maven settings.
@@ -290,6 +329,45 @@ spec:
type: string
description: The Maven properties.
type: object
+ repositories:
+ items:
+ description: Repository --
+ properties:
+ id:
+ type: string
+ name:
+ type: string
+ releases:
+ description: RepositoryPolicy --
+ properties:
+ checksumPolicy:
+ type: string
+ enabled:
+ type: boolean
+ updatePolicy:
+ type: string
+ required:
+ - enabled
+ type: object
+ snapshots:
+ description: RepositoryPolicy --
+ properties:
+ checksumPolicy:
+ type: string
+ enabled:
+ type: boolean
+ updatePolicy:
+ type: string
+ required:
+ - enabled
+ type: object
+ url:
+ type: string
+ required:
+ - id
+ - url
+ type: object
+ type: array
settings:
description: A reference to the ConfigMap or Secret key that
contains the Maven settings.
diff --git a/deploy/olm-catalog/camel-k-dev/1.5.0-snapshot/camel.apache.org_builds.yaml b/deploy/olm-catalog/camel-k-dev/1.5.0-snapshot/camel.apache.org_builds.yaml
index 09b377e..c5e6364 100644
--- a/deploy/olm-catalog/camel-k-dev/1.5.0-snapshot/camel.apache.org_builds.yaml
+++ b/deploy/olm-catalog/camel-k-dev/1.5.0-snapshot/camel.apache.org_builds.yaml
@@ -162,6 +162,45 @@ spec:
type: string
description: The Maven properties.
type: object
+ repositories:
+ items:
+ description: Repository --
+ properties:
+ id:
+ type: string
+ name:
+ type: string
+ releases:
+ description: RepositoryPolicy --
+ properties:
+ checksumPolicy:
+ type: string
+ enabled:
+ type: boolean
+ updatePolicy:
+ type: string
+ required:
+ - enabled
+ type: object
+ snapshots:
+ description: RepositoryPolicy --
+ properties:
+ checksumPolicy:
+ type: string
+ enabled:
+ type: boolean
+ updatePolicy:
+ type: string
+ required:
+ - enabled
+ type: object
+ url:
+ type: string
+ required:
+ - id
+ - url
+ type: object
+ type: array
settings:
description: A reference to the ConfigMap or Secret
key that contains the Maven settings.
diff --git a/deploy/olm-catalog/camel-k-dev/1.5.0-snapshot/camel.apache.org_integrationplatforms.yaml b/deploy/olm-catalog/camel-k-dev/1.5.0-snapshot/camel.apache.org_integrationplatforms.yaml
index 9282305..9c9779f 100644
--- a/deploy/olm-catalog/camel-k-dev/1.5.0-snapshot/camel.apache.org_integrationplatforms.yaml
+++ b/deploy/olm-catalog/camel-k-dev/1.5.0-snapshot/camel.apache.org_integrationplatforms.yaml
@@ -113,6 +113,45 @@ spec:
type: string
description: The Maven properties.
type: object
+ repositories:
+ items:
+ description: Repository --
+ properties:
+ id:
+ type: string
+ name:
+ type: string
+ releases:
+ description: RepositoryPolicy --
+ properties:
+ checksumPolicy:
+ type: string
+ enabled:
+ type: boolean
+ updatePolicy:
+ type: string
+ required:
+ - enabled
+ type: object
+ snapshots:
+ description: RepositoryPolicy --
+ properties:
+ checksumPolicy:
+ type: string
+ enabled:
+ type: boolean
+ updatePolicy:
+ type: string
+ required:
+ - enabled
+ type: object
+ url:
+ type: string
+ required:
+ - id
+ - url
+ type: object
+ type: array
settings:
description: A reference to the ConfigMap or Secret key that
contains the Maven settings.
@@ -290,6 +329,45 @@ spec:
type: string
description: The Maven properties.
type: object
+ repositories:
+ items:
+ description: Repository --
+ properties:
+ id:
+ type: string
+ name:
+ type: string
+ releases:
+ description: RepositoryPolicy --
+ properties:
+ checksumPolicy:
+ type: string
+ enabled:
+ type: boolean
+ updatePolicy:
+ type: string
+ required:
+ - enabled
+ type: object
+ snapshots:
+ description: RepositoryPolicy --
+ properties:
+ checksumPolicy:
+ type: string
+ enabled:
+ type: boolean
+ updatePolicy:
+ type: string
+ required:
+ - enabled
+ type: object
+ url:
+ type: string
+ required:
+ - id
+ - url
+ type: object
+ type: array
settings:
description: A reference to the ConfigMap or Secret key that
contains the Maven settings.
diff --git a/e2e/common/build/maven_ca_secret_test.go b/e2e/common/build/maven_ca_secret_test.go
index e93798f..25bd761 100644
--- a/e2e/common/build/maven_ca_secret_test.go
+++ b/e2e/common/build/maven_ca_secret_test.go
@@ -453,7 +453,7 @@ ProxyPreserveHost On
})
}
-func getRepositoryAttributes(repository maven.Repository) []string {
+func getRepositoryAttributes(repository v1.Repository) []string {
var attributes []string
if repository.ID != "" {
attributes = append(attributes, "@id="+repository.ID)
diff --git a/helm/camel-k/crds/crd-build.yaml b/helm/camel-k/crds/crd-build.yaml
index fcc09a8..c5e6364 100644
--- a/helm/camel-k/crds/crd-build.yaml
+++ b/helm/camel-k/crds/crd-build.yaml
@@ -164,7 +164,42 @@ spec:
type: object
repositories:
items:
- type: string
+ description: Repository --
+ properties:
+ id:
+ type: string
+ name:
+ type: string
+ releases:
+ description: RepositoryPolicy --
+ properties:
+ checksumPolicy:
+ type: string
+ enabled:
+ type: boolean
+ updatePolicy:
+ type: string
+ required:
+ - enabled
+ type: object
+ snapshots:
+ description: RepositoryPolicy --
+ properties:
+ checksumPolicy:
+ type: string
+ enabled:
+ type: boolean
+ updatePolicy:
+ type: string
+ required:
+ - enabled
+ type: object
+ url:
+ type: string
+ required:
+ - id
+ - url
+ type: object
type: array
settings:
description: A reference to the ConfigMap or Secret
diff --git a/helm/camel-k/crds/crd-integration-platform.yaml b/helm/camel-k/crds/crd-integration-platform.yaml
index 9282305..9c9779f 100644
--- a/helm/camel-k/crds/crd-integration-platform.yaml
+++ b/helm/camel-k/crds/crd-integration-platform.yaml
@@ -113,6 +113,45 @@ spec:
type: string
description: The Maven properties.
type: object
+ repositories:
+ items:
+ description: Repository --
+ properties:
+ id:
+ type: string
+ name:
+ type: string
+ releases:
+ description: RepositoryPolicy --
+ properties:
+ checksumPolicy:
+ type: string
+ enabled:
+ type: boolean
+ updatePolicy:
+ type: string
+ required:
+ - enabled
+ type: object
+ snapshots:
+ description: RepositoryPolicy --
+ properties:
+ checksumPolicy:
+ type: string
+ enabled:
+ type: boolean
+ updatePolicy:
+ type: string
+ required:
+ - enabled
+ type: object
+ url:
+ type: string
+ required:
+ - id
+ - url
+ type: object
+ type: array
settings:
description: A reference to the ConfigMap or Secret key that
contains the Maven settings.
@@ -290,6 +329,45 @@ spec:
type: string
description: The Maven properties.
type: object
+ repositories:
+ items:
+ description: Repository --
+ properties:
+ id:
+ type: string
+ name:
+ type: string
+ releases:
+ description: RepositoryPolicy --
+ properties:
+ checksumPolicy:
+ type: string
+ enabled:
+ type: boolean
+ updatePolicy:
+ type: string
+ required:
+ - enabled
+ type: object
+ snapshots:
+ description: RepositoryPolicy --
+ properties:
+ checksumPolicy:
+ type: string
+ enabled:
+ type: boolean
+ updatePolicy:
+ type: string
+ required:
+ - enabled
+ type: object
+ url:
+ type: string
+ required:
+ - id
+ - url
+ type: object
+ type: array
settings:
description: A reference to the ConfigMap or Secret key that
contains the Maven settings.
diff --git a/pkg/apis/camel/v1/common_types.go b/pkg/apis/camel/v1/common_types.go
index 430a6e3..2bcc733 100644
--- a/pkg/apis/camel/v1/common_types.go
+++ b/pkg/apis/camel/v1/common_types.go
@@ -104,7 +104,7 @@ type MavenSpec struct {
CASecret *corev1.SecretKeySelector `json:"caSecret,omitempty"`
// Deprecated: use IntegrationPlatform.Spec.Build.Timeout instead
Timeout *metav1.Duration `json:"timeout,omitempty"`
- Repositories []string `json:"repositories,omitempty"`
+ Repositories []Repository `json:"repositories,omitempty"`
}
// ValueSource --
diff --git a/pkg/apis/camel/v1/maven_types.go b/pkg/apis/camel/v1/maven_types.go
new file mode 100644
index 0000000..426f113
--- /dev/null
+++ b/pkg/apis/camel/v1/maven_types.go
@@ -0,0 +1,34 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package v1
+
+// Repository --
+type Repository struct {
+ ID string `xml:"id" json:"id"`
+ Name string `xml:"name,omitempty" json:"name,omitempty"`
+ URL string `xml:"url" json:"url"`
+ Snapshots RepositoryPolicy `xml:"snapshots,omitempty" json:"snapshots,omitempty"`
+ Releases RepositoryPolicy `xml:"releases,omitempty" json:"releases,omitempty"`
+}
+
+// RepositoryPolicy --
+type RepositoryPolicy struct {
+ Enabled bool `xml:"enabled" json:"enabled"`
+ UpdatePolicy string `xml:"updatePolicy,omitempty" json:"updatePolicy,omitempty"`
+ ChecksumPolicy string `xml:"checksumPolicy,omitempty" json:"checksumPolicy,omitempty"`
+}
diff --git a/pkg/apis/camel/v1/zz_generated.deepcopy.go b/pkg/apis/camel/v1/zz_generated.deepcopy.go
index 4a1a040..0eb99d1 100644
--- a/pkg/apis/camel/v1/zz_generated.deepcopy.go
+++ b/pkg/apis/camel/v1/zz_generated.deepcopy.go
@@ -1274,7 +1274,7 @@ func (in *MavenSpec) DeepCopyInto(out *MavenSpec) {
}
if in.Repositories != nil {
in, out := &in.Repositories, &out.Repositories
- *out = make([]string, len(*in))
+ *out = make([]Repository, len(*in))
copy(*out, *in)
}
}
@@ -1408,6 +1408,38 @@ func (in RawMessage) DeepCopy() RawMessage {
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *Repository) DeepCopyInto(out *Repository) {
+ *out = *in
+ out.Snapshots = in.Snapshots
+ out.Releases = in.Releases
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Repository.
+func (in *Repository) DeepCopy() *Repository {
+ if in == nil {
+ return nil
+ }
+ out := new(Repository)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *RepositoryPolicy) DeepCopyInto(out *RepositoryPolicy) {
+ *out = *in
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RepositoryPolicy.
+func (in *RepositoryPolicy) DeepCopy() *RepositoryPolicy {
+ if in == nil {
+ return nil
+ }
+ out := new(RepositoryPolicy)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ResourceSpec) DeepCopyInto(out *ResourceSpec) {
*out = *in
in.DataSpec.DeepCopyInto(&out.DataSpec)
diff --git a/pkg/builder/quarkus.go b/pkg/builder/quarkus.go
index 0b4651d..8b7d0c3 100644
--- a/pkg/builder/quarkus.go
+++ b/pkg/builder/quarkus.go
@@ -82,9 +82,7 @@ func generateQuarkusProject(ctx *builderContext) error {
p.Properties.AddAll(ctx.Build.Maven.Properties)
// Add Maven repositories
- for _, repo := range ctx.Build.Maven.Repositories {
- p.Repositories = append(p.Repositories, maven.NewRepository(repo))
- }
+ p.Repositories = append(p.Repositories, ctx.Build.Maven.Repositories...)
ctx.Maven.Project = p
diff --git a/pkg/cmd/util_dependencies.go b/pkg/cmd/util_dependencies.go
index ac6f159..dc7bede 100644
--- a/pkg/cmd/util_dependencies.go
+++ b/pkg/cmd/util_dependencies.go
@@ -126,7 +126,7 @@ func getTransitiveDependencies(
mc.Timeout = mvn.GetTimeout().Duration
if len(repositories) > 0 {
- var repoList []maven.Repository
+ var repoList []v1.Repository
var mirrors []maven.Mirror
for i, repo := range repositories {
if strings.Contains(repo, "@mirrorOf=") {
diff --git a/pkg/platform/defaults.go b/pkg/platform/defaults.go
index 02264e2..2d7c15d 100644
--- a/pkg/platform/defaults.go
+++ b/pkg/platform/defaults.go
@@ -203,7 +203,7 @@ func setPlatformDefaults(ctx context.Context, c client.Client, p *v1.Integration
}
if p.Status.Build.Maven.Settings.ConfigMapKeyRef == nil && p.Status.Build.Maven.Settings.SecretKeyRef == nil {
- var repositories []maven.Repository
+ var repositories []v1.Repository
var mirrors []maven.Mirror
for i, c := range p.Status.Configuration {
if c.Type == "repository" {
diff --git a/pkg/resources/resources.go b/pkg/resources/resources.go
index 411629e..799abfb 100644
--- a/pkg/resources/resources.go
+++ b/pkg/resources/resources.go
@@ -78,9 +78,9 @@ var assets = func() http.FileSystem {
"/crd/bases/camel.apache.org_builds.yaml": &vfsgen۰CompressedFileInfo{
name: "camel.apache.org_builds.yaml",
modTime: time.Time{},
- uncompressedSize: 23479,
+ uncompressedSize: 25360,
- compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x3c\x5d\x73\xdb\x3a\x76\xef\xfa\x15\x67\xe2\x87\x24\x33\x16\x95\xdc\xdd\x6d\x6f\xd5\x87\x8e\x56\x4e\xa6\x6a\x12\xdb\x63\x29\x77\xbb\x8f\x47\xe4\x11\x85\x2b\x12\x60\x01\xd0\xb2\x6e\xa7\xff\xbd\x03\x80\x94\x28\x8b\x1f\xa0\xad\xdc\xeb\x76\x8d\x97\xc4\x14\x70\x70\xbe\x70\xbe\xf0\x71\x01\xc3\xf3\xb5\xc1\x05\x7c\x65\x21\x71\x45\x11\x68\x01\x7a\x4d\x30\xc9\x30\x5c\x13\xcc\xc5\x4a\x6f\x51\x12\x7c\x16\x39\x8f\x50\x33\xc1\x [...]
+ compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x3c\x5d\x73\xdb\x3a\x76\xef\xfa\x15\x67\xe2\x87\x24\x33\x16\x75\xef\xdd\xdd\xf6\x56\x7d\xe8\x68\x95\x64\xaa\x26\xb1\x3d\x96\x72\xb7\xfb\x78\x44\x1e\x51\x58\x91\x00\x0b\x80\x96\xb5\x9d\xfe\xf7\x0e\x00\x52\xa2\x24\x7e\x80\xb6\xbc\xeb\x76\x8d\x97\xc4\x14\x70\x70\xbe\x70\xbe\xf0\x71\x05\xc3\xcb\xb5\xc1\x15\x7c\x63\x21\x71\x45\x11\x68\x01\x7a\x4d\x30\xc9\x30\x5c\x13\xcc\xc5\x4a\x6f\x51\x12\x7c\x11\x39\x8f\x50\x33\xc1\x [...]
},
"/crd/bases/camel.apache.org_camelcatalogs.yaml": &vfsgen۰CompressedFileInfo{
name: "camel.apache.org_camelcatalogs.yaml",
@@ -99,9 +99,9 @@ var assets = func() http.FileSystem {
"/crd/bases/camel.apache.org_integrationplatforms.yaml": &vfsgen۰CompressedFileInfo{
name: "camel.apache.org_integrationplatforms.yaml",
modTime: time.Time{},
- uncompressedSize: 20632,
+ uncompressedSize: 23926,
- compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x5c\xdf\x93\xdb\xb6\xf1\x7f\xd7\x5f\xb1\x63\x3d\x38\x99\x39\x51\xc9\xf7\xdb\x4e\x5b\xf5\xa1\x73\x91\xed\xa9\x6a\xfb\xee\xe6\x24\x27\xcd\x23\x44\xae\x24\x44\x20\xc0\x02\xe0\xc9\x4a\xa7\xff\x7b\x67\x17\xa4\x44\x9d\x48\x8a\x77\xe7\x4c\x3d\x19\xf2\xc5\x3e\x11\x58\xec\xcf\xcf\x2e\x80\x95\x86\x30\xfa\x72\xcf\x60\x08\x1f\x64\x8c\xda\x61\x02\xde\x80\xdf\x20\x5c\x67\x22\xde\x20\xcc\xcd\xca\xef\x84\x45\x78\x67\x72\x9d\x08\x [...]
+ compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x3c\x5b\x93\xdb\xb6\xd5\xef\xfa\x15\x67\xac\x07\x27\x33\x2b\x2a\xf9\xbe\x76\xda\xaa\x0f\x1d\x45\xb6\xa7\xaa\xed\xdd\x9d\x95\x9c\x34\x8f\x10\x79\x44\x21\x02\x01\x16\x00\x57\x56\x3a\xfd\xef\x9d\x03\x90\x12\x25\xf1\xa6\xdd\xcd\xd4\x13\x13\x2f\xbb\x22\x81\x83\x73\xbf\x00\x67\x38\x84\xd1\xcb\x8d\xc1\x10\x3e\xf0\x10\xa5\xc1\x08\xac\x02\xbb\x41\x98\xa6\x2c\xdc\x20\x2c\xd4\xda\xee\x98\x46\x78\xa7\x32\x19\x31\xcb\x95\x84\x [...]
},
"/crd/bases/camel.apache.org_integrations.yaml": &vfsgen۰CompressedFileInfo{
name: "camel.apache.org_integrations.yaml",
@@ -457,6 +457,13 @@ var assets = func() http.FileSystem {
compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x44\x8e\x31\x4e\x04\x31\x0c\x45\xfb\x9c\xe2\x2b\xdb\x32\xd2\xd0\x5a\xa2\xa2\x41\xe2\x00\xd4\x66\xd7\x33\x44\x24\x71\xe4\x38\x12\x73\x7b\x94\x1d\xc1\xba\xfc\x7e\xf6\x7f\x17\x5c\xb9\x48\x5e\xbe\x09\x99\xeb\x3e\x78\x97\x97\x83\x4b\x0e\xe1\x82\x0f\x4b\x2e\x38\x74\x18\x4c\x87\x4b\xc7\x97\x98\x3c\x61\x53\x83\xfc\x70\x69\x59\x28\x2c\xd8\x4c\x0b\x05\x00\x18\x96\x08\xd1\x53\x11\xa3\xf9\x24\xde\xd3\xc6\xc6\x45\x5c\xac\x9f\x14\x [...]
},
+ "/camel-catalog-1.6.0-SNAPSHOT.yaml": &vfsgen۰CompressedFileInfo{
+ name: "camel-catalog-1.6.0-SNAPSHOT.yaml",
+ modTime: time.Time{},
+ uncompressedSize: 88553,
+
+ compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xc4\x7d\x4b\x77\xdb\xb8\xb2\xee\x3c\xbf\x82\xab\x33\x39\x67\xdd\xad\xda\xdd\xc9\xd9\xdd\x77\xe7\x8e\x6c\xf9\x11\x3b\x96\xe3\x44\xde\x49\xba\x27\xbd\x20\x12\x92\x60\x91\x04\x0d\x80\xb2\x9d\x5f\x7f\x17\x40\xf0\x29\xb9\x28\xd2\x80\x8f\x07\x26\x29\x14\xbe\x02\x0a\xef\x42\xa1\xf0\x36\x98\xb8\xfb\x7b\xf3\x36\xb8\x62\x21\x4d\x25\x8d\x02\xc5\x03\xb5\xa6\xc1\x51\x46\xc2\x35\x0d\xe6\x7c\xa9\x1e\x88\xa0\xc1\x19\xcf\xd3\x88\x28\x [...]
+ },
"/camel-catalog-1.7.0.yaml": &vfsgen۰CompressedFileInfo{
name: "camel-catalog-1.7.0.yaml",
modTime: time.Time{},
@@ -474,6 +481,7 @@ var assets = func() http.FileSystem {
}
fs["/"].(*vfsgen۰DirInfo).entries = []os.FileInfo{
fs["/addons"].(os.FileInfo),
+ fs["/camel-catalog-1.6.0-SNAPSHOT.yaml"].(os.FileInfo),
fs["/camel-catalog-1.7.0.yaml"].(os.FileInfo),
fs["/crd"].(os.FileInfo),
fs["/default"].(os.FileInfo),
diff --git a/pkg/trait/builder.go b/pkg/trait/builder.go
index 959fccd..a7e354a 100644
--- a/pkg/trait/builder.go
+++ b/pkg/trait/builder.go
@@ -26,6 +26,7 @@ import (
v1 "github.com/apache/camel-k/pkg/apis/camel/v1"
"github.com/apache/camel-k/pkg/builder"
+ mvn "github.com/apache/camel-k/pkg/util/maven"
)
// The builder trait is internally used to determine the best strategy to
@@ -137,8 +138,9 @@ func (t *builderTrait) builderTask(e *Environment) (*v1.BuilderTask, error) {
maven := e.Platform.Status.Build.Maven
// Add Maven repositories defined in the IntergrationKit
- maven.Repositories = append(maven.Repositories, e.IntegrationKit.Spec.Repositories...)
-
+ for _, repo := range e.IntegrationKit.Spec.Repositories {
+ maven.Repositories = append(maven.Repositories, mvn.NewRepository(repo))
+ }
task := &v1.BuilderTask{
BaseTask: v1.BaseTask{
Name: "builder",
diff --git a/pkg/util/camel/camel_dependencies.go b/pkg/util/camel/camel_dependencies.go
index 411cb33..9f2c439 100644
--- a/pkg/util/camel/camel_dependencies.go
+++ b/pkg/util/camel/camel_dependencies.go
@@ -101,14 +101,14 @@ func ManageIntegrationDependencies(
}
}
if addRepo {
- project.Repositories = append(project.Repositories, maven.Repository{
+ project.Repositories = append(project.Repositories, v1.Repository{
ID: "jitpack.io-" + xid.New().String(),
URL: jitpack.RepoURL,
- Releases: maven.RepositoryPolicy{
+ Releases: v1.RepositoryPolicy{
Enabled: true,
ChecksumPolicy: "fail",
},
- Snapshots: maven.RepositoryPolicy{
+ Snapshots: v1.RepositoryPolicy{
Enabled: true,
ChecksumPolicy: "fail",
},
diff --git a/pkg/util/maven/maven_project.go b/pkg/util/maven/maven_project.go
index ddf020f..bcc461e 100644
--- a/pkg/util/maven/maven_project.go
+++ b/pkg/util/maven/maven_project.go
@@ -21,6 +21,8 @@ import (
"bytes"
"encoding/xml"
"strings"
+
+ v1 "github.com/apache/camel-k/pkg/apis/camel/v1"
)
func NewProject() Project {
@@ -157,14 +159,14 @@ func NewDependency(groupID string, artifactID string, version string) Dependency
//
// Will enable snapshots and sets the repo it to my-repo
//
-func NewRepository(repo string) Repository {
- r := Repository{
+func NewRepository(repo string) v1.Repository {
+ r := v1.Repository{
URL: repo,
- Releases: RepositoryPolicy{
+ Releases: v1.RepositoryPolicy{
Enabled: true,
ChecksumPolicy: "fail",
},
- Snapshots: RepositoryPolicy{
+ Snapshots: v1.RepositoryPolicy{
Enabled: false,
ChecksumPolicy: "fail",
},
diff --git a/pkg/util/maven/maven_project_test.go b/pkg/util/maven/maven_project_test.go
index 9780393..595bc58 100644
--- a/pkg/util/maven/maven_project_test.go
+++ b/pkg/util/maven/maven_project_test.go
@@ -20,6 +20,7 @@ package maven
import (
"testing"
+ v1 "github.com/apache/camel-k/pkg/apis/camel/v1"
"github.com/apache/camel-k/pkg/util"
"github.com/stretchr/testify/assert"
@@ -101,27 +102,27 @@ func TestPomGeneration(t *testing.T) {
Version: "1.0.0",
},
}
- project.Repositories = []Repository{
+ project.Repositories = []v1.Repository{
{
ID: "central",
URL: "https://repo.maven.apache.org/maven2",
- Snapshots: RepositoryPolicy{
+ Snapshots: v1.RepositoryPolicy{
Enabled: false,
},
- Releases: RepositoryPolicy{
+ Releases: v1.RepositoryPolicy{
Enabled: true,
UpdatePolicy: "never",
},
},
}
- project.PluginRepositories = []Repository{
+ project.PluginRepositories = []v1.Repository{
{
ID: "central",
URL: "https://repo.maven.apache.org/maven2",
- Snapshots: RepositoryPolicy{
+ Snapshots: v1.RepositoryPolicy{
Enabled: false,
},
- Releases: RepositoryPolicy{
+ Releases: v1.RepositoryPolicy{
Enabled: true,
UpdatePolicy: "never",
},
diff --git a/pkg/util/maven/maven_settings.go b/pkg/util/maven/maven_settings.go
index a1bac60..a9cfab1 100644
--- a/pkg/util/maven/maven_settings.go
+++ b/pkg/util/maven/maven_settings.go
@@ -24,6 +24,7 @@ import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+ v1 "github.com/apache/camel-k/pkg/apis/camel/v1"
"github.com/apache/camel-k/pkg/util"
)
@@ -40,10 +41,10 @@ func NewSettings() Settings {
}
}
-func NewDefaultSettings(repositories []Repository, mirrors []Mirror) Settings {
+func NewDefaultSettings(repositories []v1.Repository, mirrors []Mirror) Settings {
settings := NewSettings()
- var additionalRepos []Repository
+ var additionalRepos []v1.Repository
for _, defaultRepo := range defaultMavenRepositories() {
if !containsRepo(repositories, defaultRepo.ID) {
additionalRepos = append(additionalRepos, defaultRepo)
@@ -95,14 +96,14 @@ func SettingsConfigMap(namespace string, name string, settings Settings) (*corev
return cm, nil
}
-func defaultMavenRepositories() (repos []Repository) {
+func defaultMavenRepositories() (repos []v1.Repository) {
for _, repoDesc := range strings.Split(DefaultMavenRepositories, ",") {
repos = append(repos, NewRepository(repoDesc))
}
return
}
-func containsRepo(repositories []Repository, id string) bool {
+func containsRepo(repositories []v1.Repository, id string) bool {
for _, r := range repositories {
if r.ID == id {
return true
diff --git a/pkg/util/maven/maven_settings_test.go b/pkg/util/maven/maven_settings_test.go
index aa8b010..a6b6a6a 100644
--- a/pkg/util/maven/maven_settings_test.go
+++ b/pkg/util/maven/maven_settings_test.go
@@ -22,6 +22,7 @@ import (
"github.com/stretchr/testify/assert"
+ v1 "github.com/apache/camel-k/pkg/apis/camel/v1"
"github.com/apache/camel-k/pkg/util"
)
@@ -181,15 +182,15 @@ func TestSettingsGeneration(t *testing.T) {
Activation: Activation{
ActiveByDefault: true,
},
- Repositories: []Repository{
+ Repositories: []v1.Repository{
{
ID: "central",
URL: "https://repo.maven.apache.org/maven2",
- Snapshots: RepositoryPolicy{
+ Snapshots: v1.RepositoryPolicy{
Enabled: false,
ChecksumPolicy: "warn",
},
- Releases: RepositoryPolicy{
+ Releases: v1.RepositoryPolicy{
Enabled: true,
UpdatePolicy: "never",
ChecksumPolicy: "fail",
@@ -208,7 +209,7 @@ func TestSettingsGeneration(t *testing.T) {
}
func TestDefaultSettingsGeneration(t *testing.T) {
- settings := NewDefaultSettings([]Repository{}, []Mirror{})
+ settings := NewDefaultSettings([]v1.Repository{}, []Mirror{})
content, err := util.EncodeXML(settings)
@@ -219,7 +220,7 @@ func TestDefaultSettingsGeneration(t *testing.T) {
}
func TestDefaultSettingsGenerationWithAdditionalRepo(t *testing.T) {
- repositories := []Repository{
+ repositories := []v1.Repository{
NewRepository("https://repo1.maven.org/maven2@id=central"),
NewRepository("https://foo.bar.org/repo@id=foo"),
}
@@ -237,7 +238,7 @@ func TestDefaultSettingsGenerationWithAdditionalRepo(t *testing.T) {
}
func TestCreateSettingsConfigMap(t *testing.T) {
- settings := NewDefaultSettings([]Repository{}, []Mirror{})
+ settings := NewDefaultSettings([]v1.Repository{}, []Mirror{})
configMap, err := SettingsConfigMap("foo", "bar", settings)
assert.Nil(t, err)
diff --git a/pkg/util/maven/maven_types.go b/pkg/util/maven/maven_types.go
index 3bac740..c99742c 100644
--- a/pkg/util/maven/maven_types.go
+++ b/pkg/util/maven/maven_types.go
@@ -23,23 +23,9 @@ import (
"fmt"
"io"
"time"
-)
-
-// Repository --
-type Repository struct {
- ID string `xml:"id"`
- Name string `xml:"name,omitempty"`
- URL string `xml:"url"`
- Snapshots RepositoryPolicy `xml:"snapshots,omitempty"`
- Releases RepositoryPolicy `xml:"releases,omitempty"`
-}
-// RepositoryPolicy --
-type RepositoryPolicy struct {
- Enabled bool `xml:"enabled"`
- UpdatePolicy string `xml:"updatePolicy,omitempty"`
- ChecksumPolicy string `xml:"checksumPolicy,omitempty"`
-}
+ v1 "github.com/apache/camel-k/pkg/apis/camel/v1"
+)
// Mirror --
type Mirror struct {
@@ -198,8 +184,8 @@ type Project struct {
Properties Properties `xml:"properties,omitempty"`
DependencyManagement *DependencyManagement `xml:"dependencyManagement"`
Dependencies []Dependency `xml:"dependencies>dependency,omitempty"`
- Repositories []Repository `xml:"repositories>repository,omitempty"`
- PluginRepositories []Repository `xml:"pluginRepositories>pluginRepository,omitempty"`
+ Repositories []v1.Repository `xml:"repositories>repository,omitempty"`
+ PluginRepositories []v1.Repository `xml:"pluginRepositories>pluginRepository,omitempty"`
Build *Build `xml:"build,omitempty"`
}
@@ -227,11 +213,11 @@ type Dependency struct {
// Profile --
type Profile struct {
- ID string `xml:"id"`
- Activation Activation `xml:"activation,omitempty"`
- Properties Properties `xml:"properties,omitempty"`
- Repositories []Repository `xml:"repositories>repository,omitempty"`
- PluginRepositories []Repository `xml:"pluginRepositories>pluginRepository,omitempty"`
+ ID string `xml:"id"`
+ Activation Activation `xml:"activation,omitempty"`
+ Properties Properties `xml:"properties,omitempty"`
+ Repositories []v1.Repository `xml:"repositories>repository,omitempty"`
+ PluginRepositories []v1.Repository `xml:"pluginRepositories>pluginRepository,omitempty"`
}
// Activation --
[camel-k] 01/03: fix #2327: Honor maven-repository flag in the run
command
Posted by as...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
astefanutti pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit f13ebec127dba728f84adec06fe6e90e91cefb53
Author: John Poth <po...@gmail.com>
AuthorDate: Tue May 25 16:31:15 2021 +0200
fix #2327: Honor maven-repository flag in the run command
---
config/crd/bases/camel.apache.org_builds.yaml | 4 ++++
helm/camel-k/crds/crd-build.yaml | 4 ++++
pkg/apis/camel/v1/common_types.go | 3 ++-
pkg/apis/camel/v1/zz_generated.deepcopy.go | 5 +++++
pkg/builder/quarkus.go | 5 +++++
pkg/trait/builder.go | 7 ++++++-
6 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/config/crd/bases/camel.apache.org_builds.yaml b/config/crd/bases/camel.apache.org_builds.yaml
index 09b377e..fcc09a8 100644
--- a/config/crd/bases/camel.apache.org_builds.yaml
+++ b/config/crd/bases/camel.apache.org_builds.yaml
@@ -162,6 +162,10 @@ spec:
type: string
description: The Maven properties.
type: object
+ repositories:
+ items:
+ type: string
+ type: array
settings:
description: A reference to the ConfigMap or Secret
key that contains the Maven settings.
diff --git a/helm/camel-k/crds/crd-build.yaml b/helm/camel-k/crds/crd-build.yaml
index 09b377e..fcc09a8 100644
--- a/helm/camel-k/crds/crd-build.yaml
+++ b/helm/camel-k/crds/crd-build.yaml
@@ -162,6 +162,10 @@ spec:
type: string
description: The Maven properties.
type: object
+ repositories:
+ items:
+ type: string
+ type: array
settings:
description: A reference to the ConfigMap or Secret
key that contains the Maven settings.
diff --git a/pkg/apis/camel/v1/common_types.go b/pkg/apis/camel/v1/common_types.go
index ac83542..430a6e3 100644
--- a/pkg/apis/camel/v1/common_types.go
+++ b/pkg/apis/camel/v1/common_types.go
@@ -103,7 +103,8 @@ type MavenSpec struct {
// Note that the root CA certificates are also imported into the created keystore.
CASecret *corev1.SecretKeySelector `json:"caSecret,omitempty"`
// Deprecated: use IntegrationPlatform.Spec.Build.Timeout instead
- Timeout *metav1.Duration `json:"timeout,omitempty"`
+ Timeout *metav1.Duration `json:"timeout,omitempty"`
+ Repositories []string `json:"repositories,omitempty"`
}
// ValueSource --
diff --git a/pkg/apis/camel/v1/zz_generated.deepcopy.go b/pkg/apis/camel/v1/zz_generated.deepcopy.go
index 270d0fe..4a1a040 100644
--- a/pkg/apis/camel/v1/zz_generated.deepcopy.go
+++ b/pkg/apis/camel/v1/zz_generated.deepcopy.go
@@ -1272,6 +1272,11 @@ func (in *MavenSpec) DeepCopyInto(out *MavenSpec) {
*out = new(metav1.Duration)
**out = **in
}
+ if in.Repositories != nil {
+ in, out := &in.Repositories, &out.Repositories
+ *out = make([]string, len(*in))
+ copy(*out, *in)
+ }
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MavenSpec.
diff --git a/pkg/builder/quarkus.go b/pkg/builder/quarkus.go
index 4678be5..0b4651d 100644
--- a/pkg/builder/quarkus.go
+++ b/pkg/builder/quarkus.go
@@ -81,6 +81,11 @@ func generateQuarkusProject(ctx *builderContext) error {
// Add all the properties from the build configuration
p.Properties.AddAll(ctx.Build.Maven.Properties)
+ // Add Maven repositories
+ for _, repo := range ctx.Build.Maven.Repositories {
+ p.Repositories = append(p.Repositories, maven.NewRepository(repo))
+ }
+
ctx.Maven.Project = p
return nil
diff --git a/pkg/trait/builder.go b/pkg/trait/builder.go
index ba8e26f..959fccd 100644
--- a/pkg/trait/builder.go
+++ b/pkg/trait/builder.go
@@ -134,13 +134,18 @@ func (t *builderTrait) Apply(e *Environment) error {
}
func (t *builderTrait) builderTask(e *Environment) (*v1.BuilderTask, error) {
+ maven := e.Platform.Status.Build.Maven
+
+ // Add Maven repositories defined in the IntergrationKit
+ maven.Repositories = append(maven.Repositories, e.IntegrationKit.Spec.Repositories...)
+
task := &v1.BuilderTask{
BaseTask: v1.BaseTask{
Name: "builder",
},
Runtime: e.CamelCatalog.Runtime,
Dependencies: e.IntegrationKit.Spec.Dependencies,
- Maven: e.Platform.Status.Build.Maven,
+ Maven: maven,
}
if task.Maven.Properties == nil {