Bug 1455407: [releaserunner3] Allow specifying which parameter to use for finding revision from; r=mtabara
authorTom Prince <mozilla@hocat.ca>
Tue, 26 Jun 2018 18:01:59 +0000
changeset 8432 61c5335d64e2
parent 8431 5fba3faa8f74
child 8433 61a697e0fac8
push id6157
push usermozilla@hocat.ca
push date2018-06-26 19:04 +0000
reviewersmtabara
bugs1455407
Bug 1455407: [releaserunner3] Allow specifying which parameter to use for finding revision from; r=mtabara Differential Revision: https://phabricator.services.mozilla.com/D1832
buildfarm/release/release-runner.yml.example
buildfarm/release/trigger_action.py
--- a/buildfarm/release/release-runner.yml.example
+++ b/buildfarm/release/release-runner.yml.example
@@ -59,14 +59,15 @@ releases:
       - check_allowed_branches
     allowed_branches:
       - mozilla-beta
       - mozilla-release
       - mozilla-esr*
   - product: thunderbird
     pattern: Thunderbird-.*
     trust_domain: comm
+    repo_param_prefix: comm_
     checks:
       - long_revision
       - check_allowed_branches
     allowed_branches:
       - comm-beta
       - comm-esr*
--- a/buildfarm/release/trigger_action.py
+++ b/buildfarm/release/trigger_action.py
@@ -34,16 +34,23 @@ SUPPORTED_ACTIONS = [
 
 def get_trust_domain(releases_config, product):
     for entry in releases_config:
         if entry['product'] == product:
             return entry['trust_domain']
     raise RuntimeError("Unknown product %s", product)
 
 
+def get_repo_param_prefix(releases_config, product):
+    for entry in releases_config:
+        if entry['product'] == product:
+            return entry.get('repo_param_prefix', '')
+    raise RuntimeError("Unknown product %s", product)
+
+
 def get_task(task_id):
     queue = taskcluster.Queue()
     return queue.task(task_id)
 
 
 # https://www.peterbe.com/plog/best-practice-with-retries-with-requests
 def requests_retry_session(
     retries=5,
@@ -114,22 +121,24 @@ def main():
     action_task_input = copy.deepcopy(prev_action_task["extra"]["action"]["context"]["input"])
 
     decision_task_id = args.decision_task_id
     if decision_task_id:
         params_yaml = get_artifact_text(queue, decision_task_id, 'public/parameters.yml')
     else:
         params_yaml = get_artifact_text(queue, args.action_task_id, 'public/parameters.yml')
 
+    product = args.action_flavor.split('_')[1]
+    repo_param_prefix = get_repo_param_prefix(release_runner_config['releases'], product)
+
     parameters = yaml.safe_load(params_yaml)
     project = parameters["project"]
-    revision = parameters["head_rev"]
+    revision = parameters['{}head_rev'.format(repo_param_prefix)]
 
     if not decision_task_id:
-        product = args.action_flavor.split('_')[1]
         trust_domain = get_trust_domain(release_runner_config['releases'], product)
         decision_task_id = find_decision_task_id(
             trust_domain=trust_domain,
             project=project, revision=revision,
         )
 
     previous_graph_ids = []
     if args.previous_graph_ids: