From a4c55735ec86155621c799caff35020454e4ce80 Mon Sep 17 00:00:00 2001 From: Chmouel Boudjnah Date: Mon, 25 Nov 2024 11:41:44 +0100 Subject: [PATCH] feat(dogfood): use cancel-in-progress/path-change Added `cancel-in-progress` annotation to multiple Tekton YAML files to ensure that in-progress pipeline runs are canceled when new runs are triggered. Use `on-path-change` and `on-target-event` annotations to as well for path change. Signed-off-by: Chmouel Boudjnah --- .tekton/doc.yaml | 7 ++++--- .tekton/generate-coverage-release.yaml | 1 + .tekton/go.yaml | 6 ++++-- .tekton/linter.yaml | 1 + .tekton/release-pipeline.yaml | 1 + 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/.tekton/doc.yaml b/.tekton/doc.yaml index 65b2e199c..26531b684 100644 --- a/.tekton/doc.yaml +++ b/.tekton/doc.yaml @@ -4,10 +4,11 @@ kind: PipelineRun metadata: name: doc-generation annotations: - pipelinesascode.tekton.dev/task: "[git-clone]" pipelinesascode.tekton.dev/max-keep-runs: "2" - pipelinesascode.tekton.dev/on-cel-expression: | - event == "pull_request" && "docs/***".pathChanged() + pipelinesascode.tekton.dev/cancel-in-progress: "true" + pipelinesascode.tekton.dev/on-event: "pull_request" + pipelinesascode.tekton.dev/on-path-change: "[docs/***]" + pipelinesascode.tekton.dev/on-target-branch: "main" spec: params: - name: repo_url diff --git a/.tekton/generate-coverage-release.yaml b/.tekton/generate-coverage-release.yaml index c32b1d53c..e21b5c1cd 100644 --- a/.tekton/generate-coverage-release.yaml +++ b/.tekton/generate-coverage-release.yaml @@ -6,6 +6,7 @@ metadata: annotations: pipelinesascode.tekton.dev/task: "[git-clone]" pipelinesascode.tekton.dev/max-keep-runs: "2" + pipelinesascode.tekton.dev/cancel-in-progress: "true" pipelinesascode.tekton.dev/on-cel-expression: | event == "push" && target_branch == "main" && ("***/*.go".pathChanged() || "config/***".pathChanged() || ".tekton/generate-coverage-release.yaml".pathChanged()) spec: diff --git a/.tekton/go.yaml b/.tekton/go.yaml index ee00b1922..bdb14584c 100644 --- a/.tekton/go.yaml +++ b/.tekton/go.yaml @@ -6,8 +6,10 @@ metadata: annotations: pipelinesascode.tekton.dev/task: "[git-clone]" pipelinesascode.tekton.dev/max-keep-runs: "2" - pipelinesascode.tekton.dev/on-cel-expression: | - event == "pull_request" && "***/*.go".pathChanged() + pipelinesascode.tekton.dev/cancel-in-progress: "true" + pipelinesascode.tekton.dev/on-event: "pull_request" + pipelinesascode.tekton.dev/on-target-branch: "main" + pipelinesascode.tekton.dev/on-path-change: "[***/*.go]" spec: params: - name: repo_url diff --git a/.tekton/linter.yaml b/.tekton/linter.yaml index 93c87d53f..f267591d4 100644 --- a/.tekton/linter.yaml +++ b/.tekton/linter.yaml @@ -7,6 +7,7 @@ metadata: pipelinesascode.tekton.dev/on-event: "[push, pull_request]" pipelinesascode.tekton.dev/on-target-branch: "[*]" pipelinesascode.tekton.dev/max-keep-runs: "2" + pipelinesascode.tekton.dev/cancel-in-progress: "true" pipelinesascode.tekton.dev/task: "[git-clone]" spec: params: diff --git a/.tekton/release-pipeline.yaml b/.tekton/release-pipeline.yaml index b30b2dc99..fe9977f13 100644 --- a/.tekton/release-pipeline.yaml +++ b/.tekton/release-pipeline.yaml @@ -8,6 +8,7 @@ metadata: pipelinesascode.tekton.dev/on-target-branch: "[refs/tags/*]" pipelinesascode.tekton.dev/task: "[.tekton/tasks/goreleaser.yaml]" pipelinesascode.tekton.dev/task-1: "[git-clone]" + pipelinesascode.tekton.dev/cancel-in-progress: "true" pipelinesascode.tekton.dev/max-keep-runs: "2" spec: params: