From 82791b084065f2c92678069448a6759f1dac4365 Mon Sep 17 00:00:00 2001 From: Mladen Todorovic Date: Thu, 26 Mar 2026 10:39:42 +0100 Subject: [PATCH] Modify trigger logic and tweak annotations --- .tekton/acs-mcp-server-pull-request.yaml | 20 +++++++++++++++--- .tekton/acs-mcp-server-push.yaml | 27 ++++++++++++++++++++---- 2 files changed, 40 insertions(+), 7 deletions(-) diff --git a/.tekton/acs-mcp-server-pull-request.yaml b/.tekton/acs-mcp-server-pull-request.yaml index 7f22c50..9ec64aa 100644 --- a/.tekton/acs-mcp-server-pull-request.yaml +++ b/.tekton/acs-mcp-server-pull-request.yaml @@ -7,9 +7,23 @@ metadata: build.appstudio.redhat.com/pull_request_number: '{{pull_request_number}}' build.appstudio.redhat.com/target_branch: '{{target_branch}}' pipelinesascode.tekton.dev/cancel-in-progress: "true" - pipelinesascode.tekton.dev/max-keep-runs: "3" - pipelinesascode.tekton.dev/on-cel-expression: event == "pull_request" && target_branch - == "main" + pipelinesascode.tekton.dev/max-keep-runs: "10" + pipelinesascode.tekton.dev/on-label: "[]" + # - body.action != "ready_for_review" prevents double-triggering when a draft PR is marked ready for review. + # - trigger only for PRs on main and release branches. + # - support triggering by label: "konflux-build" + pipelinesascode.tekton.dev/on-cel-expression: | + ( + event == "pull_request" && body.action != "ready_for_review" && ( + target_branch == "main" || + target_branch.startsWith("release-") || + ( + has(body.pull_request) && + has(body.pull_request.labels) && + body.pull_request.labels.exists(l, l.name == "konflux-build") + ) + ) + ) labels: appstudio.openshift.io/application: acs-mcp appstudio.openshift.io/component: acs-mcp-server diff --git a/.tekton/acs-mcp-server-push.yaml b/.tekton/acs-mcp-server-push.yaml index dfabcd7..c5df810 100644 --- a/.tekton/acs-mcp-server-push.yaml +++ b/.tekton/acs-mcp-server-push.yaml @@ -4,11 +4,30 @@ metadata: annotations: build.appstudio.openshift.io/repo: https://github.com/stackrox/stackrox-mcp?rev={{revision}} build.appstudio.redhat.com/commit_sha: '{{revision}}' + build.appstudio.redhat.com/pull_request_number: '{{pull_request_number}}' build.appstudio.redhat.com/target_branch: '{{target_branch}}' - pipelinesascode.tekton.dev/cancel-in-progress: "false" - pipelinesascode.tekton.dev/max-keep-runs: "3" - pipelinesascode.tekton.dev/on-cel-expression: event == "push" && target_branch - == "main" + pipelinesascode.tekton.dev/max-keep-runs: "10" + pipelinesascode.tekton.dev/on-label: "[]" + # For push trigger: + # - trigger on commit push on main or release branch. + # - trigger on tag pushes. + # For PR triggers: + # - body.action != "ready_for_review" prevents double-triggering when a draft PR is marked ready for review. + # - trigger only for PRs on release branches. + # - support triggering by label: "konflux-build" + pipelinesascode.tekton.dev/on-cel-expression: | + ( + event == "push" && target_branch.matches("^(main|release-.*|refs/tags/.*)$") + ) || ( + event == "pull_request" && body.action != "ready_for_review" && ( + target_branch.startsWith("release-") || + ( + has(body.pull_request) && + has(body.pull_request.labels) && + body.pull_request.labels.exists(l, l.name == "konflux-build") + ) + ) + ) labels: appstudio.openshift.io/application: acs-mcp appstudio.openshift.io/component: acs-mcp-server