Merged
Conversation
lbussell
reviewed
Jul 19, 2024
Comment on lines
48
to
49
| Parallel.ForEach(eolAnnotations.EolDigests, digestData => | ||
| { |
Member
There was a problem hiding this comment.
You can use expression body without the curly braces here.
lbussell
approved these changes
Jul 19, 2024
| if (!eolDigests.IsEmpty) | ||
| { | ||
| _loggerService.WriteMessage(message); | ||
| _loggerService.WriteMessage(""); |
Member
There was a problem hiding this comment.
Suggested change
| _loggerService.WriteMessage(""); | |
| _loggerService.WriteMessage(); |
| _loggerService.WriteMessage(""); | ||
| _loggerService.WriteMessage(JsonConvert.SerializeObject(new EolAnnotationsData(eolDigests: [.. _failedAnnotations]))); | ||
| _loggerService.WriteMessage(JsonConvert.SerializeObject(new EolAnnotationsData(eolDigests: [.. eolDigests]))); | ||
| _loggerService.WriteMessage(""); |
Member
There was a problem hiding this comment.
Suggested change
| _loggerService.WriteMessage(""); | |
| _loggerService.WriteMessage(); |
| public interface IOrasService | ||
| { | ||
| bool IsDigestAnnotatedForEol(string digest, ILoggerService loggerService, bool isDryRun); | ||
| bool IsDigestAnnotatedForEol(string digest, ILoggerService loggerService, bool isDryRun, [MaybeNullWhen(false)] out OciManifest lifecycleArtifactManifest); |
Member
There was a problem hiding this comment.
Suggested change
| bool IsDigestAnnotatedForEol(string digest, ILoggerService loggerService, bool isDryRun, [MaybeNullWhen(false)] out OciManifest lifecycleArtifactManifest); | |
| bool IsDigestAnnotatedForEol(string digest, ILoggerService loggerService, bool isDryRun, [NotNullWhen(true)] out OciManifest? lifecycleArtifactManifest); |
Member
Author
There was a problem hiding this comment.
This is correct as it is. It's modeled after the Dictionary.TryGetValue method.
19 tasks
lbussell
approved these changes
Jul 23, 2024
| private readonly ConcurrentBag<string> _existingAnnotationDigests = []; | ||
|
|
||
| private ConcurrentBag<EolDigestData> _failedAnnotations = new (); | ||
| private static readonly JsonSerializerOptions _jsonSerializerOptions = new() |
Member
There was a problem hiding this comment.
Suggested change
| private static readonly JsonSerializerOptions _jsonSerializerOptions = new() | |
| private static readonly JsonSerializerOptions s_jsonSerializerOptions = new() |
Comment on lines
9
to
13
| internal class BulkDeletionDescription | ||
| { | ||
| public string RegistryType { get; set; } = "public"; | ||
| public List<string> Digests { get; set;} = []; | ||
| } |
Member
There was a problem hiding this comment.
Suggested change
| internal class BulkDeletionDescription | |
| { | |
| public string RegistryType { get; set; } = "public"; | |
| public List<string> Digests { get; set;} = []; | |
| } | |
| internal record BulkDeletionDescription | |
| { | |
| public string RegistryType { get; init; } = "public"; | |
| public List<string> Digests { get; init; } = []; | |
| } |
lbussell
approved these changes
Jul 24, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
annotateEolDigestscommand provides a--forceoption that will always create an EOL annotation even if one already exists. This was intended to handle scenarios where we essentially want to overwrite an incorrectly defined annotation. However, this causes multiple such annotations to exist in the registry. We don't want obsolete annotations to continue to be around.The correct thing to do here is to delete the existing annotation before pushing the new one. But it's not as simple as just applying those operations to the manifests in the ACR. That gets applied to the ACR, but the deletion does not propagate to MAR. So if you did that, you'd effectively still be left with multiple annotations in MAR. Deletions in MAR need to be done through a separate workflow that is not automated.
So there isn't a way to fully automate this scenario. For that reason, the command is being modified here to do away with the
--forceoption entirely. In addition, it will report on image digests which have existing annotations. There is logic to check whether the existing annotation already matches the EOL date to be set. If so, it simply skips the annotation. If it differs, it will be skipped but logged as an error as it will need to be addressed through the manual steps described above.