Bug 1236954 - partner repack script changes to read properties from buildprops.json; r?jlund draft
authorChris Cooper <ccooper@deadsquid.com>
Mon, 25 Jan 2016 15:20:41 -0500
changeset 325545 504bf6b3e37641686234ff40dd7a0819c8fc65bd
parent 325544 da0f696b3cae671bfc96af326b45f9be247e2ee9
child 513461 58877e3688800f2b84cb9f0132c0eb4a8eb56246
push id9992
push usercoop@mozilla.com
push dateMon, 25 Jan 2016 20:21:07 +0000
reviewersjlund
bugs1236954
milestone46.0a1
Bug 1236954 - partner repack script changes to read properties from buildprops.json; r?jlund Adds --require-buildprops option used by the standalone builder. When this option is specified, a partner property must be present in the buildprops.json file. This limits the repack operation to that single partner.
testing/mozharness/scripts/desktop_partner_repacks.py
--- a/testing/mozharness/scripts/desktop_partner_repacks.py
+++ b/testing/mozharness/scripts/desktop_partner_repacks.py
@@ -63,25 +63,31 @@ class DesktopPartnerRepacks(ReleaseMixin
         [["--hgroot"], {
           "dest": "hgroot",
           "help": "Use a different hg server for retrieving files",
           }],
         [["--hgrepo"], {
           "dest": "hgrepo",
           "help": "Use a different base repo for retrieving files",
           }],
+        [["--require-buildprops"], {
+            "action": "store_true",
+            "dest": "require_buildprops",
+            "default": False,
+            "help": "Read in config options (like partner) from the buildbot properties file."
+          }],
     ]
 
     def __init__(self):
         # fxbuild style:
         buildscript_kwargs = {
             'all_actions': DesktopPartnerRepacks.actions,
             'default_actions': DesktopPartnerRepacks.actions,
             'config': {
-                "buildbot_json_path": "buildprops.json",
+                'buildbot_json_path': os.environ.get('PROPERTIES_FILE'),
                 "log_name": "partner-repacks",
                 "hashType": "sha512",
                 'virtualenv_modules': [
                     'requests==2.2.1',
                     'PyHawk-with-a-single-extra-commit==0.1.5',
                     'taskcluster==0.0.15',
                     's3cmd==1.6.0',
                 ],
@@ -101,16 +107,27 @@ class DesktopPartnerRepacks(ReleaseMixin
             self.fatal("Version (-v) not supplied.")
         if 'buildnumber' not in self.config:
             self.fatal("Build number (-n) not supplied.")
         if 'repo_file' not in self.config:
             self.fatal("repo_file not supplied.")
         if 'repack_manifests_url' not in self.config:
             self.fatal("repack_manifests_url not supplied.")
 
+    def _pre_config_lock(self, rw_config):
+        if self.config.get('require_buildprops', False) is True:
+            self.read_buildbot_config()
+            if not self.buildbot_config:
+                self.fatal("Unable to load properties from file: %s" % self.config.get('buildbot_json_path'))
+            buildbot_props = self.buildbot_config.get('properties', {})
+            partner = buildbot_props.get('partner')
+            if not partner:
+                self.fatal("No partner specified in buildprops.json.")
+            self.config['partner'] = partner
+
     def query_abs_dirs(self):
         if self.abs_dirs:
             return self.abs_dirs
         abs_dirs = super(DesktopPartnerRepacks, self).query_abs_dirs()
         for directory in abs_dirs:
             value = abs_dirs[directory]
             abs_dirs[directory] = value
         dirs = {}