Closed Bug 665013 Opened 13 years ago Closed 13 years ago

clear varnish cache after repo is deleted

Categories

(mozilla.org Graveyard :: Server Operations, task)

task
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: armenzg, Assigned: nmeyerhans)

References

Details

It would be helpful that after deleting a repo from hg we cleared the web cache. Right now, is difficult to know if the delete step succeeded. It should return the empty repo message "Not found: repo-name". There are thoughts of putting this behind zeus rather than using varnish and proxying but that might be another discussion. It seems that adding a varnish clear step could be easy to add. The command I used was: > ssh -l stage-ffxbld -i ~cltbld/.ssh/ffxbld_dsa hg.mozilla.org edit mozilla-mobile-5.0 delete YES Convo about how to clear varnish: ################################ [11:43am] jabba: any idea how to clear a single url from varnish? [11:43am] jabba: ashish: dumitru ^ [11:44am] dumitru: jabba: from the varnish cli [11:44am] dumitru: purge req.http.host == example.com && req.url ~ ^/somedirectory/.*$ [11:44am] dumitru: or [11:45am] dumitru: purge [11:45am] dumitru: jabba: but, if you restart varnish it will purge everything in its cache The deletion code: #################### def do_delete(cname, repo_dir, repo_name): global doc_root run_command ('rm -rf %s/users/%s/%s' % (doc_root[cname], repo_dir, repo_name)) purge_log = open ('/tmp/pushlog_purge.%s' % os.getpid(), "a") purge_log.write ('echo users/%s/%s\n' % (repo_dir, repo_name)) purge_log.close() def delete_repo (cname, repo_name, do_quick_delete): global doc_root user = os.getenv ('USER') user_repo_dir = user.replace ('@', '_') if os.path.exists ('%s/users/%s/%s' % (doc_root[cname], user_repo_dir, repo_name)): if do_quick_delete: do_delete (cname, user_repo_dir, repo_name) else: print '\nAre you sure you want to delete /users/%s/%s?' % (user_repo_dir, repo_name) print '\nThis action is IRREVERSIBLE.' selection = prompt_user ('Proceed?', ['yes', 'no']) if (selection == 'yes'): do_delete (cname, user_repo_dir, repo_name) else: sys.stderr.write ('Could not find the repository at /users/%s/%s.\n' % (user_repo_dir, repo_name)) sys.stderr.write ('Please check the list at https://%s/users/%s\n' % (cname, user_repo_dir)) sys.exit (1) sys.exit(0)
Assignee: server-ops → nmeyerhans
Blocks: 626641
I've prepared a modification to the server-side hg wrapper script that should address this request. I've given it a bit of testing and will install it in the morning, when I'm around to fix it if it turns out to break anything...
This should be all set. The cache should automatically clear on repository creation and deletion.
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Thanks Noah!
Product: mozilla.org → mozilla.org Graveyard
You need to log in before you can comment on or make changes to this bug.