From 6b0c5b6e46d25d310bd535f9321044838246e9d3 Mon Sep 17 00:00:00 2001 From: Misha Sugakov Date: Thu, 8 Aug 2024 10:10:56 +0200 Subject: [PATCH 1/3] Add Konflux pipeline activation through a label --- .tekton/scanner-build.yaml | 4 +++- .tekton/scanner-db-build.yaml | 4 +++- .tekton/scanner-db-slim-build.yaml | 4 +++- .tekton/scanner-slim-build.yaml | 4 +++- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.tekton/scanner-build.yaml b/.tekton/scanner-build.yaml index 4bb0e7139..a7883713a 100644 --- a/.tekton/scanner-build.yaml +++ b/.tekton/scanner-build.yaml @@ -9,7 +9,9 @@ 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|appstudio|rhtap)")) + pipelinesascode.tekton.dev/on-cel-expression: | + (event == "push" && target_branch.matches("^(master|release-.*)$")) || + (event == "pull_request" && (source_branch.matches("(konflux|appstudio|rhtap)") || "konflux-build" in body.pull_request.labels)) creationTimestamp: null labels: appstudio.openshift.io/application: acs diff --git a/.tekton/scanner-db-build.yaml b/.tekton/scanner-db-build.yaml index f69610f3d..5a0d333e5 100644 --- a/.tekton/scanner-db-build.yaml +++ b/.tekton/scanner-db-build.yaml @@ -9,7 +9,9 @@ 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|appstudio|rhtap)")) + pipelinesascode.tekton.dev/on-cel-expression: | + (event == "push" && target_branch.matches("^(master|release-.*)$")) || + (event == "pull_request" && (source_branch.matches("(konflux|appstudio|rhtap)") || "konflux-build" in body.pull_request.labels)) creationTimestamp: null labels: appstudio.openshift.io/application: acs diff --git a/.tekton/scanner-db-slim-build.yaml b/.tekton/scanner-db-slim-build.yaml index 0050b64c8..ded85c86a 100644 --- a/.tekton/scanner-db-slim-build.yaml +++ b/.tekton/scanner-db-slim-build.yaml @@ -9,7 +9,9 @@ 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|appstudio|rhtap)")) + pipelinesascode.tekton.dev/on-cel-expression: | + (event == "push" && target_branch.matches("^(master|release-.*)$")) || + (event == "pull_request" && (source_branch.matches("(konflux|appstudio|rhtap)") || "konflux-build" in body.pull_request.labels)) creationTimestamp: null labels: appstudio.openshift.io/application: acs diff --git a/.tekton/scanner-slim-build.yaml b/.tekton/scanner-slim-build.yaml index 1c74f08ee..df8d4c244 100644 --- a/.tekton/scanner-slim-build.yaml +++ b/.tekton/scanner-slim-build.yaml @@ -9,7 +9,9 @@ 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|appstudio|rhtap)")) + pipelinesascode.tekton.dev/on-cel-expression: | + (event == "push" && target_branch.matches("^(master|release-.*)$")) || + (event == "pull_request" && (source_branch.matches("(konflux|appstudio|rhtap)") || "konflux-build" in body.pull_request.labels)) creationTimestamp: null labels: appstudio.openshift.io/application: acs From 8a07f92b1422944f2b4f7f9a1177caa0cf4ebf07 Mon Sep 17 00:00:00 2001 From: Misha Sugakov Date: Thu, 8 Aug 2024 10:13:19 +0200 Subject: [PATCH 2/3] Get rid of `creationTimestamp` attribute GoLand highlights it as not modifiable by user and so no reason to have it in our manifests. --- .tekton/scanner-build.yaml | 1 - .tekton/scanner-db-build.yaml | 1 - .tekton/scanner-db-slim-build.yaml | 1 - .tekton/scanner-slim-build.yaml | 1 - 4 files changed, 4 deletions(-) diff --git a/.tekton/scanner-build.yaml b/.tekton/scanner-build.yaml index a7883713a..2c4630477 100644 --- a/.tekton/scanner-build.yaml +++ b/.tekton/scanner-build.yaml @@ -12,7 +12,6 @@ metadata: pipelinesascode.tekton.dev/on-cel-expression: | (event == "push" && target_branch.matches("^(master|release-.*)$")) || (event == "pull_request" && (source_branch.matches("(konflux|appstudio|rhtap)") || "konflux-build" in body.pull_request.labels)) - creationTimestamp: null 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 5a0d333e5..4687ef503 100644 --- a/.tekton/scanner-db-build.yaml +++ b/.tekton/scanner-db-build.yaml @@ -12,7 +12,6 @@ metadata: pipelinesascode.tekton.dev/on-cel-expression: | (event == "push" && target_branch.matches("^(master|release-.*)$")) || (event == "pull_request" && (source_branch.matches("(konflux|appstudio|rhtap)") || "konflux-build" in body.pull_request.labels)) - creationTimestamp: null 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 ded85c86a..f6ef61cce 100644 --- a/.tekton/scanner-db-slim-build.yaml +++ b/.tekton/scanner-db-slim-build.yaml @@ -12,7 +12,6 @@ metadata: pipelinesascode.tekton.dev/on-cel-expression: | (event == "push" && target_branch.matches("^(master|release-.*)$")) || (event == "pull_request" && (source_branch.matches("(konflux|appstudio|rhtap)") || "konflux-build" in body.pull_request.labels)) - creationTimestamp: null 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 df8d4c244..3c394e8fa 100644 --- a/.tekton/scanner-slim-build.yaml +++ b/.tekton/scanner-slim-build.yaml @@ -12,7 +12,6 @@ metadata: pipelinesascode.tekton.dev/on-cel-expression: | (event == "push" && target_branch.matches("^(master|release-.*)$")) || (event == "pull_request" && (source_branch.matches("(konflux|appstudio|rhtap)") || "konflux-build" in body.pull_request.labels)) - creationTimestamp: null labels: appstudio.openshift.io/application: acs appstudio.openshift.io/component: scanner-slim From 53b0dcc45ba26d795cd65af8fe45687988b0883f Mon Sep 17 00:00:00 2001 From: Misha Sugakov Date: Thu, 8 Aug 2024 11:02:25 +0200 Subject: [PATCH 3/3] Apply functioning filter --- .tekton/scanner-build.yaml | 2 +- .tekton/scanner-db-build.yaml | 2 +- .tekton/scanner-db-slim-build.yaml | 2 +- .tekton/scanner-slim-build.yaml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.tekton/scanner-build.yaml b/.tekton/scanner-build.yaml index 2c4630477..70765fc46 100644 --- a/.tekton/scanner-build.yaml +++ b/.tekton/scanner-build.yaml @@ -11,7 +11,7 @@ metadata: # 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|appstudio|rhtap)") || "konflux-build" in body.pull_request.labels)) + (event == "pull_request" && (source_branch.matches("(konflux|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 4687ef503..989b12224 100644 --- a/.tekton/scanner-db-build.yaml +++ b/.tekton/scanner-db-build.yaml @@ -11,7 +11,7 @@ metadata: # 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|appstudio|rhtap)") || "konflux-build" in body.pull_request.labels)) + (event == "pull_request" && (source_branch.matches("(konflux|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 f6ef61cce..26ec97b14 100644 --- a/.tekton/scanner-db-slim-build.yaml +++ b/.tekton/scanner-db-slim-build.yaml @@ -11,7 +11,7 @@ metadata: # 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|appstudio|rhtap)") || "konflux-build" in body.pull_request.labels)) + (event == "pull_request" && (source_branch.matches("(konflux|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 3c394e8fa..c02a6b2dd 100644 --- a/.tekton/scanner-slim-build.yaml +++ b/.tekton/scanner-slim-build.yaml @@ -11,7 +11,7 @@ metadata: # 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|appstudio|rhtap)") || "konflux-build" in body.pull_request.labels)) + (event == "pull_request" && (source_branch.matches("(konflux|appstudio|rhtap)") || body.pull_request.labels.exists(l, l.name == "konflux-build"))) labels: appstudio.openshift.io/application: acs appstudio.openshift.io/component: scanner-slim