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

Review with quick actions #741

Merged
merged 4 commits into from
Sep 30, 2021

Conversation

zampierilucas
Copy link
Collaborator

This is the second part of the change to unify the calls made when approving/commenting on an MR.

The new code removes the usage of the merge_request/approve API and instead uses the /approve and /unapprove notes API quick actions.
Fixes: #708

cmd/mr_approve.go Show resolved Hide resolved
cmd/mr_unapprove.go Outdated Show resolved Hide resolved
cmd/mr_unapprove.go Show resolved Hide resolved
cmd/note_common.go Show resolved Hide resolved
Copy link
Collaborator

@bmeneg bmeneg left a comment

Choose a reason for hiding this comment

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

Thanks @zampierilucas :)

@zampierilucas zampierilucas changed the title Review with quick actions draft: Review with quick actions Sep 24, 2021
@zampierilucas
Copy link
Collaborator Author

I found an issue when using --with-comment

@bmeneg bmeneg self-requested a review September 24, 2021 21:43
@zampierilucas zampierilucas changed the title draft: Review with quick actions Review with quick actions Sep 28, 2021
@zampierilucas
Copy link
Collaborator Author

Submitted a new commit with a fix to --with-comment and everything should be working fine.

@bmeneg
Copy link
Collaborator

bmeneg commented Sep 28, 2021

@zampierilucas I don't think the build issue you're facing is really related to your PR.
I just hit during the release testing: https://app.travis-ci.com/github/zaquestion/lab/builds/238658259

@zampierilucas
Copy link
Collaborator Author

zampierilucas commented Sep 28, 2021

@zampierilucas I don't think the build issue you're facing is really related to your PR. I just hit during the release testing: https://app.travis-ci.com/github/zaquestion/lab/builds/238658259

@bmeneguele GREAT!! I mean bad, really bad :p
but you're right mr_note_test.go:102 is the same one that is breaking on my MR, maybe it has been broken for a while?
OTOH I've tested the command that the it sends lab mr reply origin 1:689060304 -m "text" and It succeedss without a problem, so are we having some issue with our testing <-> gitlab.com relation again?

@bmeneg
Copy link
Collaborator

bmeneg commented Sep 28, 2021

Possibly, but it shouldn't be panic'ing, but just dropping an error of any sort.
I'll try to take a look real quick to see if I can figure out and get the release out of the door.
However, if we can get it solved for the release, we can also get your PR also included before releasing :)

@bmeneg
Copy link
Collaborator

bmeneg commented Sep 28, 2021

The issue is related to something on gitlab side. Two commands in the very same MR, but in different notes behaves differently with no apparent reason:

$ lab mr reply lab-testing 3953:599577526 -m "test"
https://gitlab.com/lab-testing/test/merge_requests/3953#note_689563923
$ lab mr reply lab-testing 3953:689488483 -m "test"
$ 

The first run returns what is expected, in the last one, it doesn't.
For "old" notes, it seems to work just fine, while for new ones, it doesn't.

Something changed in the API?
I'm going to dig a further.

@bmeneg
Copy link
Collaborator

bmeneg commented Sep 29, 2021

For some really weird reason the discussions API is not returning new notes added to the MR, no matter if it's created using the Notes (where individual_note = true) or the Discussion API (where individual_note = false).

I tested it using the API directly (through curl) so that's not an issue with lab, but definitely an issue on GitLab itself and a recent one, because the last PR that @prarit created was 4 days ago and everything was working just fine. I didn't find any issue open on gitlab.org though.

@bmeneg
Copy link
Collaborator

bmeneg commented Sep 30, 2021

Well, the problem turned out to be a lack of an HTTP header in API responses for MRs/Issues with more than 10k comments, which happens in our testing repo.

@zampierilucas helped me to find the issue and the PR #745 was created with the fix.

@bmeneg
Copy link
Collaborator

bmeneg commented Sep 30, 2021

As soon as #745 is merged, this PR will need to be rebased.

@prarit
Copy link
Collaborator

prarit commented Sep 30, 2021

10k? What have you been doing to my MRs? 😄

@zampierilucas
Copy link
Collaborator Author

@bmeneguele sure, I will rebase it as soon as 745 gets merged :D

10k? What have you been doing to my MRs? smile

@prarit GL considers 'entries' as any historical data on the MR, not only 'comments', for example, 'X person approved the MR' is also an entry, That's why we were able to beet GitLab 10k restriction that fast :p

@prarit
Copy link
Collaborator

prarit commented Sep 30, 2021

Entries? I'm just going to assume that somewhere there is a character-by-character review of one of my changesets.

@bmeneg
Copy link
Collaborator

bmeneg commented Sep 30, 2021

@zampierilucas #745 is now merged, please go ahead and rebase this one here so we can make sure it's also fine :)

Merged comment and approve api calls into a single one.

Signed-off-by: Lucas Zampieri <[email protected]>
Merged comment and approve api calls into a single one.

Signed-off-by: Lucas Zampieri <[email protected]>
Added quickaction to the end of file when using -F;
Removed unessary reverse bool;

Signed-off-by: Lucas Zampieri <[email protected]>
Moved --with-comment threatment externally, due to conflicts with -m
and -f

Signed-off-by: Lucas Zampieri <[email protected]>
@codecov
Copy link

codecov bot commented Sep 30, 2021

Codecov Report

Merging #741 (8bbc211) into master (2fb6734) will increase coverage by 0.04%.
The diff coverage is 45.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #741      +/-   ##
==========================================
+ Coverage   54.71%   54.75%   +0.03%     
==========================================
  Files          77       77              
  Lines        5596     5612      +16     
==========================================
+ Hits         3062     3073      +11     
- Misses       2251     2255       +4     
- Partials      283      284       +1     
Impacted Files Coverage Δ
cmd/mr_approve.go 70.27% <33.33%> (-1.61%) ⬇️
cmd/mr_unapprove.go 75.00% <47.36%> (+3.12%) ⬆️
cmd/note_common.go 54.57% <66.66%> (-0.24%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2fb6734...8bbc211. Read the comment docs.

@bmeneg bmeneg merged commit 8def936 into zaquestion:master Sep 30, 2021
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.

mr un/approve: If -F, un/approve completes even if file read failed
3 participants