ansible: playbook to deploy hooks and extensions to hg.mozilla.org
authorGregory Szorc <gps@mozilla.com>
Wed, 22 Apr 2015 17:38:15 -0700
changeset 360710 a7461996f6dfb693b66204f8a2d23974fefaa004
parent 360709 a9284aa2f3c061aaa08514741300eec4e533c6ed
child 360711 90d556f4de18f663295abe637ee025488b93681d
push id16998
push userrwood@mozilla.com
push dateMon, 02 May 2016 19:42:03 +0000
ansible: playbook to deploy hooks and extensions to hg.mozilla.org
ansible/deploy-hgmo-extensions.yml
ansible/hosts
ansible/tasks/hgmo-extensions.yml
testing/vcttesting/deploy.py
testing/vcttesting/deploy_mach_commands.py
new file mode 100644
--- /dev/null
+++ b/ansible/deploy-hgmo-extensions.yml
@@ -0,0 +1,23 @@
+---
+- hosts: hgssh1.dmz.scl3.mozilla.com
+  tasks:
+    - name: notify IRC of deployment
+
+      irc: server=irc.mozilla.org
+           port=6697
+           use_ssl=true
+           channel="#vcs"
+           nick=hg-deploy-bot
+           color=red
+           msg="Starting deploy of hooks and extensions to hg.mozilla.org"
+
+    - include: tasks/hgmo-extensions.yml
+
+    - name: notify IRC of deployment
+      irc: server=irc.mozilla.org
+           port=6697
+           use_ssl=true
+           channel="#vcs"
+           nick=hg-deploy-bot
+           color=red
+           msg="Finished deploy of hooks and extensions to hg.mozilla.org"
--- a/ansible/hosts
+++ b/ansible/hosts
@@ -1,10 +1,11 @@
-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]
 reviewboard[1:2].webapp.scl3.mozilla.com ansible_ssh_user=root
 
 [hgweb-prod]
 hgweb[1:10].dmz.scl3.mozilla.com ansible_ssh_user=root
+
+[hgssh-prod]
+hgssh[1:2].dmz.scl3.mozilla.com ansible_ssh_user=root
new file mode 100644
--- /dev/null
+++ b/ansible/tasks/hgmo-extensions.yml
@@ -0,0 +1,35 @@
+---
+- name: install pushlog hgweb files
+  copy: src={{ vct | mandatory }}/hgext/pushlog-legacy/{{ item }} dest=/repo/hg/extensions/{{ item }} owner=root group=root mode=0644
+  with_items:
+    - buglink.py
+    - feedparser.py
+    - hgwebjson.py
+    - pushlog-feed.py
+    - parsedatetime/__init__.py
+    - parsedatetime/parsedatetime.py
+    - parsedatetime/parsedatetime_consts.py
+
+- name: install pushlog extension
+  copy: src={{ vct }}/hgext/pushlog/__init__.py dest=/repo/hg/extensions/pushlog/__init__.py owner=root group=root mode=0644
+
+- name: install serverlog extension
+  copy: src={{ vct }}/hgext/serverlog/__init__.py dest=/repo/hg/extensions/serverlog/__init__.py owner=root group=root mode=0644
+
+- name: install hooks
+  copy: src={{ vct }}/hghooks/mozhghooks/{{ item }} dest=/repo/hg/libraries/mozhghooks/{{ item }} owner=root group=root mode=0644
+  with_items:
+    - changelog_correctness.py
+    - commit-message.py
+    - prevent_case_only_renames.py
+    - prevent_idl_change_without_uuid_bump.py
+    - prevent_string_changes.py
+    - prevent_uuid_changes.py
+    - prevent_webidl_changes.py
+    - push_printurls.py
+    - single_head_per_branch.py
+    - treeclosure.py
+    - treeclosure_comm_central.py
+    - try_mandatory.py
+    - whitelist_qa.py
+    - whitelist_releng.py
--- a/testing/vcttesting/deploy.py
+++ b/testing/vcttesting/deploy.py
@@ -52,16 +52,24 @@ def deploy_reviewboard_prod(repo=None, r
         extra['repo'] = repo
     if rev:
         extra['rev'] = rev
 
     return run_playbook('deploy-mozreview-prod', extra_vars=extra,
                         verbosity=verbosity)
 
 
+def hgmo_deploy_extensions(verbosity=0):
+    """Deploy hooks and extensions to hg.mozilla.org servers."""
+    extra = {'vct': ROOT}
+
+    return run_playbook('deploy-hgmo-extensions', 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
@@ -34,16 +34,24 @@ class DeployCommands(object):
     @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-extensions', category='deploy',
+             description='Deploy hooks and extensions to hg.mozilla.org')
+    @CommandArgument('--verbosity', type=int,
+                     help='How verbose to be with output')
+    def hgmo_extensions(self, verbosity=None):
+        from vcttesting.deploy import hgmo_deploy_extensions as deploy
+        return deploy(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')