Changeset View
Changeset View
Standalone View
Standalone View
contrib/buildbot/server.py
Show First 20 Lines • Show All 255 Lines • ▼ Show 20 Lines | def build_diff(): | ||||
staging_ref = get_mandatory_argument('stagingRef') | staging_ref = get_mandatory_argument('stagingRef') | ||||
target_phid = get_mandatory_argument('targetPHID') | target_phid = get_mandatory_argument('targetPHID') | ||||
revision_id = get_mandatory_argument('revisionId') | revision_id = get_mandatory_argument('revisionId') | ||||
# Get the configuration from master | # Get the configuration from master | ||||
config = yaml.safe_load(phab.get_file_content_from_master( | config = yaml.safe_load(phab.get_file_content_from_master( | ||||
"contrib/teamcity/build-configurations.yml")) | "contrib/teamcity/build-configurations.yml")) | ||||
# Get the list of changed files | |||||
changedFiles = phab.get_revision_changed_files( | |||||
revision_id=revision_id) | |||||
# Get a list of the builds that should run on diffs | # Get a list of the builds that should run on diffs | ||||
builds = [ | builds = [] | ||||
k for k, | for build_name, v in config.get('builds', {}).items(): | ||||
v in config.get( | diffRegex = v.get('runOnDiffRegex', None) | ||||
'builds', | if v.get('runOnDiff', False) or diffRegex is not None: | ||||
{}).items() if v.get( | if diffRegex: | ||||
'runOnDiff', | # If the regex matches at least one changed file, add this | ||||
False)] | # build to the list. | ||||
for changedFile in changedFiles: | |||||
if re.match(diffRegex, changedFile): | |||||
builds.append(build_name) | |||||
break | |||||
else: | |||||
builds.append(build_name) | |||||
if target_phid in create_server.db['diff_targets']: | if target_phid in create_server.db['diff_targets']: | ||||
build_target = create_server.db['diff_targets'][target_phid] | build_target = create_server.db['diff_targets'][target_phid] | ||||
else: | else: | ||||
build_target = BuildTarget(target_phid) | build_target = BuildTarget(target_phid) | ||||
for build_name in builds: | for build_name in builds: | ||||
properties = [{ | properties = [{ | ||||
▲ Show 20 Lines • Show All 733 Lines • Show Last 20 Lines |