New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 657642 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Oct 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 2
Type: Bug

Blocked on:
issue 656493



Sign in to add a comment

Add pre-commit check for DEPS file hash length

Project Member Reported by kainino@chromium.org, Oct 19 2016

Issue description

We need a pre-commit check to make sure that all git commit hashes in the DEPS file are full 40-character hashes.

I accidentally caused a Canary Delivery Issue by committing a short hash:
https://bugs.chromium.org/p/chromium/issues/detail?id=656493

I had log.abbrev_commit=true in my git config, which caused tools/roll_webgl_conformance.py to use a short hash instead of the full hash. This could be improved in the script but we also need to make sure that this can't make it through the CQ.
 

Comment 1 by aga...@chromium.org, Oct 19 2016

Owner: aga...@chromium.org
Status: Started (was: Untriaged)
I'm not sure why andybons and kbr are CC'd on this bug. Regardless, here's a CL to mitigate the issue: https://codereview.chromium.org/2431383003

Adding a PRESUBMIT check to enforce only 40-character hashes is not feasible for a number of reasons:
* Presubmit doesn't have an easy way to parse DEPS files, so it can't just parse the file and check on its own
* gclient can parse DEPS files, and in fact 'gclient verify' exists (and is used by presubmit to ensure that certain aspects of the DEPS file are correct), but doesn't want to enforce 40-character hashes because other kinds of revisions are perfectly reasonable in other repositories.
* Any presubmit check could only be a heuristic and a warning, because 'deadbeef' is both a reasonable short hash and a reasonable branch name, and we don't want to forbid setting branch names (the release buildspec templates would all fail).

Comment 2 by kbr@chromium.org, Oct 19 2016

I suggested kainino@ add andybons (who's heading up the team focused on immediate Infra needs of Chromium developers) and me. Thanks for picking this up though!

Comment 3 by mmoss@chromium.org, Oct 20 2016

> * Any presubmit check could only be a heuristic and a warning, because 'deadbeef' is both a reasonable short hash and a reasonable branch name, and we don't want to forbid setting branch names (the release buildspec templates would all fail).

If the only way to implement this is with a general gclient check, then yes, it would be too strict, but I originally suggested using a presubmit because we were only talking about src/DEPS (and maybe src-internal/DEPS), which shouldn't be using either short refs or symbolic refs.

Comment 4 by aga...@chromium.org, Oct 20 2016

Yep, and I'd be strongly in favor of having a src/PRESUBMIT check that could parse the DEPS file and yell, but from my quick survey of PRESUBMIT.py, presubmit_support.py, and gclient.py, doing so would be a highly non-trivial amount of work, and I judged it not worth it compared to the quick CL I was able to throw together above.

If someone wants to dedicate a couple SWE days to adding this functionality to 'gclient verify' behind a flag, or teaching presubmit_support to parse DEPS files independently, then I wholeheartedly support that and will even do the code reviews! But in general I think this should be a P-3 infra issue at the very highest.

Comment 6 by aga...@chromium.org, Oct 20 2016

Status: Fixed (was: Started)
Because the above CL landed, I'm going to mark this as fixed. If someone really wants to work on adding an actual presubmit check, please re-open and unassign me as the owner :)

Sign in to add a comment