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

Fix for waiting on annotation ingestion #1375

Closed mthalman closed 1 month ago

mthalman commented 1 month ago

There's an issue with the logic that waits for an annotation to be ingested into MAR. The command ends up immediately returning success regardless of the current status of the ingestion.

The issue is with this line:

https://github.com/dotnet/docker-tools/blob/e133aec556c5ff364d7bb43ea46b0e8c8682c8af/src/Microsoft.DotNet.ImageBuilder/src/MarImageIngestionReporter.cs#L78

By definition, annotations do not have a tag associated with them. So RemainingTags is always empty. Because it's empty, it doesn't attempt to continuously query for the status until success or failure. So even when the status is "not started" or "processing", it simply stops processing and declares victory.

I've fixed this by introducing an IsComplete property that will be checked instead of RemainingTags. This will only get set when the status has reached success or failure. I've also added unit tests to validate this scenario.