Skip to content

Commit 9896785

Browse files
authored
chore: expand skip-CI patterns and fix regex escaping in Buildkite config (#18849)
Add missing non-package files (.github/stale.yml, PULL_REQUEST_TEMPLATE.md, .mergify.yml, CONTRIBUTING.md, README.md, pipeline.serverless.yml) to both skip_ci_on_only_changed in pull-requests.json and non_package_patterns in common.sh, keeping the two lists in sync.
1 parent 71f93e0 commit 9896785

2 files changed

Lines changed: 41 additions & 22 deletions

File tree

.buildkite/pull-requests.json

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,25 @@
1414
"skip_ci_labels": [],
1515
"skip_target_branches": [],
1616
"skip_ci_on_only_changed": [
17-
"^.github/workflows/",
18-
"^.github/dependabot.yml$",
19-
"^.github/ISSUE_TEMPLATE/",
20-
"^docs/",
21-
"^catalog-info.yaml$",
22-
"^CODE_OF_CONDUCT.md$",
17+
"^.buildkite/pipeline.backport.yml$",
18+
"^.buildkite/pipeline.publish.yml$",
19+
"^.buildkite/pipeline.serverless.yml$",
2320
"^.buildkite/pipeline.schedule-daily.yml$",
2421
"^.buildkite/pipeline.schedule-weekly.yml$",
25-
"^.buildkite/pipeline.backport.yml$",
22+
"^.buildkite/pull-requests.json$",
2623
"^.buildkite/scripts/backport_branch.sh$",
27-
"^.buildkite/pipeline.publish.yml$",
2824
"^.buildkite/scripts/build_packages.sh$",
29-
"^.buildkite/pull-requests.json$"
25+
"^.github/dependabot.yml$",
26+
"^.github/workflows/",
27+
"^.github/stale.yml$",
28+
"^.github/ISSUE_TEMPLATE/",
29+
"^.github/PULL_REQUEST_TEMPLATE.md$",
30+
"^.mergify.yml$",
31+
"^catalog-info.yaml$",
32+
"^docs/",
33+
"^CODE_OF_CONDUCT.md$",
34+
"^CONTRIBUTING.md$",
35+
"^README.md$"
3036
],
3137
"always_require_ci_on_changed": []
3238
},

.buildkite/scripts/common.sh

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -758,28 +758,41 @@ is_pr_affected() {
758758

759759
commit_merge=$(git merge-base "${from}" "${to}")
760760
echoerr "[${package_name}] git-diff: check non-package files (${commit_merge}..${to})"
761-
# Avoid using "-q" in grep in this pipe, it could cause that some files updated are not detected due to SIGPIPE errors when "set -o pipefail"
762-
# Example:
763-
# https://buildkite.com/elastic/integrations/builds/25606
764-
# https://github.com/elastic/integrations/pull/13810
761+
762+
# .github/CODEOWNERS must not be added to "skip_ci_on_only_changed" in ".buildkite/pull-requests.json".
763+
# When this file is updated, the Buildkite build must be triggered to run the "mage check" step.
764+
# Same for ".buildkite/scripts/packages/.+.sh": this pattern must not be added to "skip_ci_on_only_changed" to allow triggering the tests of the given package.
765765
local non_package_patterns=(
766766
'packages/'
767-
'\.github/(CODEOWNERS|ISSUE_TEMPLATE|PULL_REQUEST_TEMPLATE|workflows/)'
768-
'CODE_OF_CONDUCT\.md'
769-
'README\.md'
770-
'docs/'
771-
'catalog-info\.yaml'
772-
'\.buildkite/pull-requests\.json'
773-
'\.buildkite/pipeline\.schedule-daily\.yml'
774-
'\.buildkite/pipeline\.schedule-weekly\.yml'
775767
'\.buildkite/pipeline\.backport\.yml'
776768
'\.buildkite/pipeline\.publish\.yml'
777-
'\.buildkite/scripts/packages/.+\.sh'
769+
'\.buildkite/pipeline\.serverless\.yml'
770+
'\.buildkite/pipeline\.schedule-daily\.yml'
771+
'\.buildkite/pipeline\.schedule-weekly\.yml'
772+
'\.buildkite/pull-requests\.json'
778773
'\.buildkite/scripts/backport_branch\.sh'
779774
'\.buildkite/scripts/build_packages\.sh'
775+
'\.buildkite/scripts/packages/.+\.sh'
776+
'\.github/dependabot\.yml'
777+
'\.github/workflows/'
778+
'\.github/stale\.yml'
779+
'\.github/CODEOWNERS'
780+
'\.github/ISSUE_TEMPLATE/'
781+
'\.github/PULL_REQUEST_TEMPLATE\.md'
782+
'\.mergify\.yml'
783+
'catalog-info\.yaml'
784+
'docs/'
785+
'CODE_OF_CONDUCT\.md'
786+
'CONTRIBUTING\.md'
787+
'README\.md'
780788
)
781789
local non_package_regex
782790
non_package_regex="^($(IFS='|'; echo "${non_package_patterns[*]}"))"
791+
792+
# Avoid using "-q" in grep in this pipe, it could cause that some files updated are not detected due to SIGPIPE errors when "set -o pipefail"
793+
# Example:
794+
# https://buildkite.com/elastic/integrations/builds/25606
795+
# https://github.com/elastic/integrations/pull/13810
783796
if git diff --name-only "${commit_merge}" "${to}" | grep -E -v "${non_package_regex}" > /dev/null; then
784797
echo "[${package_name}] PR is affected: found non-package files"
785798
return 0

0 commit comments

Comments
 (0)