osdir.com

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GitHub] nicolaferraro closed pull request #296: Platform options


nicolaferraro closed pull request #296: Platform options 
URL: https://github.com/apache/camel-k/pull/296
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/README.adoc b/README.adoc
index 91790ec1..ce552170 100644
--- a/README.adoc
+++ b/README.adoc
@@ -87,6 +87,50 @@ As example if you want to change the queue size of the seda component, you can u
 camel.component.seda.queueSize = 10
 ```
 
+==== Configure additional maven repositories
+
+Additional maven repositories can be defined at platform installation time or at integration/context build time:
+
+
+[source]
+----
+kamel cmd --repository http://repo1.my-company.com --repository http://repo2.my-company.com
+----
+
+A repository url follow conventions used to configuire 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 --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>
+----
+
+[NOTE]
+====
+The final repositories list is the sum of the repositories defined on the resource (integration/context) and the platform ones
+====
+
 === Running Integrations in "Dev" Mode for Fast Feedback
 
 If you want to iterate quickly on an integration to have fast feedback on the code you're writing, you can use by running it in **"dev" mode**:
diff --git a/deploy/platform-cr.yaml b/deploy/platform-cr.yaml
index cdf13ffb..de8aea7c 100644
--- a/deploy/platform-cr.yaml
+++ b/deploy/platform-cr.yaml
@@ -4,3 +4,6 @@ metadata:
   name: camel-k
   labels:
     app: "camel-k"
+spec:
+  build:
+    camelVersion: "2.23.0"
diff --git a/deploy/resources.go b/deploy/resources.go
index c51949f9..f1ab3815 100644
--- a/deploy/resources.go
+++ b/deploy/resources.go
@@ -2694,6 +2694,9 @@ metadata:
   name: camel-k
   labels:
     app: "camel-k"
+spec:
+  build:
+    camelVersion: "2.23.0"
 
 `
 	Resources["platform-integration-context-groovy.yaml"] =
diff --git a/pkg/apis/camel/v1alpha1/types.go b/pkg/apis/camel/v1alpha1/types.go
index 813c2b61..8965778a 100644
--- a/pkg/apis/camel/v1alpha1/types.go
+++ b/pkg/apis/camel/v1alpha1/types.go
@@ -289,6 +289,9 @@ type IntegrationPlatformBuildSpec struct {
 	Registry        string                                  `json:"registry,omitempty"`
 	Organization    string                                  `json:"organization,omitempty"`
 	PushSecret      string                                  `json:"pushSecret,omitempty"`
+	CamelVersion    string                                  `json:"camelVersion,omitempty"`
+	Properties      map[string]string                       `json:"properties,omitempty"`
+	Repositories    []string                                `json:"repositories,omitempty"`
 }
 
 // IntegrationPlatformBuildPublishStrategy enumerates all implemented build strategies
diff --git a/pkg/apis/camel/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/camel/v1alpha1/zz_generated.deepcopy.go
index 3086ad83..fd37d687 100644
--- a/pkg/apis/camel/v1alpha1/zz_generated.deepcopy.go
+++ b/pkg/apis/camel/v1alpha1/zz_generated.deepcopy.go
@@ -243,7 +243,7 @@ func (in *IntegrationPlatform) DeepCopyInto(out *IntegrationPlatform) {
 	*out = *in
 	out.TypeMeta = in.TypeMeta
 	in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
-	out.Spec = in.Spec
+	in.Spec.DeepCopyInto(&out.Spec)
 	out.Status = in.Status
 	return
 }
