From c9d4f2c8d87115fe6cd48f586de82b252a357c45 Mon Sep 17 00:00:00 2001 From: Sam Thursfield Date: Fri, 30 Jan 2015 15:05:38 +0000 Subject: Remove all mention of Mason from trove-setup The Mason referred to here is the 1st version of the Mason continuous delivery tool. There have been no instances of this for two years. We have made two subsequent Mason implementations since then which don't require coupling in Trove in order to work. As well as removing unneeded configuration, this will fix the misleading warning that users see on Git pushes: remote: [git.baserock.org] Notifying Mason of changes... remote: [git.baserock.org] Notification failed somehow --- ansible/roles/trove-setup/tasks/check.yml | 6 -- .../roles/trove-setup/tasks/gitano-mason-setup.yml | 16 ---- ansible/roles/trove-setup/tasks/users.yml | 4 +- .../gitano-admin/global-hooks/post-receive.lua | 105 --------------------- share/gitano/skel/gitano-admin/groups/workers.conf | 1 - .../gitano/skel/gitano-admin/users/mason/user.conf | 2 - 6 files changed, 1 insertion(+), 133 deletions(-) delete mode 100644 ansible/roles/trove-setup/tasks/gitano-mason-setup.yml delete mode 100644 share/gitano/skel/gitano-admin/global-hooks/post-receive.lua delete mode 100644 share/gitano/skel/gitano-admin/users/mason/user.conf diff --git a/ansible/roles/trove-setup/tasks/check.yml b/ansible/roles/trove-setup/tasks/check.yml index 3aeb48a..48e8272 100644 --- a/ansible/roles/trove-setup/tasks/check.yml +++ b/ansible/roles/trove-setup/tasks/check.yml @@ -35,12 +35,6 @@ - set_fact: LORRY_CONTROLLER_MINIONS=4 when: LORRY_CONTROLLER_MINIONS is not defined -- set_fact: MASON_ID='' - when: MASON_ID is not defined - -- set_fact: MASON_PORT='18755' - when: MASON_PORT is not defined - - name: Calculate ESC_PREFIX shell: echo -n {{ TROVE_ID|quote }} | perl -pe 's/([-+\(\).%*?^$\[\]])/%$1/g' register: var_esc_prefix diff --git a/ansible/roles/trove-setup/tasks/gitano-mason-setup.yml b/ansible/roles/trove-setup/tasks/gitano-mason-setup.yml deleted file mode 100644 index 8439078..0000000 --- a/ansible/roles/trove-setup/tasks/gitano-mason-setup.yml +++ /dev/null @@ -1,16 +0,0 @@ -# Depends on: -# - gitano-setup.yml ---- -- name: Check if mason has a sshkey configured in gitano (This task can fail) - shell: su git -c 'ssh git@localhost as mason sshkey' 2>&1 | grep WARNING - register: gitano_mason_key - changed_when: False - ignore_errors: True - -# If distbuild user doesn't have an sshkey configured -- file: path=/home/git/keys state=directory owner=git group=git - when: gitano_mason_key|success -- copy: src={{ MASON_SSH_PUBKEY }} dest=/home/git/keys/mason.key.pub mode=0644 - when: gitano_mason_key|success -- shell: su git -c 'ssh git@localhost as mason sshkey add trove < /home/git/keys/mason.key.pub' - when: gitano_mason_key|success diff --git a/ansible/roles/trove-setup/tasks/users.yml b/ansible/roles/trove-setup/tasks/users.yml index c1ab866..e0a27c8 100644 --- a/ansible/roles/trove-setup/tasks/users.yml +++ b/ansible/roles/trove-setup/tasks/users.yml @@ -6,12 +6,11 @@ - name: Create the /home/lorry/.ssh folder file: path=/home/lorry/.ssh state=directory owner=lorry group=lorry mode=0700 -- name: Create users (git, cache, mason) and ssh keys for them. +- name: Create users (git, cache) and ssh keys for them. user: name={{ item }} comment="Trove {{ item }} service" shell=/bin/bash generate_ssh_key=yes with_items: - git - cache - - mason - name: Create known_hosts for all the users shell: | cat /etc/ssh/ssh_host_*_key.pub | cut -d\ -f1,2 | \ @@ -23,7 +22,6 @@ with_items: - git - cache - - mason - lorry - name: Copy the lorry ssh private key diff --git a/share/gitano/skel/gitano-admin/global-hooks/post-receive.lua b/share/gitano/skel/gitano-admin/global-hooks/post-receive.lua deleted file mode 100644 index c7ab051..0000000 --- a/share/gitano/skel/gitano-admin/global-hooks/post-receive.lua +++ /dev/null @@ -1,105 +0,0 @@ --- mason-notify.post-receive.lua --- --- Global post-receive hook which notifies Mason of any and all refs updates --- (except refs/gitano/*) which happen. --- --- It notifies Mason *before* passing the updates on to the project hook. --- --- Copyright 2012 Codethink Limited --- --- This is a part of Trove and re-use is limited to Baserock systems only. --- - -local project_hook, repo, updates = ... - -local EMPTY_SHA = ("0"):rep(40) - -local masonhost = "{{ MASON_ID }}:{{ MASON_PORT }}" -local basepath = "/1.0" -local urlbases = { - "git://{{ TROVE_HOSTNAME }}/", - "ssh://git@{{ TROVE_HOSTNAME }}/", -} - -local notify_mason = false - -for ref in pairs(updates) do - if not ref:match("^refs/gitano/") then - notify_mason = true - end -end - -if notify_mason and repo.name ~= "gitano-admin" then - -- Build the report... - local masoninfo, indent_level = {}, 0 - local function _(...) - masoninfo[#masoninfo+1] = (" "):rep(indent_level) .. table.concat({...}) - end - local function indent() - indent_level = indent_level + 1 - end - local function dedent() - indent_level = indent_level - 1 - end - _ "{" indent() - - _ '"urls": [' indent() - - for i = 1, #urlbases do - local comma = (i==#urlbases) and "" or "," - _(("%q,"):format(urlbases[i] .. repo.name)) - _(("%q%s"):format(urlbases[i] .. repo.name .. ".git", comma)) - end - - dedent() _ "]," - - _ '"changes": [' indent() - - local toreport = {} - for ref, info in pairs(updates) do - if not ref:match("^refs/gitano") then - local action - if info.oldsha == EMPTY_SHA then - action = "create" - elseif info.newsha == EMPTY_SHA then - action = "delete" - else - action = "update" - end - toreport[#toreport+1] = { - ('"ref": %q,'):format(ref), - ('"action": %q,'):format(action), - ('"old": %q,'):format(info.oldsha), - ('"new": %q'):format(info.newsha) - } - end - end - for i = 1, #toreport do - local comma = (i==#toreport) and "" or "," - _ "{" indent() - for __, ent in ipairs(toreport[i]) do - _(ent) - end - dedent() _("}", comma) - end - dedent() _ "]" - - dedent() _ "}" - - -- And finalise the JSON object - _("") - masoninfo = table.concat(masoninfo, "\n") - log.state("Notifying Mason of changes...") - - local code, msg, headers, content = - http.post(masonhost, basepath, "application/json", masoninfo) - if code ~= "200" then - log.state("Notification failed somehow") - end - for line in content:gmatch("([^\r\n]*)\r?\n") do - log.state("Mason: " .. line) - end -end - --- Finally, chain to the project hook -return project_hook(repo, updates) diff --git a/share/gitano/skel/gitano-admin/groups/workers.conf b/share/gitano/skel/gitano-admin/groups/workers.conf index 5586538..7f54997 100644 --- a/share/gitano/skel/gitano-admin/groups/workers.conf +++ b/share/gitano/skel/gitano-admin/groups/workers.conf @@ -1,4 +1,3 @@ description "Workers who have read-access to everything" members["*"] "distbuild" -members["*"] "mason" diff --git a/share/gitano/skel/gitano-admin/users/mason/user.conf b/share/gitano/skel/gitano-admin/users/mason/user.conf deleted file mode 100644 index 3139295..0000000 --- a/share/gitano/skel/gitano-admin/users/mason/user.conf +++ /dev/null @@ -1,2 +0,0 @@ -email_address "mason@{{ TROVE_HOSTNAME }}" -real_name "Baserock Continuous Integration Service" -- cgit v1.2.1