8000 Delete product version EOL handling by mthalman · Pull Request #1590 · dotnet/docker-tools · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Delete product version EOL handling #1590

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

Merged
merged 2 commits into from
Feb 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ namespace Microsoft.DotNet.ImageBuilder.Commands;
[Export(typeof(ICommand))]
public class GenerateEolAnnotationDataCommand : Command<GenerateEolAnnotationDataOptions, GenerateEolAnnotationDataOptionsBuilder>
{
private readonly IDotNetReleasesService _dotNetReleasesService;
private readonly ILoggerService _loggerService;
private readonly IContainerRegistryClientFactory _acrClientFactory;
private readonly IContainerRegistryContentClientFactory _acrContentClientFactory;
Expand All @@ -32,15 +31,13 @@ public class GenerateEolAnnotationDataCommand : Command<GenerateEolAnnotationDat

[ImportingConstructor]
public GenerateEolAnnotationDataCommand(
IDotNetReleasesService dotNetReleasesService,
ILoggerService loggerService,
IContainerRegistryClientFactory acrClientFactory,
IContainerRegistryContentClientFactory acrContentClientFactory,
IAzureTokenCredentialProvider tokenCredentialProvider,
IRegistryCredentialsProvider registryCredentialsProvider,
ILifecycleMetadataService lifecycleMetadataService)
{
_dotNetReleasesService = dotNetReleasesService ?? throw new ArgumentNullException(nameof(dotNetReleasesService));
_loggerService = loggerService ?? throw new ArgumentNullException(nameof(loggerService));
_acrClientFactory = acrClientFactory ?? throw new ArgumentNullException(nameof(acrClientFactory));
_acrContentClientFactory = acrContentClientFactory ?? throw new ArgumentNullException(nameof(acrContentClientFactory));
Expand Down Expand Up @@ -74,8 +71,6 @@ private void WriteDigestDataJson(List<EolDigestData> digestsToAnnotate)

private async Task<List<EolDigestData>> GetDigestsToAnnotate()
{
Dictionary<string, DateOnly> productEolDates = await _dotNetReleasesService.GetProductEolDatesFromReleasesJson();

if (!File.Exists(Options.OldImageInfoPath) && !File.Exists(Options.NewImageInfoPath))
{
_loggerService.WriteMessage("No digests to annotate because no image info files were provided.");
Expand Down Expand Up @@ -124,20 +119,6 @@ private async Task<List<EolDigestData>> GetDigestsToAnnotate()
});

digestDataList.AddRange(digetsToAnnotate);

if (Options.AnnotateEolProducts)
{
// Annotate images for EOL products in new image info
// Only do so for those digests that actually exist in the registry (they may have been cleaned up
// because they are EOL).
IEnumerable<EolDigestData> eolDigests =
newImageArtifactDetails.Repos
.SelectMany(repo =>
repo.Images
.SelectMany(image => GetProductEolDigests(image, productEolDates)))
.Where(digestData => registryTagsByDigest.ContainsKey(digestData.Digest));
digestDataList.AddRange(eolDigests);
}
}
catch (Exception e)
{
Expand Down Expand Up @@ -206,31 +187,4 @@ private static IEnumerable<EolDigestData> GetUnsupportedDigests(

return digests.ToDictionary(val => val.Digest, val => val.Tag);
}

private IEnumerable<EolDigestData> GetProductEolDigests(ImageData image, Dictionary<string, DateOnly> productEolDates)
{
if (image.ProductVersion == null)
{
return [];
}

// Check if the version has a pre-release label. If so, it's not EOL by definition.
if (image.ProductVersion.Contains("-"))
{
return [];
}

string dotnetVersion = Version.Parse(image.ProductVersion).ToString(2);
if (!productEolDates.TryGetValue(dotnetVersion, out DateOnly date))
{
return [];
}

return image.GetAllImageDigestInfos().Select(val =>
new EolDigestData(val.Digest)
{
Tag = GetLongestTag(val.Tags),
EolDate = date
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

using System.Collections.Generic;
using System.CommandLine;
using static Microsoft.DotNet.ImageBuilder.Commands.CliHelper;

#nullable enable
namespace Microsoft.DotNet.ImageBuilder.Commands;
Expand All @@ -17,7 +16,6 @@ public class GenerateEolAnnotationDataOptions : Options
public string EolDigestsListPath { get; set; } = string.Empty;
public string OldImageInfoPath { get; set; } = string.Empty;
public string NewImageInfoPath { get; set; } = string.Empty;
public bool AnnotateEolProducts { get; set; }
}

public class GenerateEolAnnotationDataOptionsBuilder : CliOptionsBuilder
Expand All @@ -29,8 +27,6 @@ public override IEnumerable<Option> GetCliOptions() =>
[
..base.GetCliOptions(),
.._registryCredentialsOptionsBuilder.GetCliOptions(),
CreateOption<bool>("annotate-eol-products", nameof(GenerateEolAnnotationDataOptions.AnnotateEolProducts),
"Annotate images of EOL products")
];

public override IEnumerable<Argument> GetCliArguments() =>
Expand Down
35 changes: 0 additions & 35 deletions src/Microsoft.DotNet.ImageBuilder/src/DotNetReleasesService.cs

This file was deleted.

17 changes: 0 additions & 17 deletions src/Microsoft.DotNet.ImageBuilder/src/IDotNetReleasesService.cs

This file was deleted.

Loading
Loading
0