My favorites | Sign in
Project Home Downloads Wiki Issues Source
New issue   Search
for
  Advanced search   Search tips   Subscriptions
Issue 3160: Detail ref-update hook
1 person starred this issue and may be notified of changes. Back to list
Status:  New
Owner:  ----


Sign in to add a comment
 
Reported by wer...@beroux.com, Feb 4, 2015
Running Gerrit 2.10 I'm looking at hooks to perform tests on pushes. The ref-update looks perfect for that.

Note: I could and I'm currently using a more complex solution with Jenkins and Gerrit plugin which triggers a build. However:
 - I'd like to simplify this,
 - Disallow pushes that break the build without forcing a review step for all commits, 
 - Show test failures directly in the console

What I'm missing from the documentation is a simple/fast way to checkout that commit and perform the operations. For example the documentation doesn't state if multiple of those operations may happen in parallel. If they do, it means that I cannot just checkout to a single directory. Checking out to a temp directory is pretty inefficient too.

I guess most people writing ref-update scripts would like to have a checkout accessible, that's why I'm suggesting this improvement.
Feb 4, 2015
#1 wer...@beroux.com
And I forgot to mention that it should remind people how to get the URL and path of the repository from it's name (how to get the path and URL by reading some ENV or config).
Feb 4, 2015
#2 wer...@beroux.com
From the documentation it says it'll run synchronously so supposing there is only a single Gerrit process it means that a single checkout folder per project should be enought.

I created a sample script that also includes what should be some standard environment variables: https://github.com/wernight/gerrit-hooks-examples/blob/master/ref-update
Feb 5, 2015
Project Member #3 david.pu...@sonymobile.com
(No comment was entered for this change.)
Labels: -Type-Bug Type-Feature
Feb 6, 2015
#4 wer...@beroux.com
One important element I found are environment variables. They are not documented officially but they are the best way it seems to retrieve the Git directory for example.
Feb 16, 2015
#5 wer...@beroux.com
The proposed Github script should help many, but I still haven't found a good solution to have a working tree during a `ref-update`. Doing a `git clone` seems to work, but it's not efficient (hard links aren't so bad but still) and more importantly it messes up most build caches (detecting what changed).

If anyone has a solution to get a local worktree while keeping the repository bare (as it's how it'll be created when done from Gerrit web UI), please comment.
Sign in to add a comment

Powered by Google Project Hosting