From 1cdeb235002fc36d29bc18efb2f49c86d5d17a0d Mon Sep 17 00:00:00 2001 From: Aleksandr Kurlov Date: Mon, 19 Jan 2026 11:05:20 +0100 Subject: [PATCH 01/18] Filter operator-index-pipelines more robust --- scripts/generate-releases.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/generate-releases.sh b/scripts/generate-releases.sh index 5546e703..53303134 100755 --- a/scripts/generate-releases.sh +++ b/scripts/generate-releases.sh @@ -78,7 +78,12 @@ validate_snapshots() { local pipelines_count local snapshots_count - pipelines_count="$(find ".tekton" -maxdepth 1 -type f -name "operator-index-ocp-*-build.yaml" | wc -l)" + pipelines_count=0 + for file in .tekton/*.yaml; do + if [[ -f "$file" ]] && "${YQ}" eval '.spec.pipelineRef.name == "operator-index-pipeline"' "$file" 2>/dev/null | grep -q "true"; then + ((pipelines_count++)) + fi + done snapshots_count="$(echo "$snapshots_data" | sed '/^$/d' | wc -l)" echo -e "Found the following snapshots for \033[0;32m$commit\033[0m commit:" >&2 From bda48e7b7c014b3e83e6b08f3eb765e5052c6c57 Mon Sep 17 00:00:00 2001 From: Aleksandr Kurlov Date: Tue, 20 Jan 2026 16:39:14 +0100 Subject: [PATCH 02/18] Add CI task to checks to validate pipeline naming scheme --- .tekton/checks.yaml | 7 ++++ .tekton/validate-pipeline-files-task.yaml | 49 +++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 .tekton/validate-pipeline-files-task.yaml diff --git a/.tekton/checks.yaml b/.tekton/checks.yaml index f2f17f8d..bced46c8 100644 --- a/.tekton/checks.yaml +++ b/.tekton/checks.yaml @@ -115,3 +115,10 @@ spec: retries: 3 taskRef: name: check-generated-files-up-to-date + + - name: validate-pipeline-files + params: + - name: SOURCE_ARTIFACT + value: $(tasks.clone-repository.results.SOURCE_ARTIFACT) + taskRef: + name: validate-pipeline-files diff --git a/.tekton/validate-pipeline-files-task.yaml b/.tekton/validate-pipeline-files-task.yaml new file mode 100644 index 00000000..4b82c656 --- /dev/null +++ b/.tekton/validate-pipeline-files-task.yaml @@ -0,0 +1,49 @@ +apiVersion: tekton.dev/v1 +kind: Task +metadata: + name: validate-pipeline-files + namespace: rh-acs-tenant +spec: + description: Validates that the number of .tekton/operator-index-ocp-*-build.yaml files matches the number of operator-index pipelines. This enforces the naming scheme for pipeline files. + params: + - name: SOURCE_ARTIFACT + description: The Trusted Artifact URI pointing to the artifact with + the application source code. This should be the result of the git-clone task, + results from other tasks might fail as dirty. + type: string + volumes: + - name: workdir + emptyDir: { } + stepTemplate: + volumeMounts: + - mountPath: /var/workdir + name: workdir + steps: + - name: use-trusted-artifact + image: quay.io/redhat-appstudio/build-trusted-artifacts:latest@sha256:9b180776a41d9a22a1c51539f1647c60defbbd55b44bbebdd4130e33512d8b0d + args: + - use + - $(params.SOURCE_ARTIFACT)=/var/workdir/source + - name: validate-pipeline-file-count + image: quay.io/rhacs-eng/konflux-tasks:latest@sha256:143219f9f70bf90ce80f7e0a2e21b88b8a71639a9e4cd5a5d32f70cb04e8a23d + workingDir: /var/workdir/source + script: | + #!/usr/bin/env bash + set -euo pipefail + + named_files_count=$(ls -1 .tekton/operator-index-ocp-*-build.yaml 2>/dev/null | wc -l) + pipelines_count=0 + for file in .tekton/*.yaml; do + if [[ -f "$file" ]] && yq eval '.spec.pipelineRef.name == "operator-index-pipeline"' "$file" 2>/dev/null | grep -q "true"; then + ((pipelines_count++)) + fi + done + + if [[ "$named_files_count" -ne "$pipelines_count" ]]; then + echo >&2 "ERROR: The number of .tekton/operator-index-ocp-*-build.yaml files ($named_files_count) does not match" + echo >&2 " the number of files with .spec.pipelineRef.name == 'operator-index-pipeline' ($pipelines_count)" + echo >&2 "" + echo >&2 "All pipeline files referencing 'operator-index-pipeline' must follow the naming scheme:" + echo >&2 " .tekton/operator-index-ocp-vX-YZ-build.yaml" + exit 1 + fi From 00af41ab4a097471094fe2439165239e43c40439 Mon Sep 17 00:00:00 2001 From: Aleksandr Kurlov Date: Tue, 20 Jan 2026 16:43:02 +0100 Subject: [PATCH 03/18] Update image --- .tekton/validate-pipeline-files-task.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.tekton/validate-pipeline-files-task.yaml b/.tekton/validate-pipeline-files-task.yaml index 4b82c656..0a9ae5c5 100644 --- a/.tekton/validate-pipeline-files-task.yaml +++ b/.tekton/validate-pipeline-files-task.yaml @@ -25,7 +25,7 @@ spec: - use - $(params.SOURCE_ARTIFACT)=/var/workdir/source - name: validate-pipeline-file-count - image: quay.io/rhacs-eng/konflux-tasks:latest@sha256:143219f9f70bf90ce80f7e0a2e21b88b8a71639a9e4cd5a5d32f70cb04e8a23d + image: registry.redhat.io/ubi9/go-toolset@sha256:e8938564f866174a6d79e55dfe577c2ed184b1f53e91d782173fb69b07ce69ef workingDir: /var/workdir/source script: | #!/usr/bin/env bash From 98eb9cbaba0e6658dbfdb3fcf249d1c335732791 Mon Sep 17 00:00:00 2001 From: Aleksandr Kurlov Date: Tue, 20 Jan 2026 17:33:08 +0100 Subject: [PATCH 04/18] Use image with yq installed --- .tekton/validate-pipeline-files-task.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.tekton/validate-pipeline-files-task.yaml b/.tekton/validate-pipeline-files-task.yaml index 0a9ae5c5..0fd659a5 100644 --- a/.tekton/validate-pipeline-files-task.yaml +++ b/.tekton/validate-pipeline-files-task.yaml @@ -25,7 +25,7 @@ spec: - use - $(params.SOURCE_ARTIFACT)=/var/workdir/source - name: validate-pipeline-file-count - image: registry.redhat.io/ubi9/go-toolset@sha256:e8938564f866174a6d79e55dfe577c2ed184b1f53e91d782173fb69b07ce69ef + image: quay.io/konflux-ci/release-service-utils:latest@sha256:2f9e6863e82bbc9ddce5a290f3fd0e87657c475e3de8a832b2ef7f8d0671e7d3 workingDir: /var/workdir/source script: | #!/usr/bin/env bash From 2968e551293c1dbc9e9bb7b6bc874fa8476f73e7 Mon Sep 17 00:00:00 2001 From: Aleksandr Kurlov Date: Tue, 20 Jan 2026 17:49:21 +0100 Subject: [PATCH 05/18] Apply suggestions from code review Co-authored-by: Tom Martensen --- .tekton/validate-pipeline-files-task.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.tekton/validate-pipeline-files-task.yaml b/.tekton/validate-pipeline-files-task.yaml index 0fd659a5..8a866b27 100644 --- a/.tekton/validate-pipeline-files-task.yaml +++ b/.tekton/validate-pipeline-files-task.yaml @@ -31,7 +31,7 @@ spec: #!/usr/bin/env bash set -euo pipefail - named_files_count=$(ls -1 .tekton/operator-index-ocp-*-build.yaml 2>/dev/null | wc -l) + named_files_count=$(ls -1 .tekton/operator-index-ocp-*-*-build.yaml 2>/dev/null | wc -l) pipelines_count=0 for file in .tekton/*.yaml; do if [[ -f "$file" ]] && yq eval '.spec.pipelineRef.name == "operator-index-pipeline"' "$file" 2>/dev/null | grep -q "true"; then @@ -44,6 +44,6 @@ spec: echo >&2 " the number of files with .spec.pipelineRef.name == 'operator-index-pipeline' ($pipelines_count)" echo >&2 "" echo >&2 "All pipeline files referencing 'operator-index-pipeline' must follow the naming scheme:" - echo >&2 " .tekton/operator-index-ocp-vX-YZ-build.yaml" + echo >&2 " .tekton/operator-index-ocp-vX-Y-build.yaml" exit 1 fi From 4915783efcae1e36057b122e040fcd92412e8364 Mon Sep 17 00:00:00 2001 From: Aleksandr Kurlov Date: Tue, 20 Jan 2026 17:55:00 +0100 Subject: [PATCH 06/18] Add ok message --- .tekton/validate-pipeline-files-task.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.tekton/validate-pipeline-files-task.yaml b/.tekton/validate-pipeline-files-task.yaml index 8a866b27..b54e6184 100644 --- a/.tekton/validate-pipeline-files-task.yaml +++ b/.tekton/validate-pipeline-files-task.yaml @@ -47,3 +47,5 @@ spec: echo >&2 " .tekton/operator-index-ocp-vX-Y-build.yaml" exit 1 fi + + echo "Pipeline file count validation passed: $pipelines_count files" From 351970cdc62b66cc798ff06a935cc716a5731e20 Mon Sep 17 00:00:00 2001 From: Aleksandr Kurlov Date: Tue, 20 Jan 2026 18:00:55 +0100 Subject: [PATCH 07/18] Rename task --- .tekton/validate-pipeline-files-task.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.tekton/validate-pipeline-files-task.yaml b/.tekton/validate-pipeline-files-task.yaml index b54e6184..92c02c23 100644 --- a/.tekton/validate-pipeline-files-task.yaml +++ b/.tekton/validate-pipeline-files-task.yaml @@ -24,7 +24,7 @@ spec: args: - use - $(params.SOURCE_ARTIFACT)=/var/workdir/source - - name: validate-pipeline-file-count + - name: validate-pipeline-files image: quay.io/konflux-ci/release-service-utils:latest@sha256:2f9e6863e82bbc9ddce5a290f3fd0e87657c475e3de8a832b2ef7f8d0671e7d3 workingDir: /var/workdir/source script: | From c942affb92ff39e9234e803fdf0e5cdd66039ea7 Mon Sep 17 00:00:00 2001 From: Aleksandr Kurlov Date: Tue, 20 Jan 2026 18:04:17 +0100 Subject: [PATCH 08/18] Fix task start --- .tekton/validate-pipeline-files-task.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.tekton/validate-pipeline-files-task.yaml b/.tekton/validate-pipeline-files-task.yaml index 92c02c23..b6517489 100644 --- a/.tekton/validate-pipeline-files-task.yaml +++ b/.tekton/validate-pipeline-files-task.yaml @@ -14,6 +14,8 @@ spec: volumes: - name: workdir emptyDir: { } + - name: deps + emptyDir: { } stepTemplate: volumeMounts: - mountPath: /var/workdir @@ -27,6 +29,8 @@ spec: - name: validate-pipeline-files image: quay.io/konflux-ci/release-service-utils:latest@sha256:2f9e6863e82bbc9ddce5a290f3fd0e87657c475e3de8a832b2ef7f8d0671e7d3 workingDir: /var/workdir/source + securityContext: + runAsUser: 0 script: | #!/usr/bin/env bash set -euo pipefail From 453cdc8f955f8fdae03383cf3a071676daa4ba77 Mon Sep 17 00:00:00 2001 From: Aleksandr Kurlov Date: Tue, 20 Jan 2026 18:05:43 +0100 Subject: [PATCH 09/18] Add retries --- .tekton/checks.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.tekton/checks.yaml b/.tekton/checks.yaml index bced46c8..a44cfdbf 100644 --- a/.tekton/checks.yaml +++ b/.tekton/checks.yaml @@ -120,5 +120,6 @@ spec: params: - name: SOURCE_ARTIFACT value: $(tasks.clone-repository.results.SOURCE_ARTIFACT) + retries: 3 taskRef: name: validate-pipeline-files From 19eb10c8869e988a172e09a45751a99125f69e94 Mon Sep 17 00:00:00 2001 From: Aleksandr Kurlov Date: Tue, 20 Jan 2026 18:09:46 +0100 Subject: [PATCH 10/18] Add debug --- .tekton/validate-pipeline-files-task.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.tekton/validate-pipeline-files-task.yaml b/.tekton/validate-pipeline-files-task.yaml index b6517489..a5eb9577 100644 --- a/.tekton/validate-pipeline-files-task.yaml +++ b/.tekton/validate-pipeline-files-task.yaml @@ -34,6 +34,9 @@ spec: script: | #!/usr/bin/env bash set -euo pipefail + set -x + + echo "Validating pipeline files..." named_files_count=$(ls -1 .tekton/operator-index-ocp-*-*-build.yaml 2>/dev/null | wc -l) pipelines_count=0 From 50cedc4b69398a99e851f77d8bc20215894988a7 Mon Sep 17 00:00:00 2001 From: Aleksandr Kurlov Date: Tue, 20 Jan 2026 18:14:28 +0100 Subject: [PATCH 11/18] Add debug --- .tekton/validate-pipeline-files-task.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.tekton/validate-pipeline-files-task.yaml b/.tekton/validate-pipeline-files-task.yaml index a5eb9577..b2f5f38c 100644 --- a/.tekton/validate-pipeline-files-task.yaml +++ b/.tekton/validate-pipeline-files-task.yaml @@ -46,6 +46,8 @@ spec: fi done + echo "Compare..." + if [[ "$named_files_count" -ne "$pipelines_count" ]]; then echo >&2 "ERROR: The number of .tekton/operator-index-ocp-*-build.yaml files ($named_files_count) does not match" echo >&2 " the number of files with .spec.pipelineRef.name == 'operator-index-pipeline' ($pipelines_count)" From 998a295d1851d64e9dd14fa44bc7fc196902c454 Mon Sep 17 00:00:00 2001 From: Aleksandr Kurlov Date: Tue, 20 Jan 2026 18:16:34 +0100 Subject: [PATCH 12/18] Add debug --- .tekton/validate-pipeline-files-task.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.tekton/validate-pipeline-files-task.yaml b/.tekton/validate-pipeline-files-task.yaml index b2f5f38c..4782358f 100644 --- a/.tekton/validate-pipeline-files-task.yaml +++ b/.tekton/validate-pipeline-files-task.yaml @@ -34,7 +34,6 @@ spec: script: | #!/usr/bin/env bash set -euo pipefail - set -x echo "Validating pipeline files..." @@ -47,6 +46,7 @@ spec: done echo "Compare..." + set -x if [[ "$named_files_count" -ne "$pipelines_count" ]]; then echo >&2 "ERROR: The number of .tekton/operator-index-ocp-*-build.yaml files ($named_files_count) does not match" From 0f42f720164b65b510b7756f4f0c9eef392ba19e Mon Sep 17 00:00:00 2001 From: Aleksandr Kurlov Date: Tue, 20 Jan 2026 18:20:07 +0100 Subject: [PATCH 13/18] refactor counting --- .tekton/validate-pipeline-files-task.yaml | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/.tekton/validate-pipeline-files-task.yaml b/.tekton/validate-pipeline-files-task.yaml index 4782358f..b669eeca 100644 --- a/.tekton/validate-pipeline-files-task.yaml +++ b/.tekton/validate-pipeline-files-task.yaml @@ -37,19 +37,26 @@ spec: echo "Validating pipeline files..." - named_files_count=$(ls -1 .tekton/operator-index-ocp-*-*-build.yaml 2>/dev/null | wc -l) + # Count files matching the naming pattern + named_files_count=0 + for f in .tekton/operator-index-ocp-*-*-build.yaml; do + if [[ -f "$f" ]]; then + ((named_files_count++)) + fi + done + echo "Found $named_files_count files matching pattern .tekton/operator-index-ocp-*-*-build.yaml" + + # Count files with operator-index-pipeline reference pipelines_count=0 for file in .tekton/*.yaml; do if [[ -f "$file" ]] && yq eval '.spec.pipelineRef.name == "operator-index-pipeline"' "$file" 2>/dev/null | grep -q "true"; then ((pipelines_count++)) fi done - - echo "Compare..." - set -x + echo "Found $pipelines_count files with .spec.pipelineRef.name == 'operator-index-pipeline'" if [[ "$named_files_count" -ne "$pipelines_count" ]]; then - echo >&2 "ERROR: The number of .tekton/operator-index-ocp-*-build.yaml files ($named_files_count) does not match" + echo >&2 "ERROR: The number of .tekton/operator-index-ocp-*-*-build.yaml files ($named_files_count) does not match" echo >&2 " the number of files with .spec.pipelineRef.name == 'operator-index-pipeline' ($pipelines_count)" echo >&2 "" echo >&2 "All pipeline files referencing 'operator-index-pipeline' must follow the naming scheme:" @@ -57,4 +64,4 @@ spec: exit 1 fi - echo "Pipeline file count validation passed: $pipelines_count files" + echo "✓ Pipeline file count validation passed: $pipelines_count files" From 39faef15f6635906b4b6b2c0cda21827b822ca03 Mon Sep 17 00:00:00 2001 From: Aleksandr Kurlov Date: Tue, 20 Jan 2026 18:24:38 +0100 Subject: [PATCH 14/18] Looking for sanity --- .tekton/validate-pipeline-files-task.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.tekton/validate-pipeline-files-task.yaml b/.tekton/validate-pipeline-files-task.yaml index b669eeca..6c91c6a9 100644 --- a/.tekton/validate-pipeline-files-task.yaml +++ b/.tekton/validate-pipeline-files-task.yaml @@ -38,12 +38,12 @@ spec: echo "Validating pipeline files..." # Count files matching the naming pattern - named_files_count=0 - for f in .tekton/operator-index-ocp-*-*-build.yaml; do - if [[ -f "$f" ]]; then - ((named_files_count++)) - fi - done + named_files_count=10 + # for f in .tekton/operator-index-ocp-*-*-build.yaml; do + # if [[ -f "$f" ]]; then + # ((named_files_count++)) + # fi + # done echo "Found $named_files_count files matching pattern .tekton/operator-index-ocp-*-*-build.yaml" # Count files with operator-index-pipeline reference From 1847bddac090c5035ade5955bfd5fa9c10884dd0 Mon Sep 17 00:00:00 2001 From: Aleksandr Kurlov Date: Tue, 20 Jan 2026 18:26:59 +0100 Subject: [PATCH 15/18] Looking for sanity 2 --- .tekton/validate-pipeline-files-task.yaml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.tekton/validate-pipeline-files-task.yaml b/.tekton/validate-pipeline-files-task.yaml index 6c91c6a9..c4be01b3 100644 --- a/.tekton/validate-pipeline-files-task.yaml +++ b/.tekton/validate-pipeline-files-task.yaml @@ -45,14 +45,15 @@ spec: # fi # done echo "Found $named_files_count files matching pattern .tekton/operator-index-ocp-*-*-build.yaml" + ls -la # Count files with operator-index-pipeline reference - pipelines_count=0 - for file in .tekton/*.yaml; do - if [[ -f "$file" ]] && yq eval '.spec.pipelineRef.name == "operator-index-pipeline"' "$file" 2>/dev/null | grep -q "true"; then - ((pipelines_count++)) - fi - done + pipelines_count=10 + # for file in .tekton/*.yaml; do + # if [[ -f "$file" ]] && yq eval '.spec.pipelineRef.name == "operator-index-pipeline"' "$file" 2>/dev/null | grep -q "true"; then + # ((pipelines_count++)) + # fi + # done echo "Found $pipelines_count files with .spec.pipelineRef.name == 'operator-index-pipeline'" if [[ "$named_files_count" -ne "$pipelines_count" ]]; then From 06323db48413999c05c89e8994c0ef8baa4745ac Mon Sep 17 00:00:00 2001 From: Aleksandr Kurlov Date: Tue, 20 Jan 2026 18:32:39 +0100 Subject: [PATCH 16/18] While ifs instead --- .tekton/validate-pipeline-files-task.yaml | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/.tekton/validate-pipeline-files-task.yaml b/.tekton/validate-pipeline-files-task.yaml index c4be01b3..ec54f3de 100644 --- a/.tekton/validate-pipeline-files-task.yaml +++ b/.tekton/validate-pipeline-files-task.yaml @@ -38,22 +38,16 @@ spec: echo "Validating pipeline files..." # Count files matching the naming pattern - named_files_count=10 - # for f in .tekton/operator-index-ocp-*-*-build.yaml; do - # if [[ -f "$f" ]]; then - # ((named_files_count++)) - # fi - # done + named_files_count=$(find .tekton -maxdepth 1 -name 'operator-index-ocp-*-*-build.yaml' -type f | wc -l | tr -d ' ') echo "Found $named_files_count files matching pattern .tekton/operator-index-ocp-*-*-build.yaml" - ls -la # Count files with operator-index-pipeline reference - pipelines_count=10 - # for file in .tekton/*.yaml; do - # if [[ -f "$file" ]] && yq eval '.spec.pipelineRef.name == "operator-index-pipeline"' "$file" 2>/dev/null | grep -q "true"; then - # ((pipelines_count++)) - # fi - # done + pipelines_count=0 + while IFS= read -r -d '' file; do + if yq eval '.spec.pipelineRef.name == "operator-index-pipeline"' "$file" 2>/dev/null | grep -q "true"; then + pipelines_count=$((pipelines_count + 1)) + fi + done < <(find .tekton -maxdepth 1 -name '*.yaml' -type f -print0) echo "Found $pipelines_count files with .spec.pipelineRef.name == 'operator-index-pipeline'" if [[ "$named_files_count" -ne "$pipelines_count" ]]; then From b6c17a167ec74072a1c43ca710b8ed569a4955de Mon Sep 17 00:00:00 2001 From: Aleksandr Kurlov Date: Tue, 20 Jan 2026 18:36:00 +0100 Subject: [PATCH 17/18] Remove debugging --- .tekton/checks.yaml | 1 - .tekton/validate-pipeline-files-task.yaml | 8 +------- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/.tekton/checks.yaml b/.tekton/checks.yaml index a44cfdbf..bced46c8 100644 --- a/.tekton/checks.yaml +++ b/.tekton/checks.yaml @@ -120,6 +120,5 @@ spec: params: - name: SOURCE_ARTIFACT value: $(tasks.clone-repository.results.SOURCE_ARTIFACT) - retries: 3 taskRef: name: validate-pipeline-files diff --git a/.tekton/validate-pipeline-files-task.yaml b/.tekton/validate-pipeline-files-task.yaml index ec54f3de..a93226e3 100644 --- a/.tekton/validate-pipeline-files-task.yaml +++ b/.tekton/validate-pipeline-files-task.yaml @@ -14,8 +14,6 @@ spec: volumes: - name: workdir emptyDir: { } - - name: deps - emptyDir: { } stepTemplate: volumeMounts: - mountPath: /var/workdir @@ -29,19 +27,15 @@ spec: - name: validate-pipeline-files image: quay.io/konflux-ci/release-service-utils:latest@sha256:2f9e6863e82bbc9ddce5a290f3fd0e87657c475e3de8a832b2ef7f8d0671e7d3 workingDir: /var/workdir/source - securityContext: - runAsUser: 0 script: | #!/usr/bin/env bash set -euo pipefail echo "Validating pipeline files..." - # Count files matching the naming pattern named_files_count=$(find .tekton -maxdepth 1 -name 'operator-index-ocp-*-*-build.yaml' -type f | wc -l | tr -d ' ') echo "Found $named_files_count files matching pattern .tekton/operator-index-ocp-*-*-build.yaml" - # Count files with operator-index-pipeline reference pipelines_count=0 while IFS= read -r -d '' file; do if yq eval '.spec.pipelineRef.name == "operator-index-pipeline"' "$file" 2>/dev/null | grep -q "true"; then @@ -59,4 +53,4 @@ spec: exit 1 fi - echo "✓ Pipeline file count validation passed: $pipelines_count files" + echo "Pipeline file naming validation passed: $pipelines_count files" From 3721007c57409485e2eb1535862d9e0d67c027c6 Mon Sep 17 00:00:00 2001 From: Aleksandr Kurlov Date: Wed, 21 Jan 2026 10:49:50 +0100 Subject: [PATCH 18/18] Use for loop for files --- .tekton/validate-pipeline-files-task.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.tekton/validate-pipeline-files-task.yaml b/.tekton/validate-pipeline-files-task.yaml index a93226e3..2fac36de 100644 --- a/.tekton/validate-pipeline-files-task.yaml +++ b/.tekton/validate-pipeline-files-task.yaml @@ -37,11 +37,11 @@ spec: echo "Found $named_files_count files matching pattern .tekton/operator-index-ocp-*-*-build.yaml" pipelines_count=0 - while IFS= read -r -d '' file; do + for file in .tekton/*.yaml; do if yq eval '.spec.pipelineRef.name == "operator-index-pipeline"' "$file" 2>/dev/null | grep -q "true"; then pipelines_count=$((pipelines_count + 1)) fi - done < <(find .tekton -maxdepth 1 -name '*.yaml' -type f -print0) + done echo "Found $pipelines_count files with .spec.pipelineRef.name == 'operator-index-pipeline'" if [[ "$named_files_count" -ne "$pipelines_count" ]]; then