Skip to content

Commit a81b916

Browse files
committed
enforce OCI format for inner images when publishing tarballs or to local docker instances
1 parent 3ce3b34 commit a81b916

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/Containers/packaging/build/Microsoft.NET.Build.Containers.targets

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,10 +304,16 @@
304304
<!--We don't want to skip publishing individual images in case of local daemon podman because podman loads multi-arch tarball differently - only individual image for the current platform.-->
305305
<_SkipContainerPublishing>false</_SkipContainerPublishing>
306306
<_SkipContainerPublishing Condition="$(ContainerArchiveOutputPath) != '' or ( $(ContainerRegistry) == '' and ( $(LocalRegistry) == '' or $(LocalRegistry) == 'Docker' ) )">true</_SkipContainerPublishing>
307-
307+
308308
<!--We want to skip CreateImageIndex task in case of local daemon podman because it is not supported.-->
309309
<_SkipCreateImageIndex>false</_SkipCreateImageIndex>
310310
<_SkipCreateImageIndex Condition="$(ContainerArchiveOutputPath) == '' and $(ContainerRegistry) == '' and $(LocalRegistry) == 'Podman'">true</_SkipCreateImageIndex>
311+
312+
<!-- Figure out what format the inner images should be coerced to -->
313+
<!-- If a user had an opinion, use that -->
314+
<_SingleImageContainerFormat Condition="'$(ContainerImageFormat)' != ''">$(ContainerImageFormat)</_SingleImageContainerFormat>
315+
<!-- If we are publishing to local tarball or to local Docker, force OCI to prevent mismatches between inner images and the outer manifest -->
316+
<_SingleImageContainerFormat Condition="$(_SkipContainerPublishing) == 'true' ">OCI</_SingleImageContainerFormat>
311317
</PropertyGroup>
312318

313319
<ItemGroup>
@@ -337,7 +343,8 @@
337343
ContainerUser=$(ContainerUser);
338344
ContainerGenerateLabels=$(ContainerGenerateLabels);
339345
ContainerGenerateLabelsImageBaseDigest=$(ContainerGenerateLabelsImageBaseDigest);
340-
_SkipContainerPublishing=$(_SkipContainerPublishing)
346+
_SkipContainerPublishing=$(_SkipContainerPublishing);
347+
ContainerImageFormat=$(_SingleImageContainerFormat)
341348
"/>
342349
<_rids Remove ="$(_rids)" />
343350
</ItemGroup>

0 commit comments

Comments
 (0)