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

Support tags passed into ParseContainerProperties #239

Merged
merged 1 commit into from
Nov 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Microsoft.NET.Build.Containers/ParseContainerProperties.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public override bool Execute()
Log.LogError(null, "CONTAINER003", "Container.InvalidTag", null, 0, 0, 0, 0, $"Invalid {nameof(ContainerImageTag)} provided: {{0}}. Image tags must be alphanumeric, underscore, hyphen, or period.", ContainerImageTag);
}
}
else if (ContainerImageTags.Length != 0 && !TryValidateTags(ContainerImageTags, out var valids, out var invalids))
else if (ContainerImageTags.Length != 0 && TryValidateTags(ContainerImageTags, out var valids, out var invalids))
{
validTags = valids;
if (invalids.Any())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ public void Baseline()
task.FullyQualifiedBaseImageName = "mcr.microsoft.com/dotnet/runtime:6.0";
task.ContainerRegistry = "localhost:5010";
task.ContainerImageName = "dotnet/testimage";
task.ContainerImageTags = new[] { "5.0" };
task.ContainerImageTags = new[] { "5.0", "latest" };

Assert.IsTrue(task.Execute());
Assert.AreEqual("mcr.microsoft.com", task.ParsedContainerRegistry);
Assert.AreEqual("dotnet/runtime", task.ParsedContainerImage);
Assert.AreEqual("6.0", task.ParsedContainerTag);

Assert.AreEqual("dotnet/testimage", task.NewContainerImageName);
new[] { "5.0" }.SequenceEqual(task.NewContainerTags);
CollectionAssert.AreEquivalent(new[] { "5.0", "latest" }, task.NewContainerTags);
}

[TestMethod]
Expand All @@ -42,7 +42,7 @@ public void BaseRegistriesWithNoSchemeGetHttps()

Assert.AreEqual("localhost:5010", task.NewContainerRegistry);
Assert.AreEqual("dotnet/testimage", task.NewContainerImageName);
new[] { "5.0" }.SequenceEqual(task.NewContainerTags);
CollectionAssert.AreEquivalent(new[] { "5.0" }, task.NewContainerTags);
}

[TestMethod]
Expand All @@ -61,7 +61,7 @@ public void UserRegistriesWithNoSchemeGetHttps()

Assert.AreEqual("localhost:5010", task.NewContainerRegistry);
Assert.AreEqual("dotnet/testimage", task.NewContainerImageName);
new[] { "5.0" }.SequenceEqual(task.NewContainerTags);
CollectionAssert.AreEquivalent(new[] { "5.0" }, task.NewContainerTags);
}

[TestMethod]
Expand All @@ -81,7 +81,7 @@ public void SpacesGetReplacedWithDashes()
Assert.AreEqual("6-0", task.ParsedContainerTag);

Assert.AreEqual("dotnet/testimage", task.NewContainerImageName);
new[] { "5.0" }.SequenceEqual(task.NewContainerTags);
CollectionAssert.AreEquivalent(new[] { "5.0" }, task.NewContainerTags);
}

[TestMethod]
Expand Down