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

fix(platform/bitbucket-server): do not force lowercase project keys in autodiscover mode #23261

Merged

Conversation

Churro
Copy link
Collaborator

@Churro Churro commented Jul 8, 2023

Changes

  • Removes an inconsistency on bitbucket-server where project keys in autodiscoverFilter need to be lower-cased to be found
    • Return auto-discovered repositories on bitbucket-server as-is, i.e., without always lower-casing the project key
  • Make autodiscoverFilter search using minimatch case-insensitive
    • Required for existing configs with lower-cased project keys to continue auto-discovering the same repos after this PR

Context

Notes:

  • /rest/api/1.0/repos returns the project key as-is (see here or here for sample responses)
  • Generally, BitBucket Server processes project key and repo slugs in REST API calls case-insensitive (this never changed)

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

Also verified by following the instructions outlined here, creating a project key with uppercase letters, adding a repository, enabling autodiscovery, and defining autodiscoverFilter with a project key that was once uppercase-only, once lower-case only.

docs/usage/self-hosted-configuration.md Outdated Show resolved Hide resolved
lib/workers/global/autodiscover.ts Show resolved Hide resolved
Co-authored-by: Rhys Arkins <rhys@arkins.net>
@Churro Churro changed the title fix(platform/bitbucket-server): do not force lowercase repo names in autodiscover mode fix(platform/bitbucket-server): do not force lowercase project keys in autodiscover mode Jul 8, 2023
@setchy setchy added platform:bitbucket-server Bitbucket Data Center and Server platform type:bug Bug fix of existing functionality labels Jul 8, 2023
@rarkins rarkins added this pull request to the merge queue Jul 9, 2023
Merged via the queue into renovatebot:main with commit 9d3d7a9 Jul 9, 2023
38 checks passed
@renovate-release
Copy link
Collaborator

🎉 This PR is included in version 36.5.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

@cascornelissen
Copy link

Just wanted to share that I'm 99% sure this change broke Renovate for us. We use Bitbucket Server where the projects have uppercase keys and our Renovate configuration used lowercase keys due to what's explained in #23158.

The diff of this PR would suggest this change is backwards compatible but until I changed our configuration to use uppercase project keys Renovate would return None of the discovered repositories matched the filter.

I'm missing tests for regex-based autodiscover filters so that could be the reason? Here's a simplified regex with the required changes.

-export RENOVATE_AUTODISCOVER_FILTER="/^project/(repo-|repo-b|.*-app)$/"
+export RENOVATE_AUTODISCOVER_FILTER="/^PROJECT/(repo-|repo-b|.*-app)$/"

@Churro
Copy link
Collaborator Author

Churro commented Jul 11, 2023

@cascornelissen, yes, when using regular expressions, it is expectedly case-sensitive. I was thinking about programmatically appending /i to each pattern, but generally if you specify a regex without modifier, you expect it to match as-is.

@cascornelissen
Copy link

Yeah, I understand there isn't an obvious fix for it. What might be interesting is that I first tried to append /i to our configuration but that doesn't work, I assume because it's no longer detected as a regex due to it not ending with a / anymore? That might be something to look into 🤷🏼

Not putting blame on anyone, just wanted to share what we ran into and how we solved it, in case others also ran into this.

One final remark is that it confused me that our builds succeeded. I'm not sure if an error exit code makes sense if the autodiscover filter doesn't detect any repositories for example.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
platform:bitbucket-server Bitbucket Data Center and Server platform type:bug Bug fix of existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants