From ff7e0f3b43ead789cdaa6a803088f71876bd65cd Mon Sep 17 00:00:00 2001 From: Kyle Lape Date: Fri, 15 Nov 2024 11:35:41 -0600 Subject: [PATCH] ROX-26784: Don't trigger Konflux builds against release branches (#1705) Also trigger builds when tags are pushed. --- .tekton/scanner-build.yaml | 14 +++++++++++--- .tekton/scanner-db-build.yaml | 14 +++++++++++--- .tekton/scanner-db-slim-build.yaml | 14 +++++++++++--- .tekton/scanner-slim-build.yaml | 14 +++++++++++--- 4 files changed, 44 insertions(+), 12 deletions(-) diff --git a/.tekton/scanner-build.yaml b/.tekton/scanner-build.yaml index 1c92e4c01..e5ad7b0e3 100644 --- a/.tekton/scanner-build.yaml +++ b/.tekton/scanner-build.yaml @@ -9,9 +9,17 @@ metadata: build.appstudio.redhat.com/target_branch: '{{target_branch}}' pipelinesascode.tekton.dev/max-keep-runs: "500" # TODO(ROX-21073): re-enable for all PR branches - pipelinesascode.tekton.dev/on-cel-expression: | - (event == "push" && target_branch.matches("^(master|release-.*)$")) || - (event == "pull_request" && (source_branch.matches("(konflux|renovate|appstudio|rhtap)") || body.pull_request.labels.exists(l, l.name == "konflux-build"))) + pipelinesascode.tekton.dev/on-cel-expression: ( + event == "push" && ( + source_branch == "master" || + target_branch.startsWith("refs/tags/") + ) + ) || ( + event == "pull_request" && ( + source_branch.matches("(konflux|renovate|appstudio|rhtap)") || + body.pull_request.labels.exists(l, l.name == "konflux-build") + ) + ) labels: appstudio.openshift.io/application: acs appstudio.openshift.io/component: scanner diff --git a/.tekton/scanner-db-build.yaml b/.tekton/scanner-db-build.yaml index be30894ba..f45fbe07c 100644 --- a/.tekton/scanner-db-build.yaml +++ b/.tekton/scanner-db-build.yaml @@ -9,9 +9,17 @@ metadata: build.appstudio.redhat.com/target_branch: '{{target_branch}}' pipelinesascode.tekton.dev/max-keep-runs: "500" # TODO(ROX-21073): re-enable for all PR branches - pipelinesascode.tekton.dev/on-cel-expression: | - (event == "push" && target_branch.matches("^(master|release-.*)$")) || - (event == "pull_request" && (source_branch.matches("(konflux|renovate|appstudio|rhtap)") || body.pull_request.labels.exists(l, l.name == "konflux-build"))) + pipelinesascode.tekton.dev/on-cel-expression: ( + event == "push" && ( + source_branch == "master" || + target_branch.startsWith("refs/tags/") + ) + ) || ( + event == "pull_request" && ( + source_branch.matches("(konflux|renovate|appstudio|rhtap)") || + body.pull_request.labels.exists(l, l.name == "konflux-build") + ) + ) labels: appstudio.openshift.io/application: acs appstudio.openshift.io/component: scanner-db diff --git a/.tekton/scanner-db-slim-build.yaml b/.tekton/scanner-db-slim-build.yaml index 5f8350637..860d6e3da 100644 --- a/.tekton/scanner-db-slim-build.yaml +++ b/.tekton/scanner-db-slim-build.yaml @@ -9,9 +9,17 @@ metadata: build.appstudio.redhat.com/target_branch: '{{target_branch}}' pipelinesascode.tekton.dev/max-keep-runs: "500" # TODO(ROX-21073): re-enable for all PR branches - pipelinesascode.tekton.dev/on-cel-expression: | - (event == "push" && target_branch.matches("^(master|release-.*)$")) || - (event == "pull_request" && (source_branch.matches("(konflux|renovate|appstudio|rhtap)") || body.pull_request.labels.exists(l, l.name == "konflux-build"))) + pipelinesascode.tekton.dev/on-cel-expression: ( + event == "push" && ( + source_branch == "master" || + target_branch.startsWith("refs/tags/") + ) + ) || ( + event == "pull_request" && ( + source_branch.matches("(konflux|renovate|appstudio|rhtap)") || + body.pull_request.labels.exists(l, l.name == "konflux-build") + ) + ) labels: appstudio.openshift.io/application: acs appstudio.openshift.io/component: scanner-db-slim diff --git a/.tekton/scanner-slim-build.yaml b/.tekton/scanner-slim-build.yaml index 6c7394bef..689767ec3 100644 --- a/.tekton/scanner-slim-build.yaml +++ b/.tekton/scanner-slim-build.yaml @@ -9,9 +9,17 @@ metadata: build.appstudio.redhat.com/target_branch: '{{target_branch}}' pipelinesascode.tekton.dev/max-keep-runs: "500" # TODO(ROX-21073): re-enable for all PR branches - pipelinesascode.tekton.dev/on-cel-expression: | - (event == "push" && target_branch.matches("^(master|release-.*)$")) || - (event == "pull_request" && (source_branch.matches("(konflux|renovate|appstudio|rhtap)") || body.pull_request.labels.exists(l, l.name == "konflux-build"))) + pipelinesascode.tekton.dev/on-cel-expression: ( + event == "push" && ( + source_branch == "master" || + target_branch.startsWith("refs/tags/") + ) + ) || ( + event == "pull_request" && ( + source_branch.matches("(konflux|renovate|appstudio|rhtap)") || + body.pull_request.labels.exists(l, l.name == "konflux-build") + ) + ) labels: appstudio.openshift.io/application: acs appstudio.openshift.io/component: scanner-slim