-
-
Notifications
You must be signed in to change notification settings - Fork 66
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
[Feature]: Enforce valid .NET version types in evergreen objects #717
Comments
OneDrive also does this: |
Arcrobat does leading zeros. |
A sample for the filter could look like this:
|
I'd say reporting back the unscrubbed number is best and then consumers could scrub themselves as you demonstrate if needed. |
Jim do you have to deal with this problem in production? If so, how are you handling it? |
I'd generally normalise the version number after getting it to do comparisons later, but the reason I say don't do it in evergreen is you never know what people have written, they may be parsing the number any unusual way on a per app basis when they are consuming the output of evergreen. It may be that someone at the ISV decides randomly to put the string 'release' in the version or do dot versions in 6 places. There are so many failure cases that you can't build a regex for, and they are totally out of the control of Evergreen itself. You could try type conversion, then build regex replacements something like the below in a catch block if it fails, maybe adding your regex too, but I'd say it will always have issues.
I'd say this would work mostly, but the issues raised on this repo would significantly increase when vendors just did weird shit with their versioning. Given the lack of control over the source data I'd just pass it through to the module user. Given it's not my decision, it's Aaron's, but that's what I'd do in his position. |
I would say that this is the direct result of unsanitized version numbers. At least that is my case. |
I'm hesitant to modify the version number output as it comes from the vendor too much. Below is an example of some of the version numbers - some of these could be fixed up, .e.g removing Some of the examples are obviously terrible version numbers - how do we determine how they should be modified?
|
We could take that
|
I do my own version sanitisation so that I can be in control of how it works and have the ability to quickly fix stuff when vendors do something unusual. Also because I get versions from multiple sources other than Evergreen. But it would definitely be of benefit to have something built in too. Rather than returning a string that can be cast as a version, how about returning a VersionObject property that has already been cast? BTW I also convert to a SQLVersion, which pads out each field to have up to 9 digits, which enables version sorting and comparison in SQL statements when these values are stored in a database. E.g. 1.2.3 becomes 100000000200000000300000000000000000. Not totally relevant to this topic, but just sharing an idea I had that solved a problem of mine! |
Get-EvergreenApp -Name "MicrosoftOneDrive" | Format-Version | Save-EvergreenApp ... would be perfect, sweet normalization. |
Aaron, probably a good idea to have the format function move the original vendor version to a new field in the object, in case it needed to be referenced for some reason. I imagine users will do filtering cmdlets after the format version step. Replacing the original version field seems like the way to go though, so the least amount of stuff needs to change. |
I figured this out, it maintains all sortability, and normalized to a 4 segment version number
|
I've added |
Examples: Convert a version number string and return the .NET Version class representation ConvertTo-DotNetVersionClass -Version "jdk-11.0.23+9" | fl
Major : 1070107
Minor : 11
Build : 0
Revision : 32
MajorRevision : 0
MinorRevision : 32 |
Convert a version number string which fails to convert to the .NET Version class representation, so return as a string: ConvertTo-DotNetVersionClass -Version "v22-build1"
WARNING: Failed to convert version string 'v22-build1' to a .NET Version class.
1185050.991806090049.0.0 |
Find the latest version of Get-EvergreenApp -Name AdoptiumTemurin22 | Where-Object { $_.ImageType -eq "jre" } | ConvertTo-DotNetVersionClass
Major Minor Build Revision
----- ----- ----- --------
22 0 2 9 |
Find the latest version of Get-EvergreenApp -Name AdoptiumTemurin22 | ForEach-Object {
[PSCustomObject]@{
Version = ConvertTo-DotNetVersionClass -Version $_.Version
ImageType = $_.ImageType
Architecture = $_.Architecture
URI = $_.URI
}
}
Version : 22.0.2.9
ImageType : jre
Architecture : x64
URI : https://github.com/adoptium/temurin22-binaries/releases/download/jdk-22.0.2%2B9/OpenJDK22U-jre_x64_windows_hotspot_22.0.2_9.msi
Version : 22.0.2.9
ImageType : jdk
Architecture : x64
URI : https://github.com/adoptium/temurin22-binaries/releases/download/jdk-22.0.2%2B9/OpenJDK22U-jdk_x64_windows_hotspot_22.0.2_9.msi |
What is your feature request?
It would be nice if Evergreen could filter scrub malformed version numbers that do not conform to the .NET version class.
Two examples in the list of Evergreen applications now are these:
X:\evergreen\stealthpuppyWindowsCustomisedDefaults\2406.01.173\x86 (the leading 0 in the minor version number is not permitted and should be cleaned up)
X:\evergreen\QGIS\latest\3.38.0-1 (non '.' separators are not permitted)
These types of issues cause problems for automation solutions that are leveraging the .NET version class for performing comparisons. I think extending that class on the developer side is a bridge too far, and the ideally the problem should be fixed at the supplier, but a compromise would be to have Evergreen filter and replace non conforming version numbers
Have you tested against the current version?
Have you reviewed the documentation?
The text was updated successfully, but these errors were encountered: