changesets-gitlab
changesets-gitlab copied to clipboard
comment adds new comment with every commit
since we updated changesets-gitlab we have now the issue that with every commit the changesets-gitlab comment command creates a new comment in our merge request. before the update it only created one comment for a merge request.
Any screenshot?
Should be related to #138 or #143(most likely)
cc @alan910127
Hello @maxkarkowski, are you upgraded from v0.11.0 or v0.10.x? This information can help me locate the issue faster 😄
hey @alan910127 sorry of course i can. we are currently on version 0.10.3
Update: update to latest version and the problem is still there
Any screenshot?
Should be related to #138 or #143(most likely)
cc @alan910127
here is a screenshot
but even if there is a changeset found, new comment will appear with everey command run
Hey @maxkarkowski, I couldn't reproduce the error on a project created on gitlab.com. Could you provide some information that might be related to this issue?
Here's something I think might be relevant:
CI_MERGE_REQUEST_IIDpredefined variable- Discussions API
@alan910127 I have the same problem, we are using a self-hosted instance of GitLab if that helps, but when I tested on gitlab.com I also did not get any error.
@alan910127 I have the same problem, we are using a self-hosted instance of GitLab if that helps, but when I tested on
gitlab.comI also did not get any error.
we are also using a self hosted gitlab
Hey @maxkarkowski, I couldn't reproduce the error on a project created on
gitlab.com. Could you provide some information that might be related to this issue?Here's something I think might be relevant:
CI_MERGE_REQUEST_IIDpredefined variable- Discussions API
this is the comment job we have . it runs on every merge request
comment:
rules:
- if: '$CI_MERGE_REQUEST_IID && $CI_COMMIT_BRANCH != "changeset-release/main"'
extends:
- .init-pnpm
script:
- pnpm changesets-gitlab comment # comment automatically like https://github.com/changesets/bot
.init-pnpm:
before_script:
- corepack enable
- corepack prepare [email protected] --activate
- node --max-old-space-size=8192
- pnpm config set store-dir .pnpm-store
- pnpm install # install dependencies
cache:
key:
files:
- pnpm-lock.yaml
paths:
- .pnpm-store
Got it. I will try to spin up a self-hosted GitLab instance and test the issue inside that. What's your GitLab version in case it helps?
Got it. I will try to spin up a self-hosted GitLab instance and test the issue inside that. What's your GitLab version in case it helps?
ist GitLab Community Edition v16.6.0
I may have opportunity to test and debug this issue on our internal GitLab service today, I'll try to give a fix soon.
I'm meeting bigger issues...:
@JounQin I have found that the /projects/:id/merge_requests/:merge_request_iid/diffs is only available on GitLab 15.7 or above.
However, it's not documented very well though 😕, there is only a mention at the docs for changes API.
Reverting #143 could solve the 404 issue and potentially this issue as well.
Update:
Using [email protected] in a GitLab 13 instance does not have the issue of commenting repeatedly.
So, reverting #143 should also solve this one, but there will always be a deprecation warning in the pipeline though 😅.
@maxkarkowski @idumancic It should be fixed in version 0.11.4, you can try it out!
@maxkarkowski @idumancic It should be fixed in version
0.11.4, you can try it out!
didnt fix it for me :/
@maxkarkowski Please provide more details, such as GitLab instance version?
@maxkarkowski Please provide more details, such as GitLab instance version?
it is still GitLab Community Edition v16.6.0. ;) i just updated to the newest version of changesets-gitlab. the pipeline then executes pnpm changesets-gitlab comment .
i first commited without a changeset. then i added a changeset and commit this as well. and now i have still 2 comments in my merge request
I'm a bit hesitant to admit this, but I'm having difficulty configuring a GitLab CE instance in a newer version with runners correctly. Would anyone be willing to grant me access to their GitLab instance so that I can test for the issue?
I'm a bit hesitant to admit this, but I'm having difficulty configuring a GitLab CE instance in a newer version with runners correctly. Would anyone be willing to grant me access to their GitLab instance so that I can test for the issue?
sorry for the inconvenience but i cannot share my gitlab instance because it is owned by customer with very sensitive data
@alan910127 Just wanted to tell you that it's fixed for me, it only generates one comment. Sorry for being so late to respond, honestly I forgot about it.
@alan910127 Just wanted to tell you that it's fixed for me, it only generates one comment. Sorry for being so late to respond, honestly I forgot about it.
that is weird. can you maybe share what command you execute in your pipeline? i still get multiple comments :/
@maxkarkowski Maybe you can help to use patch-package to add some logs for debugging? I don't have a GitLab CE v16.6.0 for debugging for you, sorry.
@maxkarkowski Maybe you can help to use
patch-packageto add some logs for debugging? I don't have a GitLab CE v16.6.0 for debugging for you, sorry.
what exactly should i do with patch package? run it before changesets-gitlab on my pipeline? i use pnpm so i can only use pnpm patch.
what exactly should i do with patch package? run it before changesets-gitlab on my pipeline? i use pnpm so i can only use pnpm patch.
Thanks that you're willing to help for debugging.
You can try to patch node_modules/changesets-gitlab/lib/comment.js accordingly.
Mostly you should add some logs at the following:
https://github.com/un-ts/changesets-gitlab/blob/9c6e79263f38d552f65103e6199ef9054d2f2d4a/src/comment.ts#L107-L132
So that we can check why the previous mr was not found.
After seeing api.MergeRequestDiscussions, I have a theory that it could be API changed between MR discussions vs notes.
# yarn 1
yarn add https://pkg.csb.dev/un-ts/changesets-gitlab/commit/569933f7/changesets-gitlab
# yarn 2, 3
yarn add changesets-gitlab@https://pkg.csb.dev/un-ts/changesets-gitlab/commit/569933f7/changesets-gitlab/_pkg.tgz
# npm
npm i https://pkg.csb.dev/un-ts/changesets-gitlab/commit/569933f7/changesets-gitlab
@maxkarkowski Please help to test.
# yarn 1 yarn add https://pkg.csb.dev/un-ts/changesets-gitlab/commit/569933f7/changesets-gitlab # yarn 2, 3 yarn add changesets-gitlab@https://pkg.csb.dev/un-ts/changesets-gitlab/commit/569933f7/changesets-gitlab/_pkg.tgz # npm npm i https://pkg.csb.dev/un-ts/changesets-gitlab/commit/569933f7/changesets-gitlab@maxkarkowski Please help to test.
i will try this. didn't try patching the version yet.
width your version i got the following message
$ pnpm changesets-gitlab comment
(node:181) DeprecationWarning: This endpoint was deprecated in Gitlab API 15.7 and will be removed in API v5. Please use the "allDiffs" function instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
The warning is not related and expected. Does the comment functionality works as expected?
The warning is not related and expected. Does the comment functionality works as expected?
no it still creates a new comment with every commit. i try to patch your comment version manually. maybe there es a cache issue with your package at the moment.
If you're not using note type comment, my fix should be useless. So hope you could help to debug later.
If you're not using
notetype comment, my fix should be useless. So hope you could help to debug later.
how can i set it ? as i said, i only execute changesets-gitlab comment. i am happy to help to debug if you tell me what i should do :)
