mirror of
https://github.com/actions/runner.git
synced 2025-12-11 04:46:58 +00:00
Added ability to run Dockerfile.SUFFIX ContainerAction (#1738)
* Added ability to run Dockerfile.SUFFIX ContainerAction * Extracted IsDockerFile method * reformatted, moved from index to Last() * extracted IsDockerfile to DockerUtil with L0 * added check for IsDockerfile to account for docker:// * updated test to clearly show path/dockerfile:tag * fail if Data.Image is not Dockerfile or docker://[image]
This commit is contained in:
@@ -44,9 +44,8 @@ namespace GitHub.Runner.Worker.Handlers
|
||||
{
|
||||
Data.Image = Data.Image.Substring("docker://".Length);
|
||||
}
|
||||
else if (Data.Image.EndsWith("Dockerfile") || Data.Image.EndsWith("dockerfile"))
|
||||
else if (DockerUtil.IsDockerfile(Data.Image))
|
||||
{
|
||||
// ensure docker file exist
|
||||
var dockerFile = Path.Combine(ActionDirectory, Data.Image);
|
||||
ArgUtil.File(dockerFile, nameof(Data.Image));
|
||||
|
||||
@@ -68,6 +67,10 @@ namespace GitHub.Runner.Worker.Handlers
|
||||
|
||||
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.
|
||||
|
||||
Reference in New Issue
Block a user