From b6a329c26838ecb72aee84d717fa3beff086c902 Mon Sep 17 00:00:00 2001 From: Dimitris Sotirakis Date: Wed, 1 Jun 2022 11:47:50 +0300 Subject: [PATCH] CI: Trigger `pr-test-*` pipelines on different cases (#48426) * Trigger pr-test-backend pipeline on pkg/* changes * Exclude paths for pr-test-frontend pipeline * Add more paths * Revert *.md - trigger on go.* changes * Replace star with doublestar --- .drone.yml | 20 +++++++++++++++----- scripts/drone/pipelines/pr.star | 25 +++++++++++++++++++++++-- 2 files changed, 38 insertions(+), 7 deletions(-) diff --git a/.drone.yml b/.drone.yml index be4083094e6..f916240230c 100644 --- a/.drone.yml +++ b/.drone.yml @@ -55,9 +55,13 @@ trigger: - pull_request paths: exclude: - - '*.md' - docs/** - - latest.json + - '*.md' + - pkg/** + - packaging/** + - go.sum + - go.mod + include: [] type: docker volumes: - host: @@ -143,9 +147,15 @@ trigger: - pull_request paths: exclude: - - '*.md' - docs/** - - latest.json + - '*.md' + include: + - pkg/** + - packaging/** + - .drone.yml + - conf/** + - go.sum + - go.mod type: docker volumes: - host: @@ -4715,6 +4725,6 @@ kind: secret name: gcp_upload_artifacts_key --- kind: signature -hmac: fb64e50c271012ad1cc9b7ad7e7bd037736d6e3471d24f73774e8fd61472600c +hmac: f4586777ea98ff85fec51ae5bf344bf549871f73aab2b6ff6611ce979b5bbfa1 ... diff --git a/scripts/drone/pipelines/pr.star b/scripts/drone/pipelines/pr.star index 2dee551749d..aa92866c0d1 100644 --- a/scripts/drone/pipelines/pr.star +++ b/scripts/drone/pipelines/pr.star @@ -84,7 +84,7 @@ def pr_test_frontend(): test_frontend_step(), ] return pipeline( - name='pr-test-frontend', edition="oss", trigger=trigger, services=[], steps=init_steps + test_steps, + name='pr-test-frontend', edition="oss", trigger=get_pr_trigger(exclude_paths=['pkg/**', 'packaging/**', 'go.sum', 'go.mod']), services=[], steps=init_steps + test_steps, ) @@ -104,7 +104,7 @@ def pr_test_backend(): test_backend_integration_step(edition="oss"), ] return pipeline( - name='pr-test-backend', edition="oss", trigger=trigger, services=[], steps=init_steps + test_steps, + name='pr-test-backend', edition="oss", trigger=get_pr_trigger(include_paths=['pkg/**', 'packaging/**', '.drone.yml', 'conf/**', 'go.sum', 'go.mod']), services=[], steps=init_steps + test_steps, ) @@ -160,3 +160,24 @@ def pr_pipelines(edition): volumes=volumes, ), docs_pipelines(edition, ver_mode, trigger_docs()) ] + + +def get_pr_trigger(include_paths=None, exclude_paths=None): + paths_ex = ['docs/**', '*.md'] + paths_in = [] + if include_paths: + for path in include_paths: + paths_in.extend([path]) + if exclude_paths: + for path in exclude_paths: + paths_ex.extend([path]) + return { + 'event': [ + 'pull_request', + ], + 'paths': { + 'exclude': paths_ex, + 'include': paths_in, + }, + } +