You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ts...@apache.org on 2022/10/07 03:48:11 UTC
[camel-k] 09/13: (e2e): Exposes maven-cli-options to allow maven build debugging
This is an automated email from the ASF dual-hosted git repository.
tsato pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit ef5c8f598005e49a4379d0e8a90226f57ca3feb6
Author: phantomjinx <p....@phantomjinx.co.uk>
AuthorDate: Fri Sep 30 22:43:43 2022 +0100
(e2e): Exposes maven-cli-options to allow maven build debugging
* test_support.go
* When installing for the tests, handle CAMEL_K_TEST_MAVEN_CLI_OPTIONS
to inject maven-cli options specified by the tests
* If e2e tests have a log-level of debug then set the maven-cli-options
to "-X" to retrieve debugging from maven builds
* Renames CAMEL_K_LOG_LEVEL with TEST prefix
---
.github/actions/e2e-builder/exec-tests.sh | 5 ++++-
.github/actions/e2e-common/exec-tests.sh | 5 ++++-
.github/actions/e2e-install/exec-tests.sh | 5 ++++-
.github/actions/e2e-knative-yaks/exec-tests.sh | 5 ++++-
.github/actions/e2e-knative/exec-tests.sh | 5 ++++-
.github/actions/e2e-upgrade/exec-tests.sh | 5 ++++-
e2e/support/test_support.go | 21 ++++++++++++++++++---
e2e/support/util/dump.go | 2 +-
8 files changed, 43 insertions(+), 10 deletions(-)
diff --git a/.github/actions/e2e-builder/exec-tests.sh b/.github/actions/e2e-builder/exec-tests.sh
index 44501de07..a622897a3 100755
--- a/.github/actions/e2e-builder/exec-tests.sh
+++ b/.github/actions/e2e-builder/exec-tests.sh
@@ -117,7 +117,10 @@ export KAMEL_INSTALL_OPERATOR_IMAGE=${CUSTOM_IMAGE}:${CUSTOM_VERSION}
# (see kamel-build-bundle/build-bundle-image.sh)
export KAMEL_INSTALL_OPERATOR_IMAGE_PULL_POLICY="Always"
-export CAMEL_K_LOG_LEVEL="${LOG_LEVEL}"
+export CAMEL_K_TEST_LOG_LEVEL="${LOG_LEVEL}"
+if [ "${LOG_LEVEL}" == "debug" ]; then
+ export CAMEL_K_TEST_MAVEN_CLI_OPTIONS="-X ${CAMEL_K_TEST_MAVEN_CLI_OPTIONS}"
+fi
export CAMEL_K_TEST_IMAGE_NAME=${CUSTOM_IMAGE}
export CAMEL_K_TEST_IMAGE_VERSION=${CUSTOM_VERSION}
export CAMEL_K_TEST_SAVE_FAILED_TEST_NAMESPACE=${SAVE_FAILED_TEST_NS}
diff --git a/.github/actions/e2e-common/exec-tests.sh b/.github/actions/e2e-common/exec-tests.sh
index 8b687ba2a..0373a9971 100755
--- a/.github/actions/e2e-common/exec-tests.sh
+++ b/.github/actions/e2e-common/exec-tests.sh
@@ -117,7 +117,10 @@ export KAMEL_INSTALL_OPERATOR_IMAGE=${CUSTOM_IMAGE}:${CUSTOM_VERSION}
# (see kamel-build-bundle/build-bundle-image.sh)
export KAMEL_INSTALL_OPERATOR_IMAGE_PULL_POLICY="Always"
-export CAMEL_K_LOG_LEVEL="${LOG_LEVEL}"
+export CAMEL_K_TEST_LOG_LEVEL="${LOG_LEVEL}"
+if [ "${LOG_LEVEL}" == "debug" ]; then
+ export CAMEL_K_TEST_MAVEN_CLI_OPTIONS="-X ${CAMEL_K_TEST_MAVEN_CLI_OPTIONS}"
+fi
export CAMEL_K_TEST_IMAGE_NAME=${CUSTOM_IMAGE}
export CAMEL_K_TEST_IMAGE_VERSION=${CUSTOM_VERSION}
export CAMEL_K_TEST_SAVE_FAILED_TEST_NAMESPACE=${SAVE_FAILED_TEST_NS}
diff --git a/.github/actions/e2e-install/exec-tests.sh b/.github/actions/e2e-install/exec-tests.sh
index f85b44c67..44d5b75b3 100755
--- a/.github/actions/e2e-install/exec-tests.sh
+++ b/.github/actions/e2e-install/exec-tests.sh
@@ -115,7 +115,10 @@ export KAMEL_INSTALL_OPERATOR_IMAGE=${CUSTOM_IMAGE}:${CUSTOM_VERSION}
# (see kamel-build-bundle/build-bundle-image.sh)
export KAMEL_INSTALL_OPERATOR_IMAGE_PULL_POLICY="Always"
-export CAMEL_K_LOG_LEVEL="${LOG_LEVEL}"
+export CAMEL_K_TEST_LOG_LEVEL="${LOG_LEVEL}"
+if [ "${LOG_LEVEL}" == "debug" ]; then
+ export CAMEL_K_TEST_MAVEN_CLI_OPTIONS="-X ${CAMEL_K_TEST_MAVEN_CLI_OPTIONS}"
+fi
export CAMEL_K_TEST_IMAGE_NAME=${CUSTOM_IMAGE}
export CAMEL_K_TEST_IMAGE_VERSION=${CUSTOM_VERSION}
export CAMEL_K_TEST_SAVE_FAILED_TEST_NAMESPACE=${SAVE_FAILED_TEST_NS}
diff --git a/.github/actions/e2e-knative-yaks/exec-tests.sh b/.github/actions/e2e-knative-yaks/exec-tests.sh
index a6075dbbc..5fe7592ef 100755
--- a/.github/actions/e2e-knative-yaks/exec-tests.sh
+++ b/.github/actions/e2e-knative-yaks/exec-tests.sh
@@ -114,7 +114,10 @@ export KAMEL_INSTALL_OPERATOR_IMAGE=${CUSTOM_IMAGE}:${CUSTOM_VERSION}
# (see kamel-build-bundle/build-bundle-image.sh)
export KAMEL_INSTALL_OPERATOR_IMAGE_PULL_POLICY="Always"
-export CAMEL_K_LOG_LEVEL="${LOG_LEVEL}"
+export CAMEL_K_TEST_LOG_LEVEL="${LOG_LEVEL}"
+if [ "${LOG_LEVEL}" == "debug" ]; then
+ export CAMEL_K_TEST_MAVEN_CLI_OPTIONS="-X ${CAMEL_K_TEST_MAVEN_CLI_OPTIONS}"
+fi
export CAMEL_K_TEST_IMAGE_NAME=${CUSTOM_IMAGE}
export CAMEL_K_TEST_IMAGE_VERSION=${CUSTOM_VERSION}
export CAMEL_K_TEST_SAVE_FAILED_TEST_NAMESPACE=${SAVE_FAILED_TEST_NS}
diff --git a/.github/actions/e2e-knative/exec-tests.sh b/.github/actions/e2e-knative/exec-tests.sh
index 0e3d94517..aa365c96a 100755
--- a/.github/actions/e2e-knative/exec-tests.sh
+++ b/.github/actions/e2e-knative/exec-tests.sh
@@ -118,7 +118,10 @@ export KAMEL_INSTALL_OPERATOR_IMAGE=${CUSTOM_IMAGE}:${CUSTOM_VERSION}
# (see kamel-build-bundle/build-bundle-image.sh)
export KAMEL_INSTALL_OPERATOR_IMAGE_PULL_POLICY="Always"
-export CAMEL_K_LOG_LEVEL="${LOG_LEVEL}"
+export CAMEL_K_TEST_LOG_LEVEL="${LOG_LEVEL}"
+if [ "${LOG_LEVEL}" == "debug" ]; then
+ export CAMEL_K_TEST_MAVEN_CLI_OPTIONS="-X ${CAMEL_K_TEST_MAVEN_CLI_OPTIONS}"
+fi
export CAMEL_K_TEST_IMAGE_NAME=${CUSTOM_IMAGE}
export CAMEL_K_TEST_IMAGE_VERSION=${CUSTOM_VERSION}
export CAMEL_K_TEST_SAVE_FAILED_TEST_NAMESPACE=${SAVE_FAILED_TEST_NS}
diff --git a/.github/actions/e2e-upgrade/exec-tests.sh b/.github/actions/e2e-upgrade/exec-tests.sh
index 367a578bc..38dd6a626 100755
--- a/.github/actions/e2e-upgrade/exec-tests.sh
+++ b/.github/actions/e2e-upgrade/exec-tests.sh
@@ -115,7 +115,10 @@ export KAMEL_INSTALL_OPERATOR_IMAGE_PULL_POLICY="Always"
# Despite building a bundle we don't want it installed immediately so no OLM_INDEX_BUNDLE var
# Configure test options
-export CAMEL_K_LOG_LEVEL="${LOG_LEVEL}"
+export CAMEL_K_TEST_LOG_LEVEL="${LOG_LEVEL}"
+if [ "${LOG_LEVEL}" == "debug" ]; then
+ export CAMEL_K_TEST_MAVEN_CLI_OPTIONS="-X ${CAMEL_K_TEST_MAVEN_CLI_OPTIONS}"
+fi
export CAMEL_K_PREV_IIB=quay.io/operatorhubio/catalog:latest
export CAMEL_K_NEW_IIB=${BUNDLE_INDEX_IMAGE}
export CAMEL_K_PREV_UPGRADE_CHANNEL=${PREV_XY_CHANNEL}
diff --git a/e2e/support/test_support.go b/e2e/support/test_support.go
index aa1761d75..d363b620c 100644
--- a/e2e/support/test_support.go
+++ b/e2e/support/test_support.go
@@ -250,12 +250,27 @@ func KamelInstallWithContext(ctx context.Context, operatorID string, namespace s
installArgs = []string{"install", "-n", namespace, "--operator-id", operatorID}
}
- logLevel := os.Getenv("CAMEL_K_LOG_LEVEL")
+ logLevel := os.Getenv("CAMEL_K_TEST_LOG_LEVEL")
if len(logLevel) > 0 {
fmt.Printf("Setting log-level to %s\n", logLevel)
installArgs = append(installArgs, "--log-level", logLevel)
}
+ mvnCLIOptions := os.Getenv("CAMEL_K_TEST_MAVEN_CLI_OPTIONS")
+ if len(mvnCLIOptions) > 0 {
+ // Split the string by spaces
+ mvnCLIArr := strings.Split(mvnCLIOptions, " ")
+ for _, mc := range mvnCLIArr {
+ mc = strings.Trim(mc, " ")
+ if len(mc) == 0 {
+ continue
+ }
+
+ fmt.Printf("Adding maven cli option %s\n", mc)
+ installArgs = append(installArgs, "--maven-cli-option", mc)
+ }
+ }
+
installArgs = append(installArgs, args...)
return KamelWithContext(ctx, installArgs...)
}
@@ -324,7 +339,7 @@ func KamelWithContext(ctx context.Context, args ...string) *cobra.Command {
var c *cobra.Command
var err error
- if os.Getenv("CAMEL_K_LOG_LEVEL") == "debug" {
+ if os.Getenv("CAMEL_K_TEST_LOG_LEVEL") == "debug" {
fmt.Printf("Executing kamel with command %+q\n", args)
fmt.Println("Printing stack for KamelWithContext")
debug.PrintStack()
@@ -472,7 +487,7 @@ func StructuredLogs(ns, podName string, options *corev1.PodLogOptions, ignorePar
err := json.Unmarshal([]byte(t), &entry)
if err != nil {
if ignoreParseErrors {
- fmt.Printf("Warning: Ignoring parse error for logging line: '%s'\n", t)
+ fmt.Printf("Warning: Ignoring parse error for logging line: %q\n", t)
continue
} else {
msg := fmt.Sprintf("Unable to parse structured content: %s", t)
diff --git a/e2e/support/util/dump.go b/e2e/support/util/dump.go
index 847821c2a..d5da6fa99 100644
--- a/e2e/support/util/dump.go
+++ b/e2e/support/util/dump.go
@@ -256,7 +256,7 @@ func dumpLogs(ctx context.Context, c client.Client, prefix string, ns string, na
Container: container,
}
- if os.Getenv("CAMEL_K_LOG_LEVEL") != "debug" {
+ if os.Getenv("CAMEL_K_TEST_LOG_LEVEL") != "debug" {
// If not in debug mode then curtail the dumping of log lines
lines := int64(50)
logOptions.TailLines = &lines