From 9b2178f99b39ddd93c9f01186876512a8fc0c42b Mon Sep 17 00:00:00 2001 From: Christopher Haar Date: Mon, 12 Aug 2024 18:43:51 +0200 Subject: [PATCH] feat(crossplane-cli): add an option if crossplane cli is available to trace the XRs to get an easier overview Signed-off-by: Christopher Haar --- internal/templates/00-assert.yaml.tmpl | 1 + internal/templates/renderer_test.go | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/internal/templates/00-assert.yaml.tmpl b/internal/templates/00-assert.yaml.tmpl index 8998b56..12c287b 100644 --- a/internal/templates/00-assert.yaml.tmpl +++ b/internal/templates/00-assert.yaml.tmpl @@ -4,6 +4,7 @@ kind: TestAssert timeout: {{ .TestCase.Timeout }} commands: - command: ${KUBECTL} annotate managed --all upjet.upbound.io/test=true --overwrite +- script: if [ -n "${CROSSPLANE_CLI}" ]; then ${KUBECTL} get composite --no-headers -o name | while read -r comp; do [ -n "$comp" ] && ${CROSSPLANE_CLI} beta trace "$comp"; done; fi - script: echo "Dump MR manifests for the apply assertion step:"; ${KUBECTL} get managed -o yaml - script: echo "Dump Claim manifests for the apply assertion step:" || ${KUBECTL} get claim --all-namespaces -o yaml {{- range $resource := .Resources }} diff --git a/internal/templates/renderer_test.go b/internal/templates/renderer_test.go index e20072b..c3fab10 100644 --- a/internal/templates/renderer_test.go +++ b/internal/templates/renderer_test.go @@ -87,6 +87,7 @@ kind: TestAssert timeout: 10 commands: - command: ${KUBECTL} annotate managed --all upjet.upbound.io/test=true --overwrite +- script: if [ -n "${CROSSPLANE_CLI}" ]; then ${KUBECTL} get composite --no-headers -o name | while read -r comp; do [ -n "$comp" ] && ${CROSSPLANE_CLI} beta trace "$comp"; done; fi - script: echo "Dump MR manifests for the apply assertion step:"; ${KUBECTL} get managed -o yaml - script: echo "Dump Claim manifests for the apply assertion step:" || ${KUBECTL} get claim --all-namespaces -o yaml - command: ${KUBECTL} wait s3.aws.upbound.io/example-bucket --for=condition=Test --timeout 10s @@ -200,6 +201,7 @@ kind: TestAssert timeout: 10 commands: - command: ${KUBECTL} annotate managed --all upjet.upbound.io/test=true --overwrite +- script: if [ -n "${CROSSPLANE_CLI}" ]; then ${KUBECTL} get composite --no-headers -o name | while read -r comp; do [ -n "$comp" ] && ${CROSSPLANE_CLI} beta trace "$comp"; done; fi - script: echo "Dump MR manifests for the apply assertion step:"; ${KUBECTL} get managed -o yaml - script: echo "Dump Claim manifests for the apply assertion step:" || ${KUBECTL} get claim --all-namespaces -o yaml - command: /tmp/bucket/pre-assert.sh @@ -319,6 +321,7 @@ kind: TestAssert timeout: 10 commands: - command: ${KUBECTL} annotate managed --all upjet.upbound.io/test=true --overwrite +- script: if [ -n "${CROSSPLANE_CLI}" ]; then ${KUBECTL} get composite --no-headers -o name | while read -r comp; do [ -n "$comp" ] && ${CROSSPLANE_CLI} beta trace "$comp"; done; fi - script: echo "Dump MR manifests for the apply assertion step:"; ${KUBECTL} get managed -o yaml - script: echo "Dump Claim manifests for the apply assertion step:" || ${KUBECTL} get claim --all-namespaces -o yaml - command: ${KUBECTL} wait s3.aws.upbound.io/example-bucket --for=condition=Test --timeout 10s @@ -416,6 +419,7 @@ kind: TestAssert timeout: 10 commands: - command: ${KUBECTL} annotate managed --all upjet.upbound.io/test=true --overwrite +- script: if [ -n "${CROSSPLANE_CLI}" ]; then ${KUBECTL} get composite --no-headers -o name | while read -r comp; do [ -n "$comp" ] && ${CROSSPLANE_CLI} beta trace "$comp"; done; fi - script: echo "Dump MR manifests for the apply assertion step:"; ${KUBECTL} get managed -o yaml - script: echo "Dump Claim manifests for the apply assertion step:" || ${KUBECTL} get claim --all-namespaces -o yaml - command: /tmp/bucket/pre-assert.sh @@ -515,6 +519,7 @@ kind: TestAssert timeout: 10 commands: - command: ${KUBECTL} annotate managed --all upjet.upbound.io/test=true --overwrite +- script: if [ -n "${CROSSPLANE_CLI}" ]; then ${KUBECTL} get composite --no-headers -o name | while read -r comp; do [ -n "$comp" ] && ${CROSSPLANE_CLI} beta trace "$comp"; done; fi - script: echo "Dump MR manifests for the apply assertion step:"; ${KUBECTL} get managed -o yaml - script: echo "Dump Claim manifests for the apply assertion step:" || ${KUBECTL} get claim --all-namespaces -o yaml - command: /tmp/bucket/pre-assert.sh