Skip to content

Only check DCO on the author's commits#16388

Merged
mattklein123 merged 7 commits intoenvoyproxy:mainfrom
soulxu:dco_white_list
Jun 3, 2021
Merged

Only check DCO on the author's commits#16388
mattklein123 merged 7 commits intoenvoyproxy:mainfrom
soulxu:dco_white_list

Conversation

@soulxu
Copy link
Copy Markdown
Member

@soulxu soulxu commented May 8, 2021

Signed-off-by: He Jie Xu hejie.xu@intel.com

Commit Message: Only check DCO on the author's commit
Additional Description:
Sometimes missing the sign-off in the merged commit. That forces developers to skip all the checks. So changes to only verify DCO on the author's commits.

Risk Level: low
Testing: n/a
Docs Changes: n/a
Release Notes: n/a
Platform Specific Features: n/a

soulxu added 2 commits May 7, 2021 07:13
Signed-off-by: He Jie Xu <hejie.xu@intel.com>
Signed-off-by: He Jie Xu <hejie.xu@intel.com>
Copy link
Copy Markdown
Contributor

@moderation moderation left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR should be changed to remove exclusionary language as per #11596. Please change the language and file names to "allow list".

@phlax
Copy link
Copy Markdown
Member

phlax commented May 8, 2021

im wondering if this would be better reading from a local file

as it will change fairly frequently im not sure if we want to maintain this in the repo

im also wondering when people hit this - i use no-verify always anyway for other reasons so im wondering if it happens on every push and for how long after a commit with missing DCO is landed its a problem

@snowp
Copy link
Copy Markdown
Contributor

snowp commented May 8, 2021

im also wondering when people hit this - i use no-verify always anyway for other reasons so im wondering if it happens on every push and for how long after a commit with missing DCO is landed its a problem

I think it mainly happens after a merge that brings in bad commits, iirc we only run the check on the diff from the remote when pushing, so once the bad commit has been pushed it won't trigger agan.

@soulxu
Copy link
Copy Markdown
Member Author

soulxu commented May 9, 2021

im also wondering when people hit this - i use no-verify always anyway for other reasons so im wondering if it happens on every push and for how long after a commit with missing DCO is landed its a problem

I think it mainly happens after a merge that brings in bad commits, iirc we only run the check on the diff from the remote when pushing, so once the bad commit has been pushed it won't trigger agan.

Yes, mostly happened when merge with main branch, after one push then it won't be a problem. I just saw it will be asked by new contributor (included me) https://envoyproxy.slack.com/archives/C78HA81DH/p1620285466057600, so I write this up. But also agree with that it may not worth to maintain this. So just bring this up, see if people need it or not.

@soulxu
Copy link
Copy Markdown
Member Author

soulxu commented May 9, 2021

im wondering if this would be better reading from a local file

as it will change fairly frequently im not sure if we want to maintain this in the repo

im also wondering when people hit this - i use no-verify always anyway for other reasons so im wondering if it happens on every push and for how long after a commit with missing DCO is landed its a problem

Follow the document, I remember to execute the format check, but there still have few checks https://github.com/envoyproxy/envoy/blob/main/support/hooks/pre-push#L56-L76

I think I copy those checks into my own scripts avoid copy those checks command manually

@phlax
Copy link
Copy Markdown
Member

phlax commented May 9, 2021

another possibility in wondering about

maybe we could make it that the dco error is only thrown when the author of the problematic commit matches the local author

this would prevent the issue addressed here - although its not a perfect solution and there are some corner cases where it wouldnt work or where it would throw when you didnt want it to. Still would be better than current situation i think

cc @ggreenway

@phlax phlax changed the title Add a white-list file for ignoring the DCO verify on the specific commits Add an allow-list file for ignoring the DCO verify on the specific commits May 9, 2021
@soulxu
Copy link
Copy Markdown
Member Author

soulxu commented May 10, 2021

I found another option is using 'commit-msg' hook. https://git-scm.com/docs/githooks#_commit_msg

It checks on each git commit, the script can check the 'Signed-off-by:' exist or not. If not, then can stop the commit.

Signed-off-by: He Jie Xu <hejie.xu@intel.com>
@soulxu soulxu changed the title Add an allow-list file for ignoring the DCO verify on the specific commits Move the dco verify from the git hook pre-push to commit-msg May 10, 2021
@antoniovicente
Copy link
Copy Markdown
Contributor

Also checking on commit may be generally helpful as it would make errors on pre-push less likely.

Signed-off-by: He Jie Xu <hejie.xu@intel.com>
Copy link
Copy Markdown
Contributor

@moderation moderation left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rename file dco_verify_white_list.txt to dco_verify_allow_list.txt
Edit - it looks like this file is no longer required. Please remove from the PR

Signed-off-by: He Jie Xu <hejie.xu@intel.com>
snowp
snowp previously approved these changes May 12, 2021
Copy link
Copy Markdown
Contributor

@snowp snowp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@moderation do you have any more comments on this one?

@phlax
Copy link
Copy Markdown
Member

phlax commented May 12, 2021

im wondering if this really does anything (i guess the same could be said for the original check)

immediately before this check is run the dco is added - is this just checking the immediately prior hook ?

@phlax
Copy link
Copy Markdown
Member

phlax commented May 12, 2021

i guess the same could be said for the original check

expanding on this - with the original check there is some marginal utility if eg you made a commit and then installed the push-hooks - it would then error and tell you that not all of your commits had DCO

i guess also the original check had some utility if eg you cherry-picked a commit from somewhere and it lacked DCO

with this check neither of the above are true, and therefore i see no utililty to the check - ie if you dont install the hooks - neither DCO is added, not DCO is checked

