diff --git a/contrib/buildbot/server.py b/contrib/buildbot/server.py --- a/contrib/buildbot/server.py +++ b/contrib/buildbot/server.py @@ -269,14 +269,18 @@ builds = [] for build_name, v in config.get('builds', {}).items(): if v.get('runOnDiff', False): - diffRegex = v.get('runOnDiffRegex', None) - if diffRegex: + diffRegexes = v.get('runOnDiffRegex', None) + if diffRegexes: # If the regex matches at least one changed file, add this # build to the list. - for _, changedFile in changedFiles.items(): - if re.match(diffRegex, changedFile): - builds.append(build_name) - break + def regexesMatchAnyFile(regexes, files): + for regex in regexes: + for _, filename in files.items(): + if re.match(regex, filename): + return True + return False + if regexesMatchAnyFile(diffRegexes, changedFiles): + builds.append(build_name) else: builds.append(build_name) diff --git a/contrib/buildbot/test/test_endpoint_buildDiff.py b/contrib/buildbot/test/test_endpoint_buildDiff.py --- a/contrib/buildbot/test/test_endpoint_buildDiff.py +++ b/contrib/buildbot/test/test_endpoint_buildDiff.py @@ -121,7 +121,7 @@ set_build_configuration({ "build-1": { "runOnDiff": True, - "runOnDiffRegex": "dir/subdir/.*", + "runOnDiffRegex": ["dir/subdir/.*"], }, }) call_buildDiff(builds) @@ -130,7 +130,7 @@ set_build_configuration({ "build-1": { "runOnDiff": True, - "runOnDiffRegex": "dir/nonmatching/.*", + "runOnDiffRegex": ["dir/nonmatching/.*"], }, }) call_buildDiff([]) @@ -140,11 +140,11 @@ set_build_configuration({ "build-1": { "runOnDiff": True, - "runOnDiffRegex": "dir/nonmatching/.*", + "runOnDiffRegex": ["dir/nonmatching/.*"], }, "build-2": { "runOnDiff": True, - "runOnDiffRegex": "someotherdir/file2.txt", + "runOnDiffRegex": ["someotherdir/file2.txt"], }, }) call_buildDiff([builds[1]]) diff --git a/contrib/teamcity/build-configurations.yml b/contrib/teamcity/build-configurations.yml --- a/contrib/teamcity/build-configurations.yml +++ b/contrib/teamcity/build-configurations.yml @@ -404,7 +404,8 @@ check-buildbot: runOnDiff: true - runOnDiffRegex: contrib/buildbot/.* + runOnDiffRegex: + - contrib/buildbot/.* targets: - - check-buildbot timeout: 600