Open uncaught opened 2 years ago
Makes sense, the current implementation uses:
Which doesn't look like it is feasible to paginate: https://docs.gitlab.com/ee/api/merge_requests.html#get-single-mr-changes
Perhaps Danger should provide a warning when the number or changes are bigger than files changed?
Well, if danger is supposed to abstract the git layer here, it should behave indiscriminate of platforms. So if for github all files are included, then for gitlab the same should apply. Then the call should be made with the mentioned access_raw_diffs
, even if that takes longer to load.
Because the gitlab-ci runs on a regular cloned repository, would it not be faster to use git diff
in danger instead of calling the gitlab API for changes?
@uncaught the DangerJS GitLab Provider is basically a plugin abstracting the operations that GitLab supports.
The internals of a provider are “private” to that provider, so if the GitLab-supporting-devs decide to use different API calls, or use appropriate CLI commands instead of using API calls, that’s totally a fair choice to balance between maintainability, consistency, and performance.
The goals are “correct”, followed by “fast enough” balanced with “easy enough to maintain”.
Remember:
@fbartho, so if the GitLab Provider is private, is this not the right repository for this issue? Where should I go with it to reach those GitLab-supporting-devs?
Sorry for the lagged response @uncaught -- I think I forgot to hit send.
DangerJS is an open-source community, with many many contributors. This indeed is the right place to reach those GitLab-supporting-devs, however I don't know that we have a "bat-signal" to summon the right people to ask.
You too can contribute here, and I didn't mean that the "GitLab Provider is private" exactly, I meant that for many consumers of DangerJS, we don't look at the internals of how other providers implement their code. You could rewrite the GitLab provider and submit a PR to DangerJS, and we would likely approve it as long as it follows normal coding best practices, and other GitLab users give it a thumbs up.
As long as you're not breaking other providers, or changing the common-core APIs, then the only people you'd need to convince are other DangerJS+GitLab users.
Describe the bug The files listed under
danger.git.*_files
are incomplete - at least in GitLab. It seems only a limited amount of files are listed and possibly only the same number of files that GitLab will show in the diff view of the merge request.GitLab shows
898+
files, danger-js only gives me898
files, while agit diff --name-status origin/master...origin/my_branch|wc -l
shows2549
files.This leads to a crucial pre-merge test not to be executed for many files that are actually contained.
To Reproduce Steps to reproduce the behavior:
danger.git.created_files
ordanger.git.modified_files
ordanger.git.deleted_files
to contain all the files.Expected behavior All files in the merge request are contained in
danger.git
.Screenshots
This is what GitLab shows:
These are the counts of the
danger.git
API that I've printed out (0 added, 2 modified, 896 deleted):And this is the expected count of files included in the merge request (3 added, 10 modified, 2528 deleted):
Your Environment
Additional context It is curious that the "898+" GitLab is showing matches so exactly to the "898" files that danger is giving me. Is there some pagination in the GitLab API that you are using and not pulling additional pages?