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

[BUG] Inline comments deleted in GitLab pipeline #1380

Closed
Xiaobo2020 opened this issue Apr 21, 2023 · 6 comments · Fixed by #1395
Closed

[BUG] Inline comments deleted in GitLab pipeline #1380

Xiaobo2020 opened this issue Apr 21, 2023 · 6 comments · Fixed by #1395

Comments

@Xiaobo2020
Copy link

Describe the bug

I need both normal comment and maybe inline comment.

To Reproduce
Steps to reproduce the behavior:

  1. write an inline comment message in dangerfile.js. e.g. message("inline comment", "package.json", 1)
  2. write a normal comment message in dangerfile.js. e.g. message("normal comment")
  3. make a merge request in Gitlab and let pipeline run
  4. only show inline comment or normal comment.

Expected behavior

Both comments should display

Screenshots

image

Your Environment

software version
danger.js 11.2.6
node 16.14.0
npm 8.3.1
Operating System MacOS
@Xiaobo2020 Xiaobo2020 added the bug label Apr 21, 2023
@orta
Copy link
Member

orta commented Apr 21, 2023

I dont know if gitlab have the same constraints as github - but inline comments there can only be added to files in the diff. So if the package.json line one is not changed, then it would show up in the main body

@Xiaobo2020
Copy link
Author

Hi @orta .
Here you can think that there are some changes in package.json. So theoretically inline comment should show up.
But I found some instructions about Danger in gitlab. It is mentioned that danger will only post one comment, I am not sure if this is related to the problem I am encountering.
https://docs.gitlab.com/ee/development/dangerbot.html#danger-comments-in-merge-requests

@orta
Copy link
Member

orta commented Apr 22, 2023

That's Danger in Ruby, so it has different constraints. Without being able to show a repro, there's not much I can tell you - I'd recommend running with DEBUG=true or -verbose and looking into what its sending then sending us a PR with what you think should fix it

@Xiaobo2020
Copy link
Author

Xiaobo2020 commented Apr 22, 2023

I try to run DEBUG='*' npx danger ci -v -f in my gitlab pipeline. Through the printed information, I did find a strange phenomenon. It seems that danger did create an inline comment through createMergeRequestDiscussion, but then the inline comment was deleted.

Create Delete
image image

This is my dangerfile.js and I'm sure there are some diff in both file.

message('@xiaobo_wang inline comment', 'danger/tools/rules/common/mrDescription.js', 19);
message('@xiaobo_wang inline comment', 'package.json', 35);

These two inline comments have the same performance, first created and then deleted

@Xiaobo2020
Copy link
Author

Xiaobo2020 commented Apr 24, 2023

I think I can use --newComment and --removePreviousComments to avoid this issue. But it indeed exists in GitLab.
BTW, I found another bug about createComment called in Executor.ts.

@glensc
Copy link
Contributor

glensc commented Jul 30, 2023

Re-created #1381 PR using review notes:

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

Successfully merging a pull request may close this issue.

4 participants