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

Allow Stash users to specify Size parameter of scm.ListOptions, by default only picks up first 25 paths in diff #89

Open
madappa-sharath opened this issue Aug 7, 2022 · 1 comment · May be fixed by #90

Comments

@madappa-sharath
Copy link

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:

  1. API uses limit of 25 if unspecified.
    https://docs.atlassian.com/bitbucket-server/rest/4.0.0/bitbucket-rest.html#paging-params
  2. 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
  3. Plugin already supplies a empty parameter, this can be modified to set the configured size and probably default value greater than 25
    changedFiles, err = providers.GetStashFilesChanged(req.Repo, req.Build, p.params.StashServer, p.params.Token, scm.ListOptions{})

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)

@madappa-sharath madappa-sharath changed the title Allow Bitbucket/Stash users to specify Size parameter of scm.ListOptions, by default only picks up first 25 paths in diff Allow Stash users to specify Size parameter of scm.ListOptions, by default only picks up first 25 paths in diff Aug 11, 2022
madappa-sharath pushed a commit to madappa-sharath/drone-convert-pathschanged that referenced this issue Aug 11, 2022
@jimsheldon
Copy link

This looks like a good change to bring in. @hikerspath can you help?

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