After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 696182 - Add pre-receive hook to jhbuild repository to catch XML errors
Add pre-receive hook to jhbuild repository to catch XML errors
Status: RESOLVED WONTFIX
Product: sysadmin
Classification: Infrastructure
Component: Git
unspecified
Other Linux
: Normal normal
: ---
Assigned To: GNOME Sysadmins
GNOME Sysadmins
Depends on: 696184
Blocks:
 
 
Reported: 2013-03-20 11:58 UTC by Philip Withnall
Modified: 2016-01-05 15:12 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Draft pre-receive hook to check jhbuild modulesets (4.23 KB, patch)
2013-03-22 08:23 UTC, Philip Withnall
needs-work Details | Review

Description Philip Withnall 2013-03-20 11:58:57 UTC
As more things start depending on jhbuild (such as Jenkins and build bots), the validity of moduleset files becomes more important.

It would be quite useful if there was a pre-receive hook on the jhbuild git module to run `make check-modulesets` on jhbuild (which I’ll add to jhbuild as part of a separate bug) and abort the push if that fails.
Comment 1 Olav Vitters 2013-03-20 12:13:15 UTC
That would allow anyone with a git account to run software on git.gnome.org. A hook should be on its own and be committed to sysadmin-bin/git.
Comment 2 Philip Withnall 2013-03-20 12:25:53 UTC
(In reply to comment #0)
> It would be quite useful if there was a pre-receive hook on the jhbuild git
> module to run `make check-modulesets` on jhbuild (which I’ll add to jhbuild as
> part of a separate bug) and abort the push if that fails.

Filed as bug #696184.
Comment 3 Colin Walters 2013-03-20 14:51:35 UTC
The jhbuild build bots would immediately fail though, and we'd hopefully notice and fix it quickly.  See https://bugzilla.gnome.org/show_bug.cgi?id=695149 for some ideas on how we could do that.
Comment 4 Philip Withnall 2013-03-20 16:59:42 UTC
(In reply to comment #3)
> The jhbuild build bots would immediately fail though, and we'd hopefully notice
> and fix it quickly.

True, but this means lots of people get notified (e.g. through Jenkins) and module health stats get skewed unnecessarily. I think it’s better to get the original committer to fix their mistake before pushing, then nobody has to waste time context switching to “what’s gone wrong with Jenkins” mode.
Comment 5 Colin Walters 2013-03-20 17:14:43 UTC
(In reply to comment #4)
> (In reply to comment #3)
> > The jhbuild build bots would immediately fail though, and we'd hopefully notice
> > and fix it quickly.
> 
> True, but this means lots of people get notified (e.g. through Jenkins) and
> module health stats get skewed unnecessarily. I think it’s better to get the
> original committer to fix their mistake before pushing, then nobody has to
> waste time context switching to “what’s gone wrong with Jenkins” mode.

Right; but as a general rule I think one has to carefully constrain what code gets run as part of a pre-commit.  Checking for trailing whitespace and that sort of thing is pretty easy, runs in a predictable amount of time, etc.   But growing that closer to "make check" type stuff is another world.

There's the simple fact that we're running arbitrary code from the repositories on the git server itself (does this code have write access to the repo?).

The other way to ensure that bad code doesn't make it into the repos is to automatically check incoming patches before they land.
Comment 6 Philip Withnall 2013-03-22 08:23:42 UTC
Created attachment 239519 [details] [review]
Draft pre-receive hook to check jhbuild modulesets

Here’s a first draft of a pre-receive hook to implement this. As suggested, it avoids executing arbitrary code on the server (`make check-modulesets`) by replicating the xmllint call itself. It’s only one line of code. It checks every moduleset file updated in a commit, but doesn’t re-check all modulesets if the DTD changes (see the comment at the top of the file). I don’t know if we want this.

It’s completely untested and may have silly syntax errors or explode. I’m just attaching it to get feedback on whether sysadmins (and others) think this is the right approach.
Comment 7 Andrea Veri 2013-11-21 14:57:18 UTC
The GNOME Infrastructure Team is currently migrating its bug / issue tracker away from Bugzilla to Request Tracker and therefore all the currently open bugs have been closed and marked as OBSOLETE.

The following move will also act as a cleanup for very old and ancient tickets that were still living on Bugzilla. If your issue still hasn't been fixed as of today please report it again on the relevant RT queue.

More details about the available queues you can report the bug against can be found at https://wiki.gnome.org/Sysadmin/RequestTracker.

Thanks for your patience,

the GNOME Infrastructure Team
Comment 8 Andrea Veri 2015-01-28 15:52:59 UTC
Re-opening as this bug is still valid.
Comment 9 Philip Withnall 2015-01-29 11:20:32 UTC
(In reply to comment #8)
> Re-opening as this bug is still valid.

So what do we still need to get this fixed? Looking back at the question of re-validating if the DTD changes, I think it would be too restrictive to do that, since it would disallow split commits:
 1. Change DTD.
 2. Update modulesets to validate against the new one.

Changes to the DTD are pretty rare; if they somehow become a problem in the future, we could re-evaluate.
Comment 10 Olav Vitters 2015-02-02 15:37:13 UTC
Split commits are fairly easy to deal with. You just have the hook check the latest commit. A server hook only runs once you push. So you cannot push between commits, but you can afterwards.

This already happens a few times with e.g. doap file check, multiple commits each still with typo's. Only the last one fixes everything and then the push works.
Comment 11 Philip Withnall 2016-01-04 22:56:36 UTC
Not enough interest in this, and as Colin says, we’d see failure in the buildbots quickly enough. Not worth the risk of arbitrary code execution on the git servers.
Comment 12 Colin Walters 2016-01-05 14:17:37 UTC
What we really want is a gating system for commits anyways with build systems that are sandboxed to some degree (e.g. linux-user-chroot, Docker, etc.) and that don't have write access to git.
Comment 13 Philip Withnall 2016-01-05 15:12:04 UTC
(In reply to Colin Walters from comment #12)
> What we really want is a gating system for commits anyways with build
> systems that are sandboxed to some degree (e.g. linux-user-chroot, Docker,
> etc.) and that don't have write access to git.

That would be super. I guess the overall plan would be to gate things based on gnome-continuous failures/passes then? Is there a bug open for this?