ansible: functionality to strip repos on hg.mozilla.org
authorGregory Szorc <gps@mozilla.com>
Tue, 21 Apr 2015 14:50:17 -0700
changeset 360699 28de316ad21bbe6972d9e2101b0b62921867caa6
parent 360698 6dca471e8019229cd132572566f1934eea13f286
child 360700 573156744d5cd37d25de7db1b5c21b2d36c13c27
push id16998
push userrwood@mozilla.com
push dateMon, 02 May 2016 19:42:03 +0000
ansible: functionality to strip repos on hg.mozilla.org
ansible/hgmo-strip-repo.yml
ansible/hosts
testing/vcttesting/deploy.py
testing/vcttesting/deploy_mach_commands.py
new file mode 100644
--- /dev/null
+++ b/ansible/hgmo-strip-repo.yml
@@ -0,0 +1,14 @@
+---
+- hosts: hgssh1.dmz.scl3.mozilla.com
+  tasks:
+    - name: Strip repo on master
+      command: hg --config extensions.strip= -R /repo/hg/mozilla/{{ repo | mandatory }} strip -r {{ rev | mandatory }}
+
+- hosts: hgweb-prod
+  tasks:
+    - name: Strip repo on mirrors
+      shell: "PYTHONPATH=/repo_local/mozilla/library_overrides:/repo_local/mozilla/libraries hg --config extensions.strip= -R /repo_local/mozilla/mozilla/{{ repo }} strip -r {{ rev }}"
+
+    - name: Ensure mirror is up to date
+      command: sudo -u hg /usr/local/bin/mirror-pull {{ repo }}
+
--- a/ansible/hosts
+++ b/ansible/hosts
@@ -1,6 +1,10 @@
+hgssh1.dmz.scl3.mozilla.com ansible_ssh_user=root
+hgssh2.dmz.scl3.mozilla.com ansible_ssh_user=root
 reviewboard1.dev.webapp.scl3.mozilla.com ansible_ssh_user=root
 reviewboardadm.private.scl3.mozilla.com ansible_sudo=true
 
 [rbweb-prod]
-reviewboard1.webapp.scl3.mozilla.com ansible_ssh_user=root
-reviewboard2.webapp.scl3.mozilla.com ansible_ssh_user=root
+reviewboard[1:2].webapp.scl3.mozilla.com ansible_ssh_user=root
+
+[hgweb-prod]
+hgweb[1:10].dmz.scl3.mozilla.com ansible_ssh_user=root
--- a/testing/vcttesting/deploy.py
+++ b/testing/vcttesting/deploy.py
@@ -49,8 +49,18 @@ def deploy_reviewboard_prod(repo=None, r
     extra = {}
     if repo:
         extra['repo'] = repo
     if rev:
         extra['rev'] = rev
 
     return run_playbook('deploy-mozreview-prod', extra_vars=extra,
                         verbosity=verbosity)
+
+
+def hgmo_strip(repo, rev, verbosity=0):
+    extra = {
+        'repo': repo,
+        'rev': rev,
+    }
+
+    return run_playbook('hgmo-strip-repo', extra_vars=extra,
+                        verbosity=0)
--- a/testing/vcttesting/deploy_mach_commands.py
+++ b/testing/vcttesting/deploy_mach_commands.py
@@ -3,41 +3,50 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 from mach.decorators import (
     CommandArgument,
     CommandProvider,
     Command,
 )
 
-from vcttesting.deploy import (
-    deploy_reviewboard_dev,
-    deploy_reviewboard_prod,
-)
-
 
 @CommandProvider
 class DeployCommands(object):
     def __init__(self, context):
         lm = context.log_manager
         lm.enable_unstructured()
 
     @Command('reviewboard-dev', category='deploy',
              description='Deploy updates to the Review Board dev server')
     @CommandArgument('--repo',
                      help='Alternative repository URL to deploy from')
     @CommandArgument('--rev',
                      help='Explicit revision in repository to deploy from')
     @CommandArgument('--verbosity', type=int,
                      help='How verbose to be with output')
     def reviewboard_dev(self, repo=None, rev=None, verbosity=None):
+        from vcttesting.deploy import deploy_reviewboard_dev
         return deploy_reviewboard_dev(repo=repo, rev=rev, verbosity=verbosity)
 
     @Command('reviewboard-prod', category='deploy',
              description='Deploy Review Board to production')
     @CommandArgument('--repo',
                      help='Alternative repository URL to deploy from')
     @CommandArgument('--rev',
                      help='Explicit revision in repository to deploy from')
     @CommandArgument('--verbosity', type=int,
                      help='How verbose to be with output')
     def reviewboard_prod(self, repo=None, rev=None, verbosity=None):
+        from vcttesting.deploy import deploy_reviewboard_prod
         return deploy_reviewboard_prod(repo=repo, rev=rev, verbosity=verbosity)
+
+    @Command('hgmo-strip', category='deploy',
+             description='Strip commits from a hg.mozilla.org repo')
+    @CommandArgument('repo',
+                     help='Repo to strip (path under hg.mozilla.org/)')
+    @CommandArgument('rev',
+                     help='Revset of revisions to strip')
+    @CommandArgument('--verbosity', type=int,
+                     help='How verbose to be with output')
+    def hgmo_strip(self, repo, rev, verbosity=None):
+        from vcttesting.deploy import hgmo_strip as strip
+        return strip(repo, rev, verbosity=verbosity)