Skip to content

Commit b0f0df8

Browse files
authored
[release/8.0.1xx] Use new ACR for registry image (#49691)
2 parents e586cf3 + f518095 commit b0f0df8

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/Tests/Microsoft.NET.Build.Containers.IntegrationTests/DockerRegistryManager.cs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,19 @@ public class DockerRegistryManager
2020
public const string FullyQualifiedBaseImageAspNet = $"{BaseImageSource}/{AspNetBaseImage}:{Net8PreviewImageTag}";
2121
private static string? s_registryContainerId;
2222

23+
private static string SDK_AzureContainerRegistryImage => "dotnetdhmirror-f8bzbjakh8cga6ab.azurecr.io/registry:2";
24+
private static string Docker_HubRegistryImage => "docker.io/library/registry:2";
25+
26+
// TODO: some logic to pivot between this and Docker Hub
27+
private static string RegistryImageToUse => SDK_AzureContainerRegistryImage;
28+
29+
2330
public static void StartAndPopulateDockerRegistry(ITestOutputHelper testOutput)
2431
{
2532
using TestLoggerFactory loggerFactory = new(testOutput);
2633

27-
if (!new DockerCli(loggerFactory).IsAvailable()) {
34+
if (!new DockerCli(loggerFactory).IsAvailable())
35+
{
2836
throw new InvalidOperationException("Docker is not available, tests cannot run");
2937
}
3038

@@ -40,7 +48,7 @@ public static void StartAndPopulateDockerRegistry(ITestOutputHelper testOutput)
4048
{
4149
logger.LogInformation("Spawning local registry at '{registry}', attempt #{attempt}.", LocalRegistry, spawnRegistryAttempt);
4250

43-
CommandResult processResult = ContainerCli.RunCommand(testOutput, "--rm", "--publish", "5010:5000", "--detach", "docker.io/library/registry:2").Execute();
51+
CommandResult processResult = ContainerCli.RunCommand(testOutput, "--rm", "--publish", "5010:5000", "--detach", RegistryImageToUse).Execute();
4452

4553
processResult.Should().Pass().And.HaveStdOut();
4654

@@ -59,7 +67,7 @@ public static void StartAndPopulateDockerRegistry(ITestOutputHelper testOutput)
5967
.Execute()
6068
.Should().Pass();
6169

62-
logger.LogInformation("Tagging image '{sourceRepo}/{sourceImage}:{sourceTag}' as '{targetRepo}/{targetImage}:{targetTag}'.",BaseImageSource, RuntimeBaseImage, tag, LocalRegistry, RuntimeBaseImage, tag);
70+
logger.LogInformation("Tagging image '{sourceRepo}/{sourceImage}:{sourceTag}' as '{targetRepo}/{targetImage}:{targetTag}'.", BaseImageSource, RuntimeBaseImage, tag, LocalRegistry, RuntimeBaseImage, tag);
6371
ContainerCli.TagCommand(testOutput, $"{BaseImageSource}/{RuntimeBaseImage}:{tag}", $"{LocalRegistry}/{RuntimeBaseImage}:{tag}")
6472
.Execute()
6573
.Should().Pass();
@@ -84,7 +92,7 @@ public static void StartAndPopulateDockerRegistry(ITestOutputHelper testOutput)
8492
{
8593
ContainerCli.StopCommand(testOutput, s_registryContainerId).Execute();
8694
}
87-
catch(Exception ex2)
95+
catch (Exception ex2)
8896
{
8997
logger.LogError(ex2, "Failed to stop the registry {id}.", s_registryContainerId);
9098
}

0 commit comments

Comments
 (0)