dotnet / docker-tools

This is a repo to house some common tools for our various docker repos.
MIT License
122 stars 46 forks source link

EOL annotation generation update to handle pre-release versions #1400

Closed mthalman closed 1 month ago

mthalman commented 1 month ago

When running GenerateEolAnnotationDataCommand on the dotnet-docker repo, it was getting an error due to the existence of 9.0-preview product versions in the image info file:

Error occurred while generating EOL annotation data: System.FormatException: The input string '0-preview' was not in a correct format.
   at System.Number.ThrowFormatException[TChar](ReadOnlySpan`1 value)
   at System.Version.ParseVersion(ReadOnlySpan`1 input, Boolean throwOnFailure)
   at System.Version.Parse(String input)
   at Microsoft.DotNet.ImageBuilder.Commands.GenerateEolAnnotationDataCommand.GetProductEolDigests(ImageData image, Dictionary`2 productEolDates) in /image-builder/src/Commands/GenerateEolAnnotationDataCommand.cs:line 192
   at Microsoft.DotNet.ImageBuilder.Commands.GenerateEolAnnotationDataCommand.GetDigestsToAnnotate() in /image-builder/src/Commands/GenerateEolAnnotationDataCommand.cs:line 109
Unhandled exception: System.FormatException: The input string '0-preview' was not in a correct format.
   at System.Number.ThrowFormatException[TChar](ReadOnlySpan`1 value)
   at System.Version.ParseVersion(ReadOnlySpan`1 input, Boolean throwOnFailure)
   at System.Version.Parse(String input)
   at Microsoft.DotNet.ImageBuilder.Commands.GenerateEolAnnotationDataCommand.GetProductEolDigests(ImageData image, Dictionary`2 productEolDates) in /image-builder/src/Commands/GenerateEolAnnotationDataCommand.cs:line 192

The Version parse logic doesn't handle pre-release labels. Added a simple check in the logic to account for those labels and return empty EOL data since, by definition, a pre-release won't be EOL.

dotnet-issue-labeler[bot] commented 1 month ago

I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label.

dotnet-issue-labeler[bot] commented 1 month ago

I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label.