Skip to content
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

ImageBuilder cannot generate MCR Tags Metadata for two images built with the same Dockerfile but different tags #1198

Closed
lbussell opened this issue Nov 22, 2023 · 2 comments

Comments

@lbussell
Copy link
Contributor

While implementing dotnet/dotnet-docker#5021, I tried to re-use the existing jammy-chiseled runtime and aspnet Dockerfiles but add an argument for specifying the variant of the base image, since there should be no difference to the Dockerfile content. Generating readmes fails for this scenario, I believe because of this code:

// Find all other doc infos that match this one. This accounts for scenarios where a platform is
// duplicated in another image in order to associate it within a distinct set of shared tags.
IEnumerable<ImageDocumentationInfo> matchingDocInfos = _imageDocInfos
.Where(docInfo => docInfo.Platform != info.Platform &&
PlatformInfo.AreMatchingPlatforms(docInfo.Image, docInfo.Platform, info.Image, info.Platform))
.Prepend(info)
.ToArray();
foreach (ImageDocumentationInfo docInfo in matchingDocInfos)
{
_imageDocInfos.Remove(docInfo);
}

Which would see that the platforms are matching and remove the matching doc info. This means when we add the McrTagsMetadata for the new tags, the new tags are ignored and thus readme generation fails.

I validated that changing the source Dockerfile fixes this.

Actual behavior

GENERATING MCR TAGS METADATA
----------------------------
Unhandled exception: System.InvalidOperationException: A value was not found for the variable '$(McrTagsYmlTagGroup:8.0-jammy-chiseled-extra-amd64)'
   at Microsoft.DotNet.ImageBuilder.ViewModel.VariableHelper.SubstituteValues(String expression, Func`3 getContextBasedSystemValue) in /image-builder/src/ViewModel/VariableHelper.cs:line 95
   at Microsoft.DotNet.ImageBuilder.McrTagsMetadataGenerator.Execute() in /image-builder/src/McrTagsMetadataGenerator.cs:line 57
   at Microsoft.DotNet.ImageBuilder.McrTagsMetadataGenerator.Execute(IGitService gitService, ManifestInfo manifest, RepoInfo repo, String sourceRepoUrl, String sourceBranch) in /image-builder/src/McrTagsMetadataGenerator.cs:line 29     
   at Microsoft.DotNet.ImageBuilder.Commands.GenerateReadmesCommand.UpdateTagsListing(String readme, RepoInfo repo) in /image-builder/src/Commands/GenerateReadmesCommand.cs:line 112
   at Microsoft.DotNet.ImageBuilder.Commands.GenerateReadmesCommand.<ExecuteAsync>b__6_8(String readmeContent, ValueTuple`2 context) in /image-builder/src/Commands/GenerateReadmesCommand.cs:line 57
   at Microsoft.DotNet.ImageBuilder.Commands.GenerateArtifactsCommand`2.GenerateArtifactAsync[TContext](String templatePath, String artifactPath, TContext context, GetTemplateState`1 getState, String artifactName, Func`3 postProcess) in /image-builder/src/Commands/GenerateArtifactsCommand.cs:line 106
   at Microsoft.DotNet.ImageBuilder.Commands.GenerateArtifactsCommand`2.GenerateArtifactsAsync[TContext](IEnumerable`1 contexts, Func`2 getTemplatePath, Func`2 getArtifactPath, GetTemplateState`1 getState, String templatePropertyName, String artifactName, Func`3 postProcess) in /image-builder/src/Commands/GenerateArtifactsCommand.cs:line 85
...
Copy link

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

@lbussell lbussell changed the title ImageBuilder cannot generate MCR Tags Metadata for two images built with the same Dockerfile but different and tags ImageBuilder cannot generate MCR Tags Metadata for two images built with the same Dockerfile but different tags Nov 24, 2023
@lbussell
Copy link
Contributor Author

[Triage] This is an issue but it isn't blocking anything at the moment, so we won't fix it at this time.

@lbussell lbussell closed this as not planned Won't fix, can't repro, duplicate, stale Nov 30, 2023
@github-project-automation github-project-automation bot moved this from Backlog to Done in .NET Docker Nov 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

No branches or pull requests

1 participant