if you do install the hooks - DCO is added, and (pointlessly) DCO is checked

@moderation
Copy link
Copy Markdown
Contributor

LGTM with exclusionary language / files removed

@soulxu
Copy link
Copy Markdown
Member Author

soulxu commented May 13, 2021

i guess the same could be said for the original check

expanding on this - with the original check there is some marginal utility if eg you made a commit and then installed the push-hooks - it would then error and tell you that not all of your commits had DCO

pre-commit hook and per-push hook are same with checking on all your commits, the difference is the per-hook checks the commits you merged from the main branch, but you can do nothing with it, since it is history commit.

i guess also the original check had some utility if eg you cherry-picked a commit from somewhere and it lacked DCO

Yes, I checked with cherry-pick case, per-commit hook doesn't help with it. But if the cherry-pick commit is done by your own, and you install the hook, there will be a check when you commit that cherry-picked commit. If missing the DCO from cherry-picked commit, the CI is the last defensive line to check on that.

with this check neither of the above are true, and therefore i see no utililty to the check - ie if you dont install the hooks - neither DCO is added, not DCO is checked

if you do install the hooks - DCO is added, and (pointlessly) DCO is checked

Yes, I see the point. The only meaningful thing is the developer removed the signed-off unintentionally. The CI will check the DCO is the next defensive line. Another option is removing the DCO check from the hook, only depends on the CI. And CI found there is no DCO verify, notify the developer to install the hook. Or maybe this is pre-commit hook only save CI from those unintentional cases, that is a little gain. At least both ways can avoid the history commit annoying the developer.

@phlax
Copy link
Copy Markdown
Member

phlax commented May 13, 2021

Another option is removing the DCO check from the hook, only depends on the CI. And CI found there is no DCO verify, notify the developer to install the hook.

that is the conclusion i came to.

the current hook is not doing much and moving it here means it does even less

i think for reviewers, there is a wish that something would catch DCO issues before it lands in a PR as this is a common problem for first time contributors - unfortunately i think using git hooks to check this doesnt help much - which is why the current hook doesnt prevent this happening.

Once you install the hook it never triggers (aside from incorrectly in merges)

@soulxu
Copy link
Copy Markdown
Member Author

soulxu commented May 14, 2021

Another option is removing the DCO check from the hook, only depends on the CI. And CI found there is no DCO verify, notify the developer to install the hook.

that is the conclusion i came to.

the current hook is not doing much and moving it here means it does even less

i think for reviewers, there is a wish that something would catch DCO issues before it lands in a PR as this is a common problem for first time contributors - unfortunately i think using git hooks to check this doesnt help much - which is why the current hook doesnt prevent this happening.

Once you install the hook it never triggers (aside from incorrectly in merges)

@snowp what would you think? If this is we want, I can remove the check.

@phlax
Copy link
Copy Markdown
Member

phlax commented May 14, 2021

The only meaningful thing is the developer removed the signed-off unintentionally.

re this point - i dont see how they can (other than cherry-picking from another checkout without hooks installed) - when you commit (or rebase etc) it automatically adds it - maybe im wrong on this point - but i dont see how

@phlax
Copy link
Copy Markdown
Member

phlax commented May 14, 2021

maybe im wrong on this point - but i dont see how

hmm - i am wrong - you can rebase and remove the message - so the check has that specific benefit

@snowp
Copy link
Copy Markdown
Contributor

snowp commented May 14, 2021

I see the argument behind this check not really doing much, so yeah it might make sense to just remove. cc @htuch that reviewed the original addition

@snowp snowp dismissed their stale review May 14, 2021 19:58

maybe not necessary?

@htuch
Copy link
Copy Markdown
Member

htuch commented May 16, 2021

I have no memory of this place; I personally just use git aliases and automagically populate DCO in every commit, I do not use the hooks reference.

@snowp
Copy link
Copy Markdown
Contributor

snowp commented May 17, 2021

Alright let's just remove the DCO check from the hooks, I don't see much point in having it there if it won't really catch any real issues

@phlax
Copy link
Copy Markdown
Member

phlax commented May 17, 2021

Alright let's just remove the DCO check from the hooks, I don't see much point in having it there if it won't really catch any real issues

the other alternative is to make it check only for the current authors commits

that would mean it still checks the corner-cases it does now - ie bad rebases - but wouldnt trigger on merge

@snowp
Copy link
Copy Markdown
Contributor

snowp commented May 17, 2021

Sure yeah that sounds like an improvement over today, so we can go with that. I would be curious how often that actually comes into play, but we don't really have much insight. I guess as long as people aren't being hit by check failures that they aren't responsible for there's no harm in having an extra light weight check

@soulxu
Copy link
Copy Markdown
Member Author

soulxu commented May 17, 2021

Thanks for the feedback, I will update later

soulxu added 2 commits May 18, 2021 01:33
Signed-off-by: He Jie Xu <hejie.xu@intel.com>
Signed-off-by: He Jie Xu <hejie.xu@intel.com>
@soulxu soulxu changed the title Move the dco verify from the git hook pre-push to commit-msg Only check DCO on the author's commits May 18, 2021
@snowp
Copy link
Copy Markdown
Contributor

snowp commented Jun 3, 2021

Conceptually this seems right, maybe @phlax can review the bash?

Copy link
Copy Markdown
Member

@phlax phlax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm - thanks @soulxu

@mattklein123 mattklein123 merged commit 6f9d06a into envoyproxy:main Jun 3, 2021
leyao-daily pushed a commit to leyao-daily/envoy that referenced this pull request Sep 30, 2021
Signed-off-by: He Jie Xu <hejie.xu@intel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants