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

Implement GetFiles Func of Bitbucket Server Provider for CEL Expression #1917

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

zakisk
Copy link
Contributor

@zakisk zakisk commented Feb 6, 2025

implemented GetFiles func of Bitbucket server which lists changed files on an event. it also solves the issue in Bitbucket server where pathChanged() function in CEL expression was not working because the func was not implemented. this does slove the issue.

upstream issue: #1738
https://issues.redhat.com/browse/SRVKP-5834

Changes

Submitter Checklist

  • 📝 Ensure your commit message is clear and informative. Refer to the How to write a git commit message guide. Include the commit message in the PR body rather than linking to an external site (e.g., Jira ticket).

  • ♽ Run make test lint before submitting a PR to avoid unnecessary CI processing. Consider installing pre-commit and running pre-commit install in the repository root for an efficient workflow.

  • ✨ We use linters to maintain clean and consistent code. Run make lint before submitting a PR. Some linters offer a --fix mode, executable with make fix-linters (ensure markdownlint and golangci-lint are installed).

  • 📖 Document any user-facing features or changes in behavior.

  • 🧪 While 100% coverage isn't required, we encourage unit tests for code changes where possible.

  • 🎁 If feasible, add an end-to-end test. See README for details.

  • 🔎 Address any CI test flakiness before merging, or provide a valid reason to bypass it (e.g., token rate limitations).

  • If adding a provider feature, fill in the following details:

Git Provider Supported
GitHub App ❌️
GitHub Webhook ❌️
Gitea ❌️
GitLab ❌️
Bitbucket Cloud ❌️
Bitbucket Server ✅️

(update the documentation accordingly)

// `response.Page.Last` is set to `0`. Therefore, to determine if there are more items to fetch,
// we can check if the length of the currently fetched items is less than the specified limit.
// If the length is less than the limit, it indicates that there are no more items to retrieve.
if len(changes) < limit {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<= isnt it ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for example there are 101 changes for PR and limit is 100 so on first iteration we will get 100 changes so if we do it len(changes) <= limit it will break loop and we'll miss left "one" change.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if changes is equal to limit there might be more items.

implemented GetFiles func of Bitbucket server which lists changed
files on an event. it also solves the issue in Bitbucket server where
pathChanged() function in CEL expression was not working because
the func was not implemented. this does slove the issue.

https://issues.redhat.com/browse/SRVKP-5834

Signed-off-by: Zaki Shaikh <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants