Skip to content

Commit

Permalink
291.1 release notes (#1860)
Browse files Browse the repository at this point in the history
* Revert "Added ability to run Dockerfile.SUFFIX ContainerAction (#1738)"

20b7e86

* 291.1 release notes
  • Loading branch information
thboop authored Apr 29, 2022
1 parent dac4363 commit 496ec0d
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 64 deletions.
1 change: 0 additions & 1 deletion releaseNote.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
## Features
- Relaxed naming requirements for dockerfiles (e.g. `Dockerfile.test` can now be built) (#1738)

## Bugs
- Fixed a bug where windows path separators were used in generated folders (#1617)
Expand Down
2 changes: 1 addition & 1 deletion releaseVersion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.291.0
2.291.1
2 changes: 1 addition & 1 deletion src/Runner.Worker/ActionManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1004,7 +1004,7 @@ private ActionSetupInfo PrepareRepositoryActionAsync(IExecutionContext execution
if (actionDefinitionData.Execution.ExecutionType == ActionExecutionType.Container)
{
var containerAction = actionDefinitionData.Execution as ContainerActionExecutionData;
if (DockerUtil.IsDockerfile(containerAction.Image))
if (containerAction.Image.EndsWith("Dockerfile") || containerAction.Image.EndsWith("dockerfile"))
{
var dockerFileFullPath = Path.Combine(actionEntryDirectory, containerAction.Image);
executionContext.Debug($"Dockerfile for action: '{dockerFileFullPath}'.");
Expand Down
13 changes: 1 addition & 12 deletions src/Runner.Worker/Container/DockerUtil.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;

namespace GitHub.Runner.Worker.Container
Expand All @@ -18,7 +17,7 @@ public static List<PortMapping> ParseDockerPort(IList<string> portMappingLines)
string pattern = $"^(?<{targetPort}>\\d+)/(?<{proto}>\\w+) -> (?<{host}>.+):(?<{hostPort}>\\d+)$";

List<PortMapping> portMappings = new List<PortMapping>();
foreach (var line in portMappingLines)
foreach(var line in portMappingLines)
{
Match m = Regex.Match(line, pattern, RegexOptions.None, TimeSpan.FromSeconds(1));
if (m.Success)
Expand Down Expand Up @@ -62,15 +61,5 @@ public static string ParseRegistryHostnameFromImageName(string name)
}
return "";
}

public static bool IsDockerfile(string image)
{
if (image.StartsWith("docker://", StringComparison.OrdinalIgnoreCase))
{
return false;
}
var imageWithoutPath = image.Split('/').Last();
return imageWithoutPath.StartsWith("Dockerfile.") || imageWithoutPath.StartsWith("dockerfile.") || imageWithoutPath.EndsWith("Dockerfile") || imageWithoutPath.EndsWith("dockerfile");
}
}
}
7 changes: 2 additions & 5 deletions src/Runner.Worker/Handlers/ContainerActionHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ public async Task RunAsync(ActionRunStage stage)
{
Data.Image = Data.Image.Substring("docker://".Length);
}
else if (DockerUtil.IsDockerfile(Data.Image))
else if (Data.Image.EndsWith("Dockerfile") || Data.Image.EndsWith("dockerfile"))
{
// ensure docker file exist
var dockerFile = Path.Combine(ActionDirectory, Data.Image);
ArgUtil.File(dockerFile, nameof(Data.Image));

Expand All @@ -67,10 +68,6 @@ public async Task RunAsync(ActionRunStage stage)

Data.Image = imageName;
}
else
{
throw new InvalidOperationException($"'{Data.Image}' should be either '[path]/Dockerfile' or 'docker://image[:tag]'.");
}

string type = Action.Type == Pipelines.ActionSourceType.Repository ? "Dockerfile" : "DockerHub";
// Set extra telemetry base on the current context.
Expand Down
43 changes: 0 additions & 43 deletions src/Test/L0/Container/DockerUtilL0.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,48 +144,5 @@ public void ParseRegistryHostnameFromImageName(string input, string expected)
var actual = DockerUtil.ParseRegistryHostnameFromImageName(input);
Assert.Equal(expected, actual);
}

[Theory]
[Trait("Level", "L0")]
[Trait("Category", "Worker")]
[InlineData("dockerhub/repo", false)]
[InlineData("debian:latest", false)]
[InlineData("something/dockerfileimage", false)]
[InlineData("ghcr.io/docker/dockerfile", true)] // should be false but might break the current workflows
[InlineData("Dockerfile", true)]
[InlineData("Dockerfile.", true)]
[InlineData(".Dockerfile", true)]
[InlineData(".Dockerfile.", false)]
[InlineData("dockerfile", true)]
[InlineData("dockerfile.", true)]
[InlineData(".dockerfile", true)]
[InlineData(".dockerfile.", false)]
[InlineData("Dockerfile.test", true)]
[InlineData("test.Dockerfile", true)]
[InlineData("docker/dockerfile:latest", false)]
[InlineData("/some/path/dockerfile:latest", false)]
[InlineData("dockerfile:latest", false)]
[InlineData("Dockerfile:latest", false)]
[InlineData("dockerfile-latest", false)]
[InlineData("Dockerfile-latest", false)]
[InlineData("dockerfile.latest", true)]
[InlineData("Dockerfile.latest", true)]
[InlineData("../dockerfile/dockerfileone", false)]
[InlineData("../Dockerfile/dockerfileone", false)]
[InlineData("../dockerfile.test", true)]
[InlineData("../Dockerfile.test", true)]
[InlineData("./dockerfile/image", false)]
[InlineData("./Dockerfile/image", false)]
[InlineData("example/Dockerfile.test", true)]
[InlineData("./example/Dockerfile.test", true)]
[InlineData("example/test.dockerfile", true)]
[InlineData("./example/test.dockerfile", true)]
[InlineData("docker://Dockerfile", false)]
[InlineData("docker://ubuntu:latest", false)]
public void IsDockerfile(string input, bool expected)
{
var actual = DockerUtil.IsDockerfile(input);
Assert.Equal(expected, actual);
}
}
}
2 changes: 1 addition & 1 deletion src/runnerversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.291.0
2.291.1

0 comments on commit 496ec0d

Please sign in to comment.