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
This commit is contained in:
Dimitris Sotirakis 2022-06-01 11:47:50 +03:00 committed by GitHub
parent e452785291
commit b6a329c268
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 38 additions and 7 deletions

View File

@ -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
...

View File

@ -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,
},
}