Bug 1255786 - Tag gecko when bump version r=jlund a=release DONTBUILD
authorRail Aliiev <rail@mozilla.com>
Fri, 11 Mar 2016 10:31:49 -0500
changeset 325295 3228c0e5b050acaf9b16b41ba2ce51603356b1bb
parent 325294 45c68ee48929e1e9d300037347658d05a312e556
child 325296 f61853686f6afca01d269dd77229f46e78e7b502
push id1128
push userjlund@mozilla.com
push dateWed, 01 Jun 2016 01:31:59 +0000
treeherdermozilla-release@fe0d30de989d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjlund, release
bugs1255786
milestone47.0a2
Bug 1255786 - Tag gecko when bump version r=jlund a=release DONTBUILD MozReview-Commit-ID: I387bpl1UmD
testing/mozharness/scripts/release/postrelease_version_bump.py
--- a/testing/mozharness/scripts/release/postrelease_version_bump.py
+++ b/testing/mozharness/scripts/release/postrelease_version_bump.py
@@ -43,56 +43,83 @@ class PostReleaseVersionBump(MercurialSc
             "help": "SSH username with hg.mozilla.org permissions",
         }],
         [['--ssh-key', ], {
             "action": "store",
             "dest": "ssh_key",
             "type": "string",
             "help": "Path to SSH key.",
         }],
+        [['--product', ], {
+            "action": "store",
+            "dest": "product",
+            "type": "string",
+            "help": "Product name",
+        }],
+        [['--version', ], {
+            "action": "store",
+            "dest": "version",
+            "type": "string",
+            "help": "Version",
+        }],
+        [['--build-number', ], {
+            "action": "store",
+            "dest": "build_number",
+            "type": "string",
+            "help": "Build number",
+        }],
+        [['--revision', ], {
+            "action": "store",
+            "dest": "revision",
+            "type": "string",
+            "help": "HG revision to tag",
+        }],
     ]
 
     def __init__(self, require_config_file=True):
         super(PostReleaseVersionBump, self).__init__(
             config_options=self.config_options,
             all_actions=[
                 'clobber',
                 'clean-repos',
                 'pull',
                 'bump_postrelease',
                 'commit-changes',
+                'tag',
                 'push',
             ],
             default_actions=[
                 'clean-repos',
                 'pull',
                 'bump_postrelease',
                 'commit-changes',
+                'tag',
                 'push',
             ],
             config={
                 'buildbot_json_path': 'buildprops.json',
             },
             require_config_file=require_config_file
         )
 
     def _pre_config_lock(self, rw_config):
         super(PostReleaseVersionBump, self)._pre_config_lock(rw_config)
         # override properties from buildbot properties here as defined by
         # taskcluster properties
         self.read_buildbot_config()
         if not self.buildbot_config:
             self.warning("Skipping buildbot properties overrides")
         else:
-            next_version = self.buildbot_config["properties"].get("next_version")
-            if next_version:
-                if self.config.get("next_version"):
-                    self.warning("Overriding next_version %s by %s" %
-                                 (self.config["next_version"], next_version))
-                self.config["next_version"] = next_version
+            props = self.buildbot_config["properties"]
+            for prop in ['next_version', 'product', 'version', 'build_number',
+                         'revision']:
+                if props.get(prop):
+                    self.info("Overriding %s with %s" % (prop, props[prop]))
+                    self.config[prop] = props.get(prop)
+
         if not self.config.get("next_version"):
             self.fatal("Next version has to be set. Use --next-version or "
                        "pass `next_version' via buildbot properties.")
 
     def query_abs_dirs(self):
         """ Allow for abs_from_dir and abs_to_dir
             """
         if self.abs_dirs:
@@ -131,11 +158,23 @@ class PostReleaseVersionBump(MercurialSc
         """Bump version"""
         dirs = self.query_abs_dirs()
         for f in self.config["version_files"]:
             curr_version = ".".join(
                 self.get_version(dirs['abs_gecko_dir'], f["file"]))
             self.replace(os.path.join(dirs['abs_gecko_dir'], f["file"]),
                          curr_version, self.config["next_version"])
 
+    def tag(self):
+        dirs = self.query_abs_dirs()
+        tags = ["{product}_{version}_BUILD{build_number}",
+                "{product}_{version}_RELEASE"]
+        tags = [t.format(product=self.config["product"].upper(),
+                         version=self.config["version"].replace(".", "_"),
+                         build_number=self.config["build_number"])
+                for t in tags]
+        self.hg_tag(cwd=dirs["abs_gecko_dir"], tags=tags,
+                    revision=self.config["revision"],
+                    user=self.config["hg_user"], force=True)
+
 # __main__ {{{1
 if __name__ == '__main__':
     PostReleaseVersionBump().run_and_exit()