bug 1469284: allow ssh username to be passed to the merge day scripts. r=mtabara
authorBen Hearsum <bhearsum@mozilla.com>
Mon, 23 Jul 2018 10:39:01 -0400
changeset 427835 7d47b4266f035bb8d9fabe4d592eb2c7d2622842
parent 427834 5649e60770c84c40a5234df4adfc3daf3e6ea6e8
child 427836 d3ecceff8d68c16b27fabe65150dca3bd36e4dd4
push id66737
push userccoroiu@mozilla.com
push dateMon, 23 Jul 2018 21:45:57 +0000
treeherderautoland@c47bdc24522f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmtabara
bugs1469284
milestone63.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
bug 1469284: allow ssh username to be passed to the merge day scripts. r=mtabara
testing/mozharness/scripts/merge_day/gecko_migration.py
--- a/testing/mozharness/scripts/merge_day/gecko_migration.py
+++ b/testing/mozharness/scripts/merge_day/gecko_migration.py
@@ -42,16 +42,23 @@ class GeckoMigration(MercurialScript, Ba
     config_options = [
         [['--hg-user', ], {
             "action": "store",
             "dest": "hg_user",
             "type": "string",
             "default": "ffxbld <release@mozilla.com>",
             "help": "Specify what user to use to commit to hg.",
         }],
+        [['--ssh-user', ], {
+            "action": "store",
+            "dest": "ssh_user",
+            "type": "string",
+            "default": None,
+            "help": "The user to push to hg.mozilla.org as.",
+        }],
         [['--balrog-api-root', ], {
             "action": "store",
             "dest": "balrog_api_root",
             "type": "string",
             "help": "Specify Balrog API root URL.",
         }],
         [['--balrog-username', ], {
             "action": "store",
@@ -186,17 +193,22 @@ class GeckoMigration(MercurialScript, Ba
                 self.config['migration_behavior'] == 'beta_to_release':
             return ['--new-branch', '-r', '.']
         else:
             return ['-r', '.']
 
     def set_push_to_ssh(self):
         for cwd in self.query_push_dirs():
             repo_url = self.read_repo_hg_rc(cwd).get('paths', 'default')
-            push_dest = repo_url.replace('https://', 'ssh://')
+            username = self.config.get('ssh_user', '')
+            # Add a trailing @ to the username if it exists, otherwise it gets
+            # mushed up with the hostname.
+            if username:
+                username += '@'
+            push_dest = repo_url.replace('https://', 'ssh://' + username)
 
             if not push_dest.startswith('ssh://'):
                 raise Exception('Warning: path "{}" is not supported. Protocol must be ssh')
 
             self.edit_repo_hg_rc(cwd, 'paths', 'default-push', push_dest)
 
     def query_from_revision(self):
         """ Shortcut to get the revision for the from repo