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

feat(platform/bitbucket): autodiscoverProjects #27845

Merged

Conversation

RahulGautamSingh
Copy link
Collaborator

Changes

  • Add new config option autodiscoverProjects for the bitbucket platform which will filter the list of autodiscovered repositories
  • It can be used to both include/exclude projects

Context

Closes: #27661

Documentation (please check one with an [x])

  • I have updated the documentation, or
  • No documentation update is required

How I've tested my work (please select one)

I have verified these changes via:

  • Code inspection only, or
  • Newly added/modified unit tests, or
  • No unit tests but ran on a real repository, or
  • Both unit tests + ran on a real repository (tested locally)

@RahulGautamSingh
Copy link
Collaborator Author

RahulGautamSingh commented Mar 11, 2024

Tokens that provide access to all projects is only avaiable to premium users. Therefor, I had to perform test runs using the repository access tokens.
In the two tests that I performed, I used a repo token to fetch all repos (it fetches only one repo test-repo) and configured autodiscoverProjects filter to
i) once allow the project the test repo belonged to and,
ii) once disallow it,

Below are the logs for both the cases:
Test repo name: rahugautamsingh/ignore/test-repo

When project: ignore was allowed
DEBUG: Combined config
       "config": {
         "forkProcessing": true,
         "token": "***********",
         "endpoint": "https://api.bitbucket.org/",
         "platform": "bitbucket",
         "autodiscover": true,
         "hostRules": [{"matchHost": "https://api.github.com", "token": "***********"}]
       }
       ---
DEBUG: Autodiscovering Bitbucket Cloud repositories
DEBUG: hostRules: applying Bearer authentication for api.bitbucket.org
DEBUG: Autodiscovered 1 repositories
 INFO: Autodiscovered repositories
       "length": 1,
       "repositories": ["rahulgautamsingh/test-repo"]
When the project wasn't allowed
DEBUG: Combined config
       "config": {
         "forkProcessing": true,
         "token": "***********",
         "endpoint": "https://api.bitbucket.org/",
         "platform": "bitbucket",
         "autodiscover": true,
         "autodiscoverProjects": ["!ignore"],
         "hostRules": [{"matchHost": "https://api.github.com", "token": "***********"}]
       }
       ---
DEBUG: Applying autodiscoverProjects filter
       "autodiscoverProjects": ["!ignore"]
DEBUG: No repositories were autodiscovered

@rarkins
Copy link
Collaborator

rarkins commented Mar 11, 2024

@FHannes @setchy for your review if you have time

@rarkins rarkins requested a review from setchy March 11, 2024 13:23
@setchy setchy added the platform:bitbucket Bitbucket Cloud platform label Mar 11, 2024
docs/usage/self-hosted-configuration.md Outdated Show resolved Hide resolved
docs/usage/self-hosted-configuration.md Outdated Show resolved Hide resolved
docs/usage/self-hosted-configuration.md Show resolved Hide resolved
RahulGautamSingh and others added 2 commits March 11, 2024 22:10
Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com>
lib/modules/platform/bitbucket/index.ts Outdated Show resolved Hide resolved
lib/modules/platform/bitbucket/index.ts Outdated Show resolved Hide resolved
@FHannes
Copy link

FHannes commented Mar 12, 2024

@rarkins The implementation looks to meet my requirements for the feature. Given there's no artifacts for this and I deploy Renovate as a container, it's a bit tricky for me to actually test the functionality at this time though.

@rarkins rarkins enabled auto-merge March 12, 2024 14:17
lib/modules/platform/bitbucket/index.ts Outdated Show resolved Hide resolved
@rarkins rarkins added this pull request to the merge queue Mar 14, 2024
Merged via the queue into renovatebot:main with commit 11b3c59 Mar 14, 2024
35 checks passed
@renovate-release
Copy link
Collaborator

🎉 This PR is included in version 37.246.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@FHannes
Copy link

FHannes commented Mar 16, 2024

I was able to test this and it looks to be working as described.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
platform:bitbucket Bitbucket Cloud platform
Projects
None yet
Development

Successfully merging this pull request may close these issues.

autodiscoverProjects for Bitbucket Cloud
7 participants