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

Check a PR has been committed using git signoff #439

Merged
merged 3 commits into from
Aug 3, 2020

Conversation

NvTimLiu
Copy link
Collaborator

  1. Pre-merge build fails without seeing a -s signoff from anyone committing to a PR.

    If the author of a commit adds a single commit with a -s, that will be sufficient for the pre-merge build to pass.

2, Only update Jenkins scripts, no source change. No unit tests needed.

3, No Github issue related to the PR.

Pre-merge build fails without seeing a `-s` signoff from anyone committing to a PR.
If the author of a commit adds a single commit with a `-s`, that will be sufficient for the pre-merge build to pass.

Signed-off-by: Tim Liu <[email protected]>
@NvTimLiu
Copy link
Collaborator Author

build

revans2
revans2 previously approved these changes Jul 27, 2020
@jlowe jlowe added the build Related to CI / CD or cleanly building label Jul 27, 2020
Copy link
Member

@jlowe jlowe left a comment

Choose a reason for hiding this comment

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

We may need to think a bit more about how to handle signoff checking and multiple commits. Looks like the current algorithm short-circuits to true if any commit has a signoff. However there are situations where this can lead to a false-positive (e.g.: branch contains merged commits from another branch that has at least one signoff but other, non-merged commits do not).

jenkins/Jenkinsfile.premerge Outdated Show resolved Hide resolved
@revans2
Copy link
Collaborator

revans2 commented Jul 30, 2020

@NvTimLiu what are the plans for this? I'd like to see it go in, and I am happy to fix the spelling issue later if you don't have time right now to do it.

@revans2
Copy link
Collaborator

revans2 commented Jul 30, 2020

build

@jlowe
Copy link
Member

jlowe commented Jul 30, 2020

@revans2 are we going with only one signoff commit required per PR? Seems this logic would greenlight a PR with 20 commits where only 1 commit has the signoff.

@revans2
Copy link
Collaborator

revans2 commented Jul 30, 2020

@jlowe I am fine with that, and we can change it in the future if we need to.

@tgravescs
Copy link
Collaborator

"Any contribution which contains commits that are not signed off will not be accepted."

https://github.com/NVIDIA/spark-rapids/blob/branch-0.2/CONTRIBUTING.md

@revans2
Copy link
Collaborator

revans2 commented Jul 30, 2020

So I cannot upmerge without signing off on the merge commit? What if the github merge commit did not have a sign-off on it? Think about the case of merging a commit from one branch to another. I understand what the document says. We wrote that document.

@jlowe
Copy link
Member

jlowe commented Jul 30, 2020

What if the github merge commit did not have a sign-off on it?

Shouldn't be too long before all the commits pulled in by a merge will have signoffs, but it could be a problem in the short term.

Agree this is better than what we have today which is no checks. Let's go with this and file a followup to either tighten the checks or update the docs.

@tgravescs
Copy link
Collaborator

I'm definitely fine with that as like you said its better the no checks

@sameerz
Copy link
Collaborator

sameerz commented Jul 31, 2020

build

1 similar comment
@revans2
Copy link
Collaborator

revans2 commented Jul 31, 2020

build

@jlowe
Copy link
Member

jlowe commented Jul 31, 2020

Appears the CI build failed because the last commit doesn't have a signoff:

08:05:28  + git log e129f1b43f5a1f1861e10701214ef496506fe58f..a0f557a51c2f80da8e3c42dd424a0d2ae89446cf --pretty=format:%h
08:05:28  [Pipeline] sh
08:05:29  + git show a0f557a --shortstat
08:05:29  + grep Signed-off-by
[...]
08:05:29  [Pipeline] End of Pipeline
08:05:29  Setting status of a0f557a51c2f80da8e3c42dd424a0d2ae89446cf to FAILURE with url https://ci.ngcc.nvidia.com/job/spark/job/rapids_premerge-github/315/ and message: 'Build finished. '

I'll dig a bit into why it didn't see the first commit in this PR which does have a signoff.

def signed_off = false
for( String commit : revs_arr ) {
def signed_log = sh(returnStdout: true,
script: "git show ${commit} --shortstat | grep 'Signed-off-by'")
Copy link
Member

Choose a reason for hiding this comment

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

I think there's an issue here where if grep fails to find a match it will return a non-zero exit code. That in turn will cause the pipeline command to return a non-zero exit code which will cause the sh command to throw an exception as described here. I think this either needs to use the returnStatus: true option and switch off the result code of the step or do something like this to avoid grep failing to match to cause a pipeline failure:

Suggested change
script: "git show ${commit} --shortstat | grep 'Signed-off-by'")
script: "git show ${commit} --shortstat | grep 'Signed-off-by || echo'")

@NvTimLiu
Copy link
Collaborator Author

NvTimLiu commented Aug 2, 2020

build

@NvTimLiu
Copy link
Collaborator Author

NvTimLiu commented Aug 2, 2020

build

@NvTimLiu
Copy link
Collaborator Author

NvTimLiu commented Aug 3, 2020

Sorry for the delayed response, I was off for personal issue last week.

Fixed the sh exception when grep not find a match of Signed-off-by in the commit lists of a PR.

@jlowe @revans2 Do you mean we need to make sure the "Signed-off-by" tag exists in every commit?

I've learned from Sameer @sameerz that we can PASS the pre-merge build only if one of the PR commits(instead of all commits) have a Signed-off-by tag.

@jlowe jlowe merged commit bdba1e5 into NVIDIA:branch-0.2 Aug 3, 2020
@NvTimLiu NvTimLiu deleted the singed-off branch August 3, 2020 13:55
nartal1 pushed a commit to nartal1/spark-rapids that referenced this pull request Jun 9, 2021
* Check a PR has been committed using git signoff

Pre-merge build fails without seeing a `-s` signoff from anyone committing to a PR.
If the author of a commit adds a single commit with a `-s`, that will be sufficient for the pre-merge build to pass.

Signed-off-by: Tim Liu <[email protected]>

* Update jenkins/Jenkinsfile.premerge

Co-authored-by: Jason Lowe <[email protected]>

* Append '|| true' to avoid  failing to match to cause the pipeline failure

Co-authored-by: Tim Liu <[email protected]>
Co-authored-by: Sameer Raheja <[email protected]>
Co-authored-by: Jason Lowe <[email protected]>
nartal1 pushed a commit to nartal1/spark-rapids that referenced this pull request Jun 9, 2021
* Check a PR has been committed using git signoff

Pre-merge build fails without seeing a `-s` signoff from anyone committing to a PR.
If the author of a commit adds a single commit with a `-s`, that will be sufficient for the pre-merge build to pass.

Signed-off-by: Tim Liu <[email protected]>

* Update jenkins/Jenkinsfile.premerge

Co-authored-by: Jason Lowe <[email protected]>

* Append '|| true' to avoid  failing to match to cause the pipeline failure

Co-authored-by: Tim Liu <[email protected]>
Co-authored-by: Sameer Raheja <[email protected]>
Co-authored-by: Jason Lowe <[email protected]>
pxLi pushed a commit to pxLi/spark-rapids that referenced this pull request May 12, 2022
tgravescs pushed a commit to tgravescs/spark-rapids that referenced this pull request Nov 30, 2023
Signed-off-by: spark-rapids automation <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Related to CI / CD or cleanly building
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants