From ea8e6b29a82c5249a95e3e3440604c9023afce92 Mon Sep 17 00:00:00 2001 From: Zoran Regvart Date: Thu, 26 Sep 2024 10:04:51 +0200 Subject: [PATCH 1/3] feat(EC-885): step-report to step-report-json (#1405) We removed the YAML output in EC-568, this is a followup to use the JSON logs instead. Resolves: https://issues.redhat.com/browse/EC-885 --- tests/build/build_templates.go | 8 ++++---- tests/enterprise-contract/contract.go | 24 ++++++++++++------------ 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/tests/build/build_templates.go b/tests/build/build_templates.go index 4fe7c1dac5..d0b6f2873c 100644 --- a/tests/build/build_templates.go +++ b/tests/build/build_templates.go @@ -694,11 +694,11 @@ var _ = framework.BuildSuiteDescribe("Build templates E2E test", Label("build", Expect(err).NotTo(HaveOccurred()) // The logs from the report step are used by the UI to display validation - // details. Let's make sure it has valid YAML. - reportLogs := logs["step-report"] + // details. Let's make sure it has valid JSON. + reportLogs := logs["step-report-json"] Expect(reportLogs).NotTo(BeEmpty()) - var reportYAML any - err = yaml.Unmarshal([]byte(reportLogs), &reportYAML) + var report any + err = json.Unmarshal([]byte(reportLogs), &report) Expect(err).NotTo(HaveOccurred()) // The logs from the summary step are used by the UI to display an overview of diff --git a/tests/enterprise-contract/contract.go b/tests/enterprise-contract/contract.go index 745c2b4152..372e5f5371 100644 --- a/tests/enterprise-contract/contract.go +++ b/tests/enterprise-contract/contract.go @@ -326,9 +326,9 @@ var _ = framework.EnterpriseContractSuiteDescribe("Enterprise Contract E2E tests ContainElements(tekton.MatchTaskRunResultWithJSONPathValue(constants.OldTektonTaskTestOutputName, "{$.result}", `["FAILURE"]`)), ContainElements(tekton.MatchTaskRunResultWithJSONPathValue(constants.TektonTaskTestOutputName, "{$.result}", `["FAILURE"]`)), )) - //Get container step-report log details from pod - reportLog, err := utils.GetContainerLogs(fwk.AsKubeAdmin.CommonController.KubeInterface(), tr.Status.PodName, "step-report", namespace) - GinkgoWriter.Printf("*** Logs from pod '%s', container '%s':\n----- START -----%s----- END -----\n", tr.Status.PodName, "step-report", reportLog) + //Get container step-report-json log details from pod + reportLog, err := utils.GetContainerLogs(fwk.AsKubeAdmin.CommonController.KubeInterface(), tr.Status.PodName, "step-report-json", namespace) + GinkgoWriter.Printf("*** Logs from pod '%s', container '%s':\n----- START -----%s----- END -----\n", tr.Status.PodName, "step-report-json", reportLog) Expect(err).NotTo(HaveOccurred()) Expect(reportLog).Should(ContainSubstring("No image attestations found matching the given public key")) }) @@ -371,9 +371,9 @@ var _ = framework.EnterpriseContractSuiteDescribe("Enterprise Contract E2E tests ContainElements(tekton.MatchTaskRunResultWithJSONPathValue(constants.OldTektonTaskTestOutputName, "{$.result}", `["SUCCESS"]`)), ContainElements(tekton.MatchTaskRunResultWithJSONPathValue(constants.TektonTaskTestOutputName, "{$.result}", `["SUCCESS"]`)), )) - //Get container step-report log details from pod - reportLog, err := utils.GetContainerLogs(fwk.AsKubeAdmin.CommonController.KubeInterface(), tr.Status.PodName, "step-report", namespace) - GinkgoWriter.Printf("*** Logs from pod '%s', container '%s':\n----- START -----%s----- END -----\n", tr.Status.PodName, "step-report", reportLog) + //Get container step-report-json log details from pod + reportLog, err := utils.GetContainerLogs(fwk.AsKubeAdmin.CommonController.KubeInterface(), tr.Status.PodName, "step-report-json", namespace) + GinkgoWriter.Printf("*** Logs from pod '%s', container '%s':\n----- START -----%s----- END -----\n", tr.Status.PodName, "step-report-json", reportLog) Expect(err).NotTo(HaveOccurred()) }) }) @@ -454,9 +454,9 @@ var _ = framework.EnterpriseContractSuiteDescribe("Enterprise Contract E2E tests ContainElements(tekton.MatchTaskRunResultWithJSONPathValue(constants.TektonTaskTestOutputName, "{$.result}", `["FAILURE"]`)), )) - //Get container step-report log details from pod - reportLog, err := utils.GetContainerLogs(fwk.AsKubeAdmin.CommonController.KubeInterface(), tr.Status.PodName, "step-report", namespace) - GinkgoWriter.Printf("*** Logs from pod '%s', container '%s':\n----- START -----%s----- END -----\n", tr.Status.PodName, "step-report", reportLog) + //Get container step-report-json log details from pod + reportLog, err := utils.GetContainerLogs(fwk.AsKubeAdmin.CommonController.KubeInterface(), tr.Status.PodName, "step-report-json", namespace) + GinkgoWriter.Printf("*** Logs from pod '%s', container '%s':\n----- START -----%s----- END -----\n", tr.Status.PodName, "step-report-json", reportLog) Expect(err).NotTo(HaveOccurred()) Expect(reportLog).Should(MatchRegexp(`Pipeline task .* uses an (?:untrusted|unacceptable) task bundle`)) }) @@ -494,9 +494,9 @@ var _ = framework.EnterpriseContractSuiteDescribe("Enterprise Contract E2E tests ContainElements(tekton.MatchTaskRunResultWithJSONPathValue(constants.TektonTaskTestOutputName, "{$.result}", `["WARNING"]`)), )) - //Get container step-report log details from pod - reportLog, err := utils.GetContainerLogs(fwk.AsKubeAdmin.CommonController.KubeInterface(), tr.Status.PodName, "step-report", namespace) - GinkgoWriter.Printf("*** Logs from pod '%s', container '%s':\n----- START -----%s----- END -----\n", tr.Status.PodName, "step-report", reportLog) + //Get container step-report-json log details from pod + reportLog, err := utils.GetContainerLogs(fwk.AsKubeAdmin.CommonController.KubeInterface(), tr.Status.PodName, "step-report-json", namespace) + GinkgoWriter.Printf("*** Logs from pod '%s', container '%s':\n----- START -----%s----- END -----\n", tr.Status.PodName, "step-report-json", reportLog) Expect(err).NotTo(HaveOccurred()) Expect(reportLog).Should(MatchRegexp(`Pipeline task .* uses an unpinned task bundle reference`)) }) From 1a2e878fb178d146f0fcb31a438d465a95cb2970 Mon Sep 17 00:00:00 2001 From: Pavel Sturc Date: Thu, 26 Sep 2024 10:11:25 +0200 Subject: [PATCH 2/3] fix: add docker secret to tekton-results and minio (#1406) --- .../scripts/konflux-e2e-runner.sh | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/integration-tests/scripts/konflux-e2e-runner.sh b/integration-tests/scripts/konflux-e2e-runner.sh index 1fa27e8afd..d27bcfb744 100755 --- a/integration-tests/scripts/konflux-e2e-runner.sh +++ b/integration-tests/scripts/konflux-e2e-runner.sh @@ -129,17 +129,25 @@ done log "INFO" "running tests with github user: ${GITHUB_USER}" # ROSA HCP workaround for Docker limits -oc create namespace konflux-otel -oc create sa open-telemetry-opentelemetry-collector -n konflux-otel - +# for namespaces 'minio-operator' and 'tekton-results' oc get secret/pull-secret -n openshift-config --template='{{index .data ".dockerconfigjson" | base64decode}}' > ./global-pull-secret.json oc get secret -n openshift-config -o yaml pull-secret > global-pull-secret.yaml -yq -i '.metadata.namespace = "konflux-otel"' global-pull-secret.yaml - +yq -i e 'del(.metadata.namespace)' global-pull-secret.yaml oc registry login --registry=docker.io --auth-basic="$DOCKER_IO_AUTH" --to=./global-pull-secret.json -oc apply -f global-pull-secret.yaml -n konflux-otel -oc set data secret/pull-secret -n konflux-otel --from-file=.dockerconfigjson=./global-pull-secret.json -oc secrets link open-telemetry-opentelemetry-collector pull-secret --for=pull -n konflux-otel + +namespace_sa_names=$(cat << 'EOF' +minio-operator|minio-operator +tekton-results|storage-sa +EOF +) +while IFS='|' read -r ns sa_name; do + oc create namespace "$ns" --dry-run=client -o yaml | oc apply -f - + oc create sa "$sa_name" -n "$ns" --dry-run=client -o yaml | oc apply -f - + oc apply -f global-pull-secret.yaml -n "$ns" + oc set data secret/pull-secret -n "$ns" --from-file=.dockerconfigjson=./global-pull-secret.json + oc secrets link "$sa_name" pull-secret --for=pull -n "$ns" +done <<< "$namespace_sa_names" + # Prepare git, pair branch if necessary, Install Konflux and run e2e tests cd "$(mktemp -d)" From 7c9fa2d9632d4e3763021190c5b7efe3c97430bb Mon Sep 17 00:00:00 2001 From: Jing Qi Date: Thu, 26 Sep 2024 20:53:40 +0800 Subject: [PATCH 3/3] fix: increase konflux-e2e tests run time limitation (#1408) * fix: update_repo in release const.go Signed-off-by: Jing Qi * fix: increase konflux-e2e-tests time Signed-off-by: Jing Qi --------- Signed-off-by: Jing Qi --- integration-tests/pipelines/konflux-e2e-tests-pipeline.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/integration-tests/pipelines/konflux-e2e-tests-pipeline.yaml b/integration-tests/pipelines/konflux-e2e-tests-pipeline.yaml index be28bf76de..f5c25f1c7f 100644 --- a/integration-tests/pipelines/konflux-e2e-tests-pipeline.yaml +++ b/integration-tests/pipelines/konflux-e2e-tests-pipeline.yaml @@ -120,7 +120,7 @@ spec: - name: cloud-credential-key value: "$(params.cloud-credential-key)" - name: konflux-e2e-tests - timeout: 2h + timeout: 3h when: - input: "$(tasks.test-metadata.results.test-event-type)" operator: in @@ -250,4 +250,4 @@ spec: - name: git-org value: "$(tasks.test-metadata.results.git-org)" - name: git-revision - value: "$(tasks.test-metadata.results.git-revision)" \ No newline at end of file + value: "$(tasks.test-metadata.results.git-revision)"