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(config): filePatterns #34615

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

RahulGautamSingh
Copy link
Collaborator

@RahulGautamSingh RahulGautamSingh commented Mar 4, 2025

Changes

  • Migrate fileMatch to filePatterns
  • Add glob pattern support

Context

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:

Sorry, something went wrong.

Verified

This commit was signed with the committer’s verified signature.
mkniewallner Mathieu Kniewallner
Co-authored-by: Sebastian Poxhofer <secustor@users.noreply.github.com>
Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com>
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
secustor
secustor previously approved these changes Mar 5, 2025
@RahulGautamSingh RahulGautamSingh requested a review from viceice March 5, 2025 20:54
Copy link
Member

@viceice viceice left a comment

Choose a reason for hiding this comment

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

there are some more samples, which can be simplified by using glob, otherwise LGTM

Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
Copy link
Member

@viceice viceice left a comment

Choose a reason for hiding this comment

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

we can do the regex to glob changes in a followup pr of cause

@viceice
Copy link
Member

viceice commented Mar 6, 2025

needs update because of:

Copy link
Collaborator

@rarkins rarkins left a comment

Choose a reason for hiding this comment

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

Partial review done. Please note each of the suggested changes and apply them widely to the whole PR. e.g. ^foo$ patterns should always just be foo.

@@ -78,7 +78,7 @@ export const presets: Record<string, Preset> = {
{
customType: 'regex',
datasourceTemplate: 'docker',
fileMatch: ['(^|/)Chart\\.yaml$'],
filePatterns: ['/(^|/)Chart\\.yaml$/'],
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
filePatterns: ['/(^|/)Chart\\.yaml$/'],
filePatterns: ['**/Chart.yaml'],

Copy link
Member

Choose a reason for hiding this comment

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

why resolved?

@@ -792,7 +792,7 @@ Example:
"customManagers": [
{
"customType": "regex",
"fileMatch": ["values.yaml$"],
"filePatterns": ["**values.yaml"],
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
"filePatterns": ["**values.yaml"],
"filePatterns": ["**/values.yaml"],

@@ -884,7 +884,7 @@ Only the `json`, `toml` and `yaml` formats are supported.
{
"customType": "jsonata",
"fileFormat": "toml",
"fileMatch": ["file.toml"],
"filePatterns": ["some/file.toml"],
Copy link
Member

Choose a reason for hiding this comment

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

is this path change intentional?


```json
{
"kubernetes": {
"fileMatch": ["^config/.*\\.yaml$"]
"filePatterns": ["/^config/.*\\.yaml$/"]
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
"filePatterns": ["/^config/.*\\.yaml$/"]
"filePatterns": ["config/**/*.yaml"]

looks simpler

@@ -78,7 +78,7 @@ export const presets: Record<string, Preset> = {
{
customType: 'regex',
datasourceTemplate: 'docker',
fileMatch: ['(^|/)Chart\\.yaml$'],
filePatterns: ['/(^|/)Chart\\.yaml$/'],
Copy link
Member

Choose a reason for hiding this comment

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

why resolved?

'(^|/)GNUMakefile$',
'\\.mk$',
],
filePatterns: ['**/Makefile', '**/GNUMakefile', '**/*.mk'],
Copy link
Member

Choose a reason for hiding this comment

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

are you sure glob is case insensitive?

Suggested change
filePatterns: ['**/Makefile', '**/GNUMakefile', '**/*.mk'],
filePatterns: ['**/{M,m}akefile', '**/GNUMakefile', '**/*.mk'],

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Rhys, suggested that it is case insensitive. I didn't double check and went with the suggestion.

I looked it up and there seems to be mixed answers. I will apply your suggestion to be 100% safe.

@@ -109,7 +104,7 @@ export const presets: Record<string, Preset> = {
customType: 'regex',
datasourceTemplate:
'{{#if datasource}}{{{datasource}}}{{else}}maven{{/if}}',
fileMatch: ['(^|/)pom\\.xml$'],
filePatterns: ['/(^|/)pom\\.xml$/'],
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
filePatterns: ['/(^|/)pom\\.xml$/'],
filePatterns: ['**/pom.xml'],

@@ -122,7 +117,7 @@ export const presets: Record<string, Preset> = {
customManagers: [
{
customType: 'regex',
fileMatch: ['.+\\.tfvars$'],
filePatterns: ['/.+\\.tfvars$/'],
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
filePatterns: ['/.+\\.tfvars$/'],
filePatterns: ['**/*.tfvars'],

simplify others too where possible

@@ -91,7 +91,7 @@ Here is the Renovate configuration to use Terraform, `aws-rds` and Aurora MySQL:
{
"description": "Update RDS",
"customType": "regex",
"fileMatch": [".+\\.tf$"],
"filePatterns": ["/.+\\.tf$/"],
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
"filePatterns": ["/.+\\.tf$/"],
"filePatterns": ["**/*.tf"],

prefer glob in samples where possible

Co-authored-by: Michael Kriese <michael.kriese@visualon.de>

```json
{
"fileMatch": ["'(^|/)fleet.ya?ml", "myGitRepoManifests\\.yaml"]
"filePatterns": ["**/fleet.{yaml,yml}", "**myGitRepoManifests.yaml"]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
"filePatterns": ["**/fleet.{yaml,yml}", "**myGitRepoManifests.yaml"]
"filePatterns": ["**/fleet.{yaml,yml}", "**/myGitRepoManifests.yaml"]


```json
{
"pip-compile": {
"fileMatch": ["(^|/)requirements\\.txt$"]
"filePatterns": ["**/requirements\\.txt"]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
"filePatterns": ["**/requirements\\.txt"]
"filePatterns": ["**/requirements.txt"]

Comment on lines +16 to +17
'/(^|/)pyproject\\.toml$/', // `tool.pixi` section
'/(^|/)pixi\\.toml$/', // root object
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
'/(^|/)pyproject\\.toml$/', // `tool.pixi` section
'/(^|/)pixi\\.toml$/', // root object
'**/pyproject.toml', // `tool.pixi` section
'**/pixi.toml', // root object

@@ -9,7 +9,7 @@ export const url = 'https://www.puppet.com/docs/index.html';
export const categories: Category[] = ['iac', 'ruby'];

export const defaultConfig = {
fileMatch: ['(^|/)Puppetfile$'],
filePatterns: ['/(^|/)Puppetfile$/'],
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
filePatterns: ['/(^|/)Puppetfile$/'],
filePatterns: ['**/Puppetfile'],

@@ -9,7 +9,7 @@ export const url = 'https://github.com/pyenv/pyenv#readme';
export const categories: Category[] = ['python'];

export const defaultConfig = {
fileMatch: ['(^|/)\\.python-version$'],
filePatterns: ['/(^|/)\\.python-version$/'],
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
filePatterns: ['/(^|/)\\.python-version$/'],
filePatterns: ['**/.python-version'],

@@ -8,7 +8,7 @@ export const url = 'https://cakebuild.net/docs';
export const categories: Category[] = ['dotnet'];

export const defaultConfig = {
fileMatch: ['\\.cake$'],
filePatterns: ['/\\.cake$/'],
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
filePatterns: ['/\\.cake$/'],
filePatterns: ['**/*.cake'],

@@ -16,7 +16,7 @@ export const categories: Category[] = ['rust'];

export const defaultConfig = {
commitMessageTopic: 'Rust crate {{depName}}',
fileMatch: ['(^|/)Cargo\\.toml$'],
filePatterns: ['/(^|/)Cargo\\.toml$/'],
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
filePatterns: ['/(^|/)Cargo\\.toml$/'],
filePatterns: ['**/Cargo.toml'],

@@ -13,7 +13,7 @@ export const url = 'https://cocoapods.org';
export const categories: Category[] = ['swift'];

export const defaultConfig = {
fileMatch: ['(^|/)Podfile$'],
filePatterns: ['/(^|/)Podfile$/'],
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
filePatterns: ['/(^|/)Podfile$/'],
filePatterns: ['**/Podfile'],

@@ -10,7 +10,7 @@ export const url =
export const categories: Category[] = ['perl'];

export const defaultConfig = {
fileMatch: ['(^|/)cpanfile$'],
filePatterns: ['/(^|/)cpanfile$/'],
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
filePatterns: ['/(^|/)cpanfile$/'],
filePatterns: ['**/cpanfile'],

@@ -6,7 +6,7 @@ export { updateArtifacts } from './artifacts';
export const supportsLockFileMaintenance = true;

export const defaultConfig = {
fileMatch: ['(^|/)devbox\\.json$'],
filePatterns: ['/(^|/)devbox\\.json$/'],
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
filePatterns: ['/(^|/)devbox\\.json$/'],
filePatterns: ['**/devbox.json'],

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

Successfully merging this pull request may close these issues.

Migrate fileMatch to filePatterns and support matchRegexOrGlobList
6 participants