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/14 12:22:15 UTC

[camel-k] branch master updated (5fe830e -> 2f91a81)

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 5fe830e  Updated CHANGELOG.md
     new 7dde4f7  chore(e2e): Rely on staging repository in Maven CA e2e tests
     new 2f91a81  chore(e2e): Clean-up all resources created by Maven CA e2e tests

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:
 e2e/common/build/maven_ca_secret_test.go | 44 +++++++++++++++++++++++++++++---
 1 file changed, 41 insertions(+), 3 deletions(-)

[camel-k] 01/02: chore(e2e): Rely on staging repository in Maven CA e2e tests

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 7dde4f7e7eaa42577a4f4b3824f059c6d5511bd0
Author: Antonin Stefanutti <an...@stefanutti.fr>
AuthorDate: Wed Apr 14 12:01:45 2021 +0200

    chore(e2e): Rely on staging repository in Maven CA e2e tests
---
 e2e/common/build/maven_ca_secret_test.go | 40 +++++++++++++++++++++++++++++---
 1 file changed, 37 insertions(+), 3 deletions(-)

diff --git a/e2e/common/build/maven_ca_secret_test.go b/e2e/common/build/maven_ca_secret_test.go
index 259592a..2ef9db1 100644
--- a/e2e/common/build/maven_ca_secret_test.go
+++ b/e2e/common/build/maven_ca_secret_test.go
@@ -33,6 +33,7 @@ import (
 	"math/big"
 	rand2 "math/rand"
 	"os"
+	"strings"
 	"testing"
 	"time"
 
@@ -50,6 +51,7 @@ import (
 
 	. "github.com/apache/camel-k/e2e/support"
 	v1 "github.com/apache/camel-k/pkg/apis/camel/v1"
+	"github.com/apache/camel-k/pkg/util/maven"
 )
 
 func TestMavenCASecret(t *testing.T) {
@@ -374,8 +376,26 @@ ProxyPreserveHost On
 			SubResource("exec").
 			Param("container", "nexus")
 
-		apacheSnapshots := "https://repository.apache.org/content/repositories/snapshots/"
-		repository := fmt.Sprintf(`{"name":"apache-snapshots","proxy":{"remoteUrl":"%s","contentMaxAge":1440,"metadataMaxAge":1440},"online":true,"maven":{"versionPolicy":"SNAPSHOT","layoutPolicy":"PERMISSIVE"},"negativeCache":{"enabled":false,"timeToLive":1440},"httpClient":{"autoBlock":false,"blocked":false},"storage":{"strictContentTypeValidation":true,"blobStoreName":"default"}}`, apacheSnapshots)
+		// Rely on the Camel K staging repository, that can either be Apache Staging,
+		// during releases preparation, or Apache Snapshots otherwise.
+		stagingRepositoryUrl := os.Getenv("KAMEL_INSTALL_MAVEN_REPOSITORIES")
+		if stagingRepositoryUrl == "" {
+			stagingRepositoryUrl = "https://repository.apache.org/content/repositories/snapshots/@id=apache-snapshots@snapshots@noreleases"
+		}
+		stagingRepository := maven.NewRepository(stagingRepositoryUrl)
+		if stagingRepository.ID == "" {
+			stagingRepository.ID = "staging"
+		}
+		versionPolicy := ""
+		if stagingRepository.Releases.Enabled && stagingRepository.Snapshots.Enabled {
+			versionPolicy = "MIXED"
+		} else if stagingRepository.Releases.Enabled {
+			versionPolicy = "RELEASE"
+		} else {
+			versionPolicy = "SNAPSHOT"
+		}
+
+		repository := fmt.Sprintf(`{"name":"%s","proxy":{"remoteUrl":"%s","contentMaxAge":1440,"metadataMaxAge":1440},"online":true,"maven":{"versionPolicy":"%s","layoutPolicy":"PERMISSIVE"},"negativeCache":{"enabled":false,"timeToLive":1440},"httpClient":{"autoBlock":false,"blocked":false},"storage":{"strictContentTypeValidation":true,"blobStoreName":"default"}}`, stagingRepository.ID, stagingRepository.URL, versionPolicy)
 
 		req.VersionedParams(&corev1.PodExecOptions{
 			Container: "nexus",
@@ -401,7 +421,7 @@ 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-internal@mirrorOf=central`, hostname),
-			"--maven-repository", fmt.Sprintf(`https://%s/repository/apache-snapshots/@id=apache-snapshots@snapshots@noreleases`, hostname),
+			"--maven-repository", fmt.Sprintf(`https://%s/repository/%s/%s`, hostname, stagingRepository.ID, strings.Join(getRepositoryAttributes(stagingRepository), "")),
 			"--maven-ca-secret", secret.Name+"/"+corev1.TLSCertKey,
 		).Execute()).To(Succeed())
 
@@ -428,3 +448,17 @@ ProxyPreserveHost On
 		Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
 	})
 }
+
+func getRepositoryAttributes(repository maven.Repository) []string {
+	var attributes []string
+	if repository.ID != "" {
+		attributes = append(attributes, "@id="+repository.ID)
+	}
+	if !repository.Releases.Enabled {
+		attributes = append(attributes, "@noreleases")
+	}
+	if repository.Snapshots.Enabled {
+		attributes = append(attributes, "@snapshots")
+	}
+	return attributes
+}

[camel-k] 02/02: chore(e2e): Clean-up all resources created by Maven CA e2e tests

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 2f91a816dd38de2204caef43f5ca8a59a2e65d54
Author: Antonin Stefanutti <an...@stefanutti.fr>
AuthorDate: Wed Apr 14 12:05:52 2021 +0200

    chore(e2e): Clean-up all resources created by Maven CA e2e tests
---
 e2e/common/build/maven_ca_secret_test.go | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/e2e/common/build/maven_ca_secret_test.go b/e2e/common/build/maven_ca_secret_test.go
index 2ef9db1..e93798f 100644
--- a/e2e/common/build/maven_ca_secret_test.go
+++ b/e2e/common/build/maven_ca_secret_test.go
@@ -446,6 +446,10 @@ ProxyPreserveHost On
 
 		// Clean up
 		Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
+		Expect(TestClient().Delete(TestContext, deployment)).To(Succeed())
+		Expect(TestClient().Delete(TestContext, service)).To(Succeed())
+		Expect(TestClient().Delete(TestContext, secret)).To(Succeed())
+		Expect(TestClient().Delete(TestContext, config)).To(Succeed())
 	})
 }