Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sign-offs hung up on old user account #39

Closed
bndw opened this issue Sep 28, 2017 · 14 comments · Fixed by #68
Closed

sign-offs hung up on old user account #39

bndw opened this issue Sep 28, 2017 · 14 comments · Fixed by #68
Labels

Comments

@bndw
Copy link

bndw commented Sep 28, 2017

It seems that there may be a situation in which this bot uses the user/email from a previously replaced commit. This seems to be happening over on envoyproxy/envoy#1743

Here's how we got in this state:

  1. A commit was made and signed with user a
  2. The commit was squashed and resigned with user b
  3. The bot is still looking for user a, even though the commit is now signed with user b.
@hiimbex
Copy link
Contributor

hiimbex commented Sep 28, 2017

Hiya! Just commented in envoyproxy/envoy#1743 (comment) but basically, as long as the git config is set to the correct email, say email a. As long as the commit is signed with email a, the bot should correctly approve the commit.

@bndw
Copy link
Author

bndw commented Sep 28, 2017

Hey, thanks for the quick response!

git config --global -l
user.name=bndw
user.email=benjamindwoodward@gmail.com

I just rebased, signed with that account, and force pushed envoyproxy/envoy@75c2374 to envoyproxy/envoy#1768, but it's still reporting:

DCO — Expected "bndw <benwoodward@example.com>", but got "bndw <benjamindwoodward@gmail.com>"

Anything else to try?

@hiimbex
Copy link
Contributor

hiimbex commented Sep 28, 2017

Ah, you're completely right, I was able to recreate this here: probot/test#24. This is definitely an issue on our end.

This is not behavior I expect, but it appears to be due to our use of the GitHub API here: https://developer.github.com/v3/repos/commits/#compare-two-commits

The API call we're using has this data:

"commit": {
  "author": {
        "name": "Monalisa Octocat",
        "email": "support@github.com",
        "date": "2011-04-14T16:00:49Z"
      },
  "committer": {
        "name": "Monalisa Octocat",
        "email": "support@github.com",
        "date": "2011-04-14T16:00:49Z"
      }
 }

We do our checks using commit.author.email:
https://github.com/probot/dco/blob/3e486021f8333df5c957e9b12c53bca1d9c7ba5f/lib/dco.js#L30-L35

When you rebase, the committer email is probably the one that gets updated, and I think it should be the one we use. So, I think on our end we should swap to commit.comitter.email. Thoughts @bkeepers ?

@bndw
Copy link
Author

bndw commented Sep 28, 2017

Nice find! Another test potentially worth running would be to specify the author on the rebased commit and see if that updates the check?

But using commit.comitter.email makes sense to me.

@hiimbex
Copy link
Contributor

hiimbex commented Sep 28, 2017

Another test potentially worth running would be to specify the author on the rebased commit and see if that updates the check?

It would be my suspicion that that would work! Not super familiar with all the rebase options, so I didn't even realize you could update the author 🙇 let me know if that works!

@bndw
Copy link
Author

bndw commented Sep 28, 2017

Just tried this but it didn't appear to update the check. In my commit message, I specified the following but it's still using the old author:

My commit message

Signed-off-by: bndw <benjamindwoodward@gmail.com>
Author:    bndw <benjamindwoodward@gmail.com>

@hiimbex
Copy link
Contributor

hiimbex commented Sep 28, 2017

Hmm I believe it's because you need to use git commit --amend --author="Author Name <email@address.com>" after an interactive rebase (not my strong suit lol). But this worked here: probot/test#24 for me. I did git rebase -i my_commit and then added x git commit --amend --author="Author Name <email@address.com>" at the top and saved and force pushed.

@bndw
Copy link
Author

bndw commented Sep 28, 2017

Excellent, this workaround should unblock the linked PR!

Just to be clear, the steps to change the author were:

  1. interactive rebase
  2. In the commit message, add this line to the top, above the message? x git commit --amend --author="Author Name <email@address.com>"

@hiimbex
Copy link
Contributor

hiimbex commented Sep 28, 2017

Yes! To clarify, the x in interactive rebased represents exec, so I did this through vim (not in the commit message itself) and deleted the first line which was noop and replaced it with x git commit --amend --author="Author Name <email@address.com>" and upon saving that and then force pushing, that updated the author for me.

For the purposes of the future, I'm somewhat unsure of whether the DCO should be based on the author or the committer, so I'd be open to input from some of the linux folks who use the bot on what they think.

@bndw
Copy link
Author

bndw commented Sep 28, 2017

Ok that makes sense, I was able work around this by amending the author on my commit.

I'll leave this issue open since it sounds like there's some discussion to take place. Thanks again @hiimbex 😄

@bkeepers
Copy link
Contributor

So, I think on our end we should swap to commit.comitter.email. Thoughts @bkeepers ?

👍 Great catch! Sounds good to me.

@stale
Copy link

stale bot commented Apr 5, 2018

Is this still relevant? If so, please comment with any updates or addition details.

@stale stale bot added the wontfix label Apr 5, 2018
@bndw
Copy link
Author

bndw commented Apr 5, 2018

Looks like people are still hitting this issue, but I'm not able to allocate anymore time to it.

@github-actions
Copy link

🎉 This issue has been resolved in version 1.0.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants