Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

transformDatasourceVersion #34555

Closed
rarkins opened this issue Feb 28, 2025 · 4 comments
Closed

transformDatasourceVersion #34555

rarkins opened this issue Feb 28, 2025 · 4 comments
Labels
priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others

Comments

@rarkins
Copy link
Collaborator

rarkins commented Feb 28, 2025

Describe the proposed change(s).

Tell us more.

Related discussions:

There are times when a datasource's version string is similar but different to the string in the repo (currentValue). For example 1.2.3 versus 1-2-3. We could use a versioning like regex to extract major/minor/patch from both of these, but if 1-2-4 were available then the string 1.2.3 in the repo would be replaced with 1-2-4 instead of 1.2.4.

We should rename and enhance extractVersion to also allow transformation:

  • New option name is transformDatasourceVersion
  • It's an array of strings, with length 1 or 2
  • If length 1, it must contain a version capture group
  • If length 2, the second element is the "transform" part
  • We migrate any existing extractVersion string to be an array of length 1 for transformDatasourceVersion

As an example, let's say the currentValue is minio_20250218162555.0.0_amd64.deb while an equivalent raw datasource version is RELEASE.2025-02-18T16-25-55Z. In this case it's intended that transformDatasourceVersion could be ["^RELEASE\.(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})T(?<hour>\d{2})-(?<minute>\d{2})-(?<seconds>\d{2})Z$", "minio_{{year}}{{month}}{{day}}{{hour}}{{minute}}{{seconds}}.0.0_amd64.deb"].

@rarkins rarkins added the priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others label Feb 28, 2025
@viceice
Copy link
Member

viceice commented Mar 2, 2025

wouldn't a string or object type easier for validation and json schema 🤔

@rarkins
Copy link
Collaborator Author

rarkins commented Mar 2, 2025

I was trying to avoid a complex config structure, especially for the most common use case of extractVersion on its own. Would you prefer keeping extractVersion as-is and passing its results (groups) to a new transformVersion?

@viceice
Copy link
Member

viceice commented Mar 2, 2025

I was trying to avoid a complex config structure, especially for the most common use case of extractVersion on its own. Would you prefer keeping extractVersion as-is and passing its results (groups) to a new transformVersion?

yes

@rarkins
Copy link
Collaborator Author

rarkins commented Mar 4, 2025

I have doubts that it's good design either. It introduces two problems:

  • You could write an extractVersion which is intended to be used with transformVersion, but no transformVersion exists
  • You could write a transformVersion with a missing extractVersion

Also in both cases you could have a mismatch of groups in transformVersion vs extractVersion, but it's much easier to validate when they're in the same config option versus separate.

Good design would be one where it's hard to get it wrong like that

@renovatebot renovatebot locked and limited conversation to collaborators Mar 7, 2025
@rarkins rarkins converted this issue into discussion #34671 Mar 7, 2025

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others
Projects
None yet
Development

No branches or pull requests

3 participants