Skip to content

Commit f23d9fc

Browse files
committed
Fix second test problem by more carefully considering the order of single/multi rid checking
1 parent eb7b50a commit f23d9fc

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,19 @@
3434
<Target Name="ComputeContainerBaseImage"
3535
Returns="$(ContainerBaseImage)">
3636
<PropertyGroup>
37-
<ContainerRuntimeIdentifiers Condition="'$(BuildingInsideVisualStudio)' != 'true' and '$(ContainerRuntimeIdentifiers)' == '' and '$(IsRidAgnostic)' != 'true'">$(RuntimeIdentifiers)</ContainerRuntimeIdentifiers>
3837
<!-- The Container RID should default to the RID used for the entire build (to ensure things run on the platform they are built for), but the user knows best and so should be able to set it explicitly.
3938
For builds that have a RID, we default to that RID. Otherwise, we default to the Linux RID matching the architecture of the currently-executing SDK. -->
40-
<ContainerRuntimeIdentifier Condition="'$(ContainerRuntimeIdentifier)' == '' and '$(ContainerRuntimeIdentifiers)' == '' and '$(IsRidAgnostic)' != 'true'">$(RuntimeIdentifier)</ContainerRuntimeIdentifier>
39+
<ContainerRuntimeIdentifier Condition="'$(ContainerRuntimeIdentifier)' == '' and '$(RuntimeIdentifier)' != ''">$(RuntimeIdentifier)</ContainerRuntimeIdentifier>
4140
<ContainerRuntimeIdentifier Condition="'$(ContainerRuntimeIdentifier)' == '' and '$(ContainerRuntimeIdentifiers)' == ''">linux-$(NETCoreSdkPortableRuntimeIdentifier.Split('-')[1])</ContainerRuntimeIdentifier>
41+
<ContainerRuntimeIdentifiers Condition="'$(BuildingInsideVisualStudio)' != 'true' and '$(ContainerRuntimeIdentifiers)' == '' and '$(IsRidAgnostic)' != 'true'">$(RuntimeIdentifiers)</ContainerRuntimeIdentifiers>
4242

4343
<_ContainerIsUsingMicrosoftDefaultImages Condition="'$(ContainerBaseImage)' == ''">true</_ContainerIsUsingMicrosoftDefaultImages>
4444
<_ContainerIsUsingMicrosoftDefaultImages Condition="'$(ContainerBaseImage)' != ''">false</_ContainerIsUsingMicrosoftDefaultImages>
4545
</PropertyGroup>
4646

4747
<ItemGroup>
48-
<_TargetRuntimeIdentifiers Include="$(ContainerRuntimeIdentifiers)" Condition="'$(ContainerRuntimeIdentifiers)' != ''" />
49-
<_TargetRuntimeIdentifiers Include="$(ContainerRuntimeIdentifier)" Condition="'$(ContainerRuntimeIdentifiers)' == ''" />
48+
<_TargetRuntimeIdentifiers Include="$(ContainerRuntimeIdentifier)" Condition="'$(ContainerRuntimeIdentifier)' != ''" />
49+
<_TargetRuntimeIdentifiers Include="$(ContainerRuntimeIdentifiers)" Condition="@(_TargetRuntimeIdentifiers->Count()) == 0" />
5050
</ItemGroup>
5151

5252
<ComputeDotnetBaseImageAndTag

test/Microsoft.NET.Build.Containers.IntegrationTests/EndToEndTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -863,8 +863,8 @@ public void MultiArchStillAllowsSingleRIDUsingJustRIDProperties()
863863
// images were created locally for each RID
864864
// and image index was NOT created
865865
commandResult.Should().Pass()
866-
.And.HaveStdOutContaining(GetPublishArtifactsPath(newProjectDir.FullName, "linux-x64"))
867-
.And.NotHaveStdOutContaining(GetPublishArtifactsPath(newProjectDir.FullName, "linux-arm64"))
866+
.And.HaveStdOutContaining(GetPublishArtifactsPath(newProjectDir.FullName, "linux-x64", configuration: "Release"))
867+
.And.NotHaveStdOutContaining(GetPublishArtifactsPath(newProjectDir.FullName, "linux-arm64", configuration: "Release"))
868868
.And.HaveStdOutContaining($"Pushed image '{qualifiedImageName}' to local registry")
869869
.And.NotHaveStdOutContaining("Pushed image index");
870870

@@ -902,8 +902,8 @@ private DirectoryInfo CreateNewProject(string template, [CallerMemberName] strin
902902
return newProjectDir;
903903
}
904904

905-
private string GetPublishArtifactsPath(string projectDir, string rid)
906-
=> Path.Combine(projectDir, "bin", "Debug", ToolsetInfo.CurrentTargetFramework, rid, "publish");
905+
private string GetPublishArtifactsPath(string projectDir, string rid, string configuration = "Debug")
906+
=> Path.Combine(projectDir, "bin", configuration, ToolsetInfo.CurrentTargetFramework, rid, "publish");
907907

908908
[DockerIsAvailableAndSupportsArchFact("linux/arm64")]
909909
public void EndToEndMultiArch_ArchivePublishing()

0 commit comments

Comments
 (0)