drone-convert-pathschanged
drone-convert-pathschanged copied to clipboard
Allow Stash users to specify Size parameter of scm.ListOptions, by default only picks up first 25 paths in diff
Rest API's of Stash are paginated and have a default page size of 25. As a result when the plugin fetches the diff via go-scm it only picks up the first 25 paths that were affected in the PR/commit. Diffs with greater than 25 paths affected isn't uncommon for a monorepo. stash.go#GetStashFilesChanged takes in a pagination parameter but plugin doesn't have a way to set the size option.
Add an environment variable to set the page size to a higher value.
References:
- API uses limit of 25 if unspecified. https://docs.atlassian.com/bitbucket-server/rest/4.0.0/bitbucket-rest.html#paging-params
- go-scm stash driver takes scm.ListOptions.Size as a parameter to set this limit https://github.com/drone/go-scm/blob/3edbe5560fdc172e093e6214196ee37ce516152d/scm/driver/stash/git.go#L114
- Plugin already supplies a empty parameter, this can be modified to set the configured size and probably default value greater than 25 https://github.com/meltwater/drone-convert-pathschanged/blob/77a9eebf53d1ce7bba61cbe660f5ed189a70e69a/plugin/plugin.go#L169
Expected behavior
Applicable pipelines must be evaluated based on the entire changeset and not just the first page (Bitbucket sets the limit to 1000 when making api requests for its web gui)