Skip to content

Move manifest list creation to Post_Build, copy via ACR import#2030

Draft
lbussell wants to merge 1 commit intodotnet:mainfrom
lbussell:move-manifest-lists-src
Draft

Move manifest list creation to Post_Build, copy via ACR import#2030
lbussell wants to merge 1 commit intodotnet:mainfrom
lbussell:move-manifest-lists-src

Conversation

@lbussell
Copy link
Member

This PR makes the following changes:

  • Add CreateManifestListCommand that is inteded to run in Post_Build after mergeImageInfo to create Docker manifest lists, push them to the staging registry, and record their digests in image-info.json. This enables manifest list signing by ensuring digests are present before the Sign stage.
  • Extend CopyAcrImagesCommand to copy manifest list shared tags alongside platform tags via ACR import.
  • Extract ManifestListHelper from PublishManifestCommand, essentially unchanged. It determines which manifest lists to create based on which platforms were actually built, preventing manifest lists from referencing unbuilt images.
  • Remove PublishManifestCommand - no longer needed. The Publish stage will now only copy images/manifest lists.

Fixes: #2002

The move-manifest-list-pipelines branch is companion to this one, and contains the pipeline changes necessary for these changes.

I validated these changes internally using the imagebuilder unofficial pipeline (build#2928726), and confirmed that manifest lists were signed (with test signatures) in the staging (test) ACR and that the signatures were copied across to the prod (test) ACR.

Add createManifestList command that runs in Post_Build after mergeImageInfo
to create Docker manifest lists, push them, and record their digests in
image-info.json. This enables manifest list signing by ensuring digests
are present before the Sign stage.

Extract ManifestListHelper to determine which manifest lists to create
based on which platforms were actually built, preventing manifest lists
from referencing unbuilt images.

Extend CopyAcrImagesCommand to copy manifest list shared tags alongside
platform tags via ACR import, making Publish a pure copy stage.

Remove PublishManifestCommand - no longer needed.

Fixes: dotnet#2002

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Moves Docker manifest list creation earlier in the pipeline (Post_Build) so manifest list digests are available in image-info.json before the Sign stage, and updates publish copying to include those manifest lists via ACR import.

Changes:

  • Add CreateManifestListCommand (Post_Build) to create/push manifest lists and write their digests into image-info.json.
  • Extend CopyAcrImagesCommand to also import/copy manifest list shared tags (including syndicated tags).
  • Extract manifest list selection logic into ManifestListHelper and remove PublishManifestCommand (and its options/tests).

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/ImageBuilder/ManifestListHelper.cs New helper to compute which manifest lists to create based on built/changed platforms.
src/ImageBuilder/ImageBuilder.cs Registers CreateManifestListCommand and removes PublishManifestCommand from DI.
src/ImageBuilder/Commands/PublishManifestOptions.cs Removed (no longer needed after moving manifest list creation).
src/ImageBuilder/Commands/PublishManifestCommand.cs Removed (publish stage no longer creates manifests).
src/ImageBuilder/Commands/CreateManifestListOptions.cs New CLI options for the Post_Build manifest list creation command.
src/ImageBuilder/Commands/CreateManifestListCommand.cs New command to create/push manifest lists and persist digests to image-info.json.
src/ImageBuilder/Commands/CopyAcrImagesCommand.cs Adds ACR import of manifest list tags in addition to platform tags.
src/ImageBuilder.Tests/PublishManifestCommandTests.cs Removed tests for the deleted command.
src/ImageBuilder.Tests/ManifestListHelperTests.cs New unit tests for manifest list selection logic.
src/ImageBuilder.Tests/CreateManifestListCommandTests.cs New unit tests for manifest list creation + digest recording.
src/ImageBuilder.Tests/CopyAcrImagesCommandTests.cs Adds coverage for copying manifest list tags (including syndicated tags).

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +175 to +178
destinationTag = TagInfo.GetFullyQualifiedName(
$"{Manifest.Registry}/{Options.RepoPrefix}{tagInfo.SyndicatedRepo}",
syndicatedDestinationTagName);
yield return (sourceTag, destinationTag);
{
return tags
.Select(tag => BuildManifestListInfo(repo, image, imageArtifactDetails, tag, getImageName, getTagRepresentative))
.Where(manifestListInfo => manifestListInfo is not null)!;
Comment on lines +95 to +108
IEnumerable<ImageData> images = imageArtifactDetails.Repos
.SelectMany(repo => repo.Images)
.Where(image => image.Manifest != null);

foreach (ImageData image in images)
{
image.Manifest.Created = createdDate;

TagInfo sharedTag = image.ManifestImage.SharedTags.First();

image.Manifest.Digest = DockerHelper.GetDigestString(
image.ManifestRepo.FullModelName,
await _manifestService.Value.GetManifestDigestShaAsync(
sharedTag.FullyQualifiedName, Options.IsDryRun));
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Microsoft.DotNet.ImageBuilder.Commands;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Move manifest list creation from publish stage to post-build stage

2 participants