@@ -269,6 +269,18 @@ func (in *IntegrationPlatform) DeepCopyObject() runtime.Object {
 // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
 func (in *IntegrationPlatformBuildSpec) DeepCopyInto(out *IntegrationPlatformBuildSpec) {
 	*out = *in
+	if in.Properties != nil {
+		in, out := &in.Properties, &out.Properties
+		*out = make(map[string]string, len(*in))
+		for key, val := range *in {
+			(*out)[key] = val
+		}
+	}
+	if in.Repositories != nil {
+		in, out := &in.Repositories, &out.Repositories
+		*out = make([]string, len(*in))
+		copy(*out, *in)
+	}
 	return
 }
 
@@ -318,7 +330,7 @@ func (in *IntegrationPlatformList) DeepCopyObject() runtime.Object {
 // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
 func (in *IntegrationPlatformSpec) DeepCopyInto(out *IntegrationPlatformSpec) {
 	*out = *in
-	out.Build = in.Build
+	in.Build.DeepCopyInto(&out.Build)
 	return
 }
 
diff --git a/pkg/builder/builder_steps.go b/pkg/builder/builder_steps.go
index bc140326..91035e05 100644
--- a/pkg/builder/builder_steps.go
+++ b/pkg/builder/builder_steps.go
@@ -18,7 +18,6 @@ limitations under the License.
 package builder
 
 import (
-	"encoding/xml"
 	"fmt"
 	"io/ioutil"
 	"os"
@@ -32,7 +31,6 @@ import (
 	"github.com/apache/camel-k/pkg/apis/camel/v1alpha1"
 	"github.com/operator-framework/operator-sdk/pkg/sdk"
 
-	"github.com/apache/camel-k/pkg/util/camel"
 	"github.com/apache/camel-k/pkg/util/tar"
 
 	"gopkg.in/yaml.v2"
@@ -47,33 +45,7 @@ import (
 
 // GenerateProject --
 func GenerateProject(ctx *Context) error {
-	ctx.Project = maven.Project{
-		XMLName:           xml.Name{Local: "project"},
-		XMLNs:             "http://maven.apache.org/POM/4.0.0";,
-		XMLNsXsi:          "http://www.w3.org/2001/XMLSchema-instance";,
-		XsiSchemaLocation: "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd";,
-		ModelVersion:      "4.0.0",
-		GroupID:           "org.apache.camel.k.integration",
-		ArtifactID:        "camel-k-integration",
-		Version:           version.Version,
-		DependencyManagement: maven.DependencyManagement{
-			Dependencies: maven.Dependencies{
-				Dependencies: []maven.Dependency{
-					{
-						//TODO: camel version should be retrieved from an external request or provided as static version
-						GroupID:    "org.apache.camel",
-						ArtifactID: "camel-bom",
-						Version:    camel.Version,
-						Type:       "pom",
-						Scope:      "import",
-					},
-				},
-			},
-		},
-		Dependencies: maven.Dependencies{
-			Dependencies: make([]maven.Dependency, 0),
-		},
-	}
+	ctx.Project = NewProject(ctx)
 
 	//
 	// Repositories
diff --git a/pkg/builder/builder_steps_test.go b/pkg/builder/builder_steps_test.go
new file mode 100644
index 00000000..ad31eb9e
--- /dev/null
+++ b/pkg/builder/builder_steps_test.go
@@ -0,0 +1,61 @@
+/*
+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 builder
+
+import (
+	"testing"
+
+	"github.com/apache/camel-k/pkg/apis/camel/v1alpha1"
+
+	"github.com/stretchr/testify/assert"
+)
+
+func TestGenerateProject(t *testing.T) {
+	ctx := Context{
+		Request: Request{
+			Platform: v1alpha1.IntegrationPlatformSpec{
+				Build: v1alpha1.IntegrationPlatformBuildSpec{
+					CamelVersion: "2.22.1",
+				},
+			},
+			Repositories: []string{
+				"https://repository.apache.org/content/groups/snapshots-group@id=apache-snapshots@snapshots@noreleases";,
+				"https://oss.sonatype.org/content/repositories/ops4j-snapshots@id=ops4j-snapshots@snapshots@noreleases";,
+			},
+		},
+	}
+
+	err := GenerateProject(&ctx)
+
+	assert.Nil(t, err)
+
+	assert.Equal(t, 1, len(ctx.Project.DependencyManagement.Dependencies.Dependencies))
+	assert.Equal(t, "org.apache.camel", ctx.Project.DependencyManagement.Dependencies.Dependencies[0].GroupID)
+	assert.Equal(t, "camel-bom", ctx.Project.DependencyManagement.Dependencies.Dependencies[0].ArtifactID)
+	assert.Equal(t, "2.22.1", ctx.Project.DependencyManagement.Dependencies.Dependencies[0].Version)
+	assert.Equal(t, "pom", ctx.Project.DependencyManagement.Dependencies.Dependencies[0].Type)
+	assert.Equal(t, "import", ctx.Project.DependencyManagement.Dependencies.Dependencies[0].Scope)
+
+	assert.Equal(t, 2, len(ctx.Project.Repositories.Repositories))
+	assert.Equal(t, "apache-snapshots", ctx.Project.Repositories.Repositories[0].ID)
+	assert.False(t, ctx.Project.Repositories.Repositories[0].Releases.Enabled)
+	assert.True(t, ctx.Project.Repositories.Repositories[0].Snapshots.Enabled)
+	assert.Equal(t, "ops4j-snapshots", ctx.Project.Repositories.Repositories[1].ID)
+	assert.False(t, ctx.Project.Repositories.Repositories[1].Releases.Enabled)
+	assert.True(t, ctx.Project.Repositories.Repositories[1].Snapshots.Enabled)
+}
diff --git a/pkg/builder/builder_utils.go b/pkg/builder/builder_utils.go
index 8ba81c52..7a20344f 100644
--- a/pkg/builder/builder_utils.go
+++ b/pkg/builder/builder_utils.go
@@ -18,8 +18,12 @@ limitations under the License.
 package builder
 
 import (
+	"encoding/xml"
 	"os"
 
+	"github.com/apache/camel-k/pkg/util/maven"
+	"github.com/apache/camel-k/version"
+
 	"github.com/apache/camel-k/pkg/apis/camel/v1alpha1"
 )
 
@@ -41,3 +45,34 @@ func ArtifactIDs(artifacts []v1alpha1.Artifact) []string {
 
 	return result
 }
+
+// NewProject --
+func NewProject(ctx *Context) maven.Project {
+	return maven.Project{
+		XMLName:           xml.Name{Local: "project"},
+		XMLNs:             "http://maven.apache.org/POM/4.0.0";,
+		XMLNsXsi:          "http://www.w3.org/2001/XMLSchema-instance";,
+		XsiSchemaLocation: "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd";,
+		ModelVersion:      "4.0.0",
+		GroupID:           "org.apache.camel.k.integration",
+		ArtifactID:        "camel-k-integration",
+		Version:           version.Version,
+		Properties:        ctx.Request.Platform.Build.Properties,
+		DependencyManagement: maven.DependencyManagement{
+			Dependencies: maven.Dependencies{
+				Dependencies: []maven.Dependency{
+					{
+						GroupID:    "org.apache.camel",
+						ArtifactID: "camel-bom",
+						Version:    ctx.Request.Platform.Build.CamelVersion,
+						Type:       "pom",
+						Scope:      "import",
+					},
+				},
+			},
+		},
+		Dependencies: maven.Dependencies{
+			Dependencies: make([]maven.Dependency, 0),
+		},
+	}
+}
diff --git a/pkg/builder/springboot/generator.go b/pkg/builder/springboot/generator.go
index af59b7a9..a50e04f0 100644
--- a/pkg/builder/springboot/generator.go
+++ b/pkg/builder/springboot/generator.go
@@ -18,44 +18,33 @@ limitations under the License.
 package springboot
 
 import (
-	"encoding/xml"
 	"fmt"
 	"strings"
 
 	"github.com/apache/camel-k/pkg/builder"
-	"github.com/apache/camel-k/pkg/util/camel"
 	"github.com/apache/camel-k/pkg/util/maven"
 	"github.com/apache/camel-k/version"
 )
 
 // GenerateProject --
 func GenerateProject(ctx *builder.Context) error {
-	ctx.Project = maven.Project{
-		XMLName:           xml.Name{Local: "project"},
-		XMLNs:             "http://maven.apache.org/POM/4.0.0";,
-		XMLNsXsi:          "http://www.w3.org/2001/XMLSchema-instance";,
-		XsiSchemaLocation: "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd";,
-		ModelVersion:      "4.0.0",
-		GroupID:           "org.apache.camel.k.integration",
-		ArtifactID:        "camel-k-integration",
-		Version:           version.Version,
-		DependencyManagement: maven.DependencyManagement{
-			Dependencies: maven.Dependencies{
-				Dependencies: []maven.Dependency{
-					{
-						//TODO: camel version should be retrieved from an external request or provided as static version
-						GroupID:    "org.apache.camel",
-						ArtifactID: "camel-bom",
-						Version:    camel.Version,
-						Type:       "pom",
-						Scope:      "import",
-					},
-				},
-			},
-		},
-		Dependencies: maven.Dependencies{
-			Dependencies: make([]maven.Dependency, 0),
-		},
+	ctx.Project = builder.NewProject(ctx)
+
+	//
+	// Repositories
+	//
+
+	ctx.Project.Repositories = maven.Repositories{
+		Repositories: make([]maven.Repository, 0, len(ctx.Request.Repositories)),
+	}
+
+	for i, r := range ctx.Request.Repositories {
+		repo := maven.NewRepository(r)
+		if repo.ID == "" {
+			repo.ID = fmt.Sprintf("repo-%03d", i)
+		}
+
+		ctx.Project.Repositories.Repositories = append(ctx.Project.Repositories.Repositories, repo)
 	}
 
 	//
@@ -110,7 +99,7 @@ func GenerateProject(ctx *builder.Context) error {
 			deps.Add(maven.Dependency{
 				GroupID:    "org.apache.camel",
 				ArtifactID: artifactID + "-starter",
-				Version:    camel.Version,
+				Version:    ctx.Request.Platform.Build.CamelVersion,
 				Exclusions: &maven.Exclusions{
 					Exclusions: []maven.Exclusion{
 						{
diff --git a/pkg/client/cmd/install.go b/pkg/client/cmd/install.go
index 2100908b..142f521c 100644
--- a/pkg/client/cmd/install.go
+++ b/pkg/client/cmd/install.go
@@ -19,11 +19,12 @@ package cmd
 
 import (
 	"fmt"
-	"github.com/apache/camel-k/pkg/util/kubernetes"
 
+	"strings"
 	"time"
 
 	"github.com/apache/camel-k/pkg/install"
+	"github.com/apache/camel-k/pkg/util/kubernetes"
 	"github.com/operator-framework/operator-sdk/pkg/k8sclient"
 	"github.com/pkg/errors"
 	"github.com/spf13/cobra"
@@ -48,6 +49,9 @@ func newCmdInstall(rootCmdOptions *RootCmdOptions) *cobra.Command {
 	cmd.Flags().StringVarP(&options.outputFormat, "output", "o", "", "Output format. One of: json|yaml")
 	cmd.Flags().StringVar(&options.organization, "organization", "", "A organization on the Docker registry that can be used to publish images")
 	cmd.Flags().StringVar(&options.pushSecret, "push-secret", "", "A secret used to push images to the Docker registry")
+	cmd.Flags().StringSliceVar(&options.repositories, "repository", nil, "Add a maven repository")
+	cmd.Flags().StringSliceVarP(&options.properties, "property", "p", nil, "Add a camel property")
+	cmd.Flags().StringVar(&options.camelVersion, "camel-version", "", "Set the camel version")
 
 	return &cmd
 }
@@ -61,6 +65,9 @@ type installCmdOptions struct {
 	outputFormat     string
 	organization     string
 	pushSecret       string
+	camelVersion     string
+	repositories     []string
+	properties       []string
 }
 
 func (o *installCmdOptions) install(cmd *cobra.Command, args []string) error {
@@ -94,7 +101,30 @@ func (o *installCmdOptions) install(cmd *cobra.Command, args []string) error {
 			return err
 		}
 
-		err = install.PlatformOrCollect(namespace, o.registry, o.organization, o.pushSecret, collection)
+		platform, err := install.PlatformOrCollect(namespace, o.registry, o.organization, o.pushSecret, collection)
+		if err != nil {
+			return err
+		}
+
+		if len(o.properties) > 0 {
+			platform.Spec.Build.Properties = make(map[string]string)
+
+			for _, property := range o.properties {
+				kv := strings.Split(property, "=")
+
+				if len(kv) == 2 {
+					platform.Spec.Build.Properties[kv[0]] = kv[1]
+				}
+			}
+		}
+		if len(o.repositories) > 0 {
+			platform.Spec.Build.Repositories = o.repositories
+		}
+		if o.camelVersion != "" {
+			platform.Spec.Build.CamelVersion = o.camelVersion
+		}
+
+		err = install.RuntimeObjectOrCollect(namespace, collection, platform)
 		if err != nil {
 			return err
 		}
diff --git a/pkg/install/operator.go b/pkg/install/operator.go
index 953625f5..3088df3b 100644
--- a/pkg/install/operator.go
+++ b/pkg/install/operator.go
@@ -91,22 +91,22 @@ func installKnative(namespace string, collection *kubernetes.Collection) error {
 }
 
 // Platform installs the platform custom resource
-func Platform(namespace string, registry string, organization string, pushSecret string) error {
+func Platform(namespace string, registry string, organization string, pushSecret string) (*v1alpha1.IntegrationPlatform, error) {
 	return PlatformOrCollect(namespace, registry, organization, pushSecret, nil)
 }
 
 // PlatformOrCollect --
-func PlatformOrCollect(namespace string, registry string, organization string, pushSecret string, collection *kubernetes.Collection) error {
+func PlatformOrCollect(namespace string, registry string, organization string, pushSecret string, collection *kubernetes.Collection) (*v1alpha1.IntegrationPlatform, error) {
 	if err := waitForPlatformCRDAvailable(namespace, 25*time.Second); err != nil {
-		return err
+		return nil, err
 	}
 	isOpenshift, err := openshift.IsOpenShift()
 	if err != nil {
-		return err
+		return nil, err
 	}
 	platformObject, err := kubernetes.LoadResourceFromYaml(deploy.Resources["platform-cr.yaml"])
 	if err != nil {
-		return err
+		return nil, err
 	}
 	pl := platformObject.(*v1alpha1.IntegrationPlatform)
 
@@ -117,10 +117,10 @@ func PlatformOrCollect(namespace string, registry string, organization string, p
 			// because the operator is not allowed to look into the "kube-system" namespace
 			minishiftRegistry, err := minishift.FindRegistry()
 			if err != nil {
-				return err
+				return nil, err
 			}
 			if minishiftRegistry == nil {
-				return errors.New("cannot find automatically a registry where to push images")
+				return nil, errors.New("cannot find automatically a registry where to push images")
 			}
 			registry = *minishiftRegistry
 		}
@@ -131,13 +131,13 @@ func PlatformOrCollect(namespace string, registry string, organization string, p
 
 	var knativeInstalled bool
 	if knativeInstalled, err = knative.IsInstalled(); err != nil {
-		return err
+		return nil, err
 	}
 	if knativeInstalled {
 		pl.Spec.Profile = v1alpha1.TraitProfileKnative
 	}
 
-	return RuntimeObjectOrCollect(namespace, collection, pl)
+	return pl, nil
 }
 
 func waitForPlatformCRDAvailable(namespace string, timeout time.Duration) error {
diff --git a/pkg/stub/action/context/build.go b/pkg/stub/action/context/build.go
index 7f47bc38..08394c9e 100644
--- a/pkg/stub/action/context/build.go
+++ b/pkg/stub/action/context/build.go
@@ -52,6 +52,10 @@ func (action *buildAction) CanHandle(context *v1alpha1.IntegrationContext) bool
 }
 
 func (action *buildAction) Handle(context *v1alpha1.IntegrationContext) error {
+	p, err := platform.GetCurrentPlatform(context.Namespace)
+	if err != nil {
+		return err
+	}
 	b, err := platform.GetPlatformBuilder(action.Context, context.Namespace)
 	if err != nil {
 		return err
@@ -61,10 +65,15 @@ func (action *buildAction) Handle(context *v1alpha1.IntegrationContext) error {
 		return err
 	}
 
+	// assume there's no duplication nor conflict for now
+	repositories := make([]string, 0, len(context.Spec.Repositories)+len(p.Spec.Build.Repositories))
+	repositories = append(repositories, context.Spec.Repositories...)
+	repositories = append(repositories, p.Spec.Build.Repositories...)
+
 	r := builder.Request{
 		Meta:         context.ObjectMeta,
 		Dependencies: context.Spec.Dependencies,
-		Repositories: context.Spec.Repositories,
+		Repositories: repositories,
 		Steps:        env.Steps,
 		BuildDir:     env.BuildDir,
 		Platform:     env.Platform.Spec,
diff --git a/pkg/util/camel/version.go b/pkg/util/camel/version.go
deleted file mode 100644
index bc00816f..00000000
--- a/pkg/util/camel/version.go
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
-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 camel
-
-// Version --
-const Version = "2.23.0"
diff --git a/pkg/util/maven/maven_project.go b/pkg/util/maven/maven_project.go
index 57603a14..cba227ba 100644
--- a/pkg/util/maven/maven_project.go
+++ b/pkg/util/maven/maven_project.go
@@ -32,6 +32,7 @@ type Project struct {
 	GroupID              string               `xml:"groupId"`
 	ArtifactID           string               `xml:"artifactId"`
 	Version              string               `xml:"version"`
+	Properties           Properties           `xml:"properties,omitempty"`
 	DependencyManagement DependencyManagement `xml:"dependencyManagement"`
 	Dependencies         Dependencies         `xml:"dependencies"`
 	Repositories         Repositories         `xml:"repositories"`
@@ -118,11 +119,11 @@ type PluginRepositories struct {
 
 // Repository --
 type Repository struct {
-	ID        string    `xml:"id"`
-	Name      string    `xml:"name,omitempty"`
-	URL       string    `xml:"url"`
-	Snapshots Snapshots `xml:"snapshots,omitempty"`
-	Releases  Releases  `xml:"releases,omitempty"`
+	ID        string           `xml:"id"`
+	Name      string           `xml:"name,omitempty"`
+	URL       string           `xml:"url"`
+	Snapshots RepositoryPolicy `xml:"snapshots,omitempty"`
+	Releases  RepositoryPolicy `xml:"releases,omitempty"`
 }
 
 //
@@ -138,10 +139,10 @@ type Repository struct {
 func NewRepository(repo string) Repository {
 	r := Repository{
 		URL: repo,
-		Releases: Releases{
+		Releases: RepositoryPolicy{
 			Enabled: true,
 		},
-		Snapshots: Snapshots{
+		Snapshots: RepositoryPolicy{
 			Enabled: false,
 		},
 	}
@@ -152,6 +153,8 @@ func NewRepository(repo string) Repository {
 		for _, attribute := range strings.Split(repo[idx+1:], "@") {
 			if attribute == "snapshots" {
 				r.Snapshots.Enabled = true
+			} else if attribute == "noreleases" {
+				r.Releases.Enabled = false
 			} else if strings.HasPrefix(attribute, "id=") {
 				r.ID = attribute[3:]
 			}
@@ -161,14 +164,8 @@ func NewRepository(repo string) Repository {
 	return r
 }
 
-// Snapshots --
-type Snapshots struct {
-	Enabled      bool   `xml:"enabled"`
-	UpdatePolicy string `xml:"updatePolicy,omitempty"`
-}
-
-// Releases --
-type Releases struct {
+// RepositoryPolicy --
+type RepositoryPolicy struct {
 	Enabled      bool   `xml:"enabled"`
 	UpdatePolicy string `xml:"updatePolicy,omitempty"`
 }
@@ -208,19 +205,28 @@ type Goals struct {
 	Goals []string `xml:"goal"`
 }
 
-/*
- <plugin>
-        <groupId>org.apache.camel.k</groupId>
-        <artifactId>camel-k-runtime-dependency-lister</artifactId>
-        <version>0.0.3-SNAPSHOT</version>
-        <executions>
-          <execution>
-            <id>generate-dependency-list</id>
-            <phase>initialize</phase>
-            <goals>
-              <goal>generate-dependency-list</goal>
-            </goals>
-          </execution>
-        </executions>
-      </plugin>
-*/
+// Properties --
+type Properties map[string]string
+
+type propertiesEntry struct {
+	XMLName xml.Name
+	Value   string `xml:",chardata"`
+}
+
+// MarshalXML --
+func (m Properties) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
+	if len(m) == 0 {
+		return nil
+	}
+
+	err := e.EncodeToken(start)
+	if err != nil {
+		return err
+	}
+
+	for k, v := range m {
+		e.Encode(propertiesEntry{XMLName: xml.Name{Local: k}, Value: v})
+	}
+
+	return e.EncodeToken(start.End())
+}
diff --git a/pkg/util/maven/maven_test.go b/pkg/util/maven/maven_test.go
index b5d8243e..fe717251 100644
--- a/pkg/util/maven/maven_test.go
+++ b/pkg/util/maven/maven_test.go
@@ -114,10 +114,10 @@ func TestPomGeneration(t *testing.T) {
 				{
 					ID:  "central",
 					URL: "https://repo.maven.apache.org/maven2";,
-					Snapshots: Snapshots{
+					Snapshots: RepositoryPolicy{
 						Enabled: false,
 					},
-					Releases: Releases{
+					Releases: RepositoryPolicy{
 						Enabled:      true,
 						UpdatePolicy: "never",
 					},
@@ -129,10 +129,10 @@ func TestPomGeneration(t *testing.T) {
 				{
 					ID:  "central",
 					URL: "https://repo.maven.apache.org/maven2";,
-					Snapshots: Snapshots{
+					Snapshots: RepositoryPolicy{
 						Enabled: false,
 					},
-					Releases: Releases{
+					Releases: RepositoryPolicy{
 						Enabled:      true,
 						UpdatePolicy: "never",
 					},
diff --git a/test/build_manager_integration_test.go b/test/build_manager_integration_test.go
index 4bbcd19f..b315ec45 100644
--- a/test/build_manager_integration_test.go
+++ b/test/build_manager_integration_test.go
@@ -28,6 +28,7 @@ import (
 
 	"k8s.io/apimachinery/pkg/apis/meta/v1"
 
+	"github.com/apache/camel-k/pkg/apis/camel/v1alpha1"
 	"github.com/apache/camel-k/pkg/builder"
 	"github.com/apache/camel-k/pkg/builder/s2i"
 	"github.com/stretchr/testify/assert"
@@ -43,6 +44,11 @@ func TestBuildManagerBuild(t *testing.T) {
 			Name:            "man-test",
 			ResourceVersion: "1",
 		},
+		Platform: v1alpha1.IntegrationPlatformSpec{
+			Build: v1alpha1.IntegrationPlatformBuildSpec{
+				CamelVersion: "2.23.0",
+			},
+		},
 		Dependencies: []string{
 			"mvn:org.apache.camel/camel-core",
 			"camel:telegram",
@@ -79,6 +85,11 @@ func TestBuildManagerFailedBuild(t *testing.T) {
 			Name:            "man-test",
 			ResourceVersion: "1",
 		},
+		Platform: v1alpha1.IntegrationPlatformSpec{
+			Build: v1alpha1.IntegrationPlatformBuildSpec{
+				CamelVersion: "2.23.0",
+			},
+		},
 		Dependencies: []string{
 			"mvn:org.apache.camel/camel-cippalippa",
 		},


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@xxxxxxxxxxxxxxxx


With regards,
Apache Git Services