Skip to content
Open
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
8 changes: 8 additions & 0 deletions src/Runner.Worker/ContainerOperationProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,14 @@ private async Task StartContainerAsync(IExecutionContext executionContext, Conta
var configEnvFormat = "--format \"{{range .Config.Env}}{{println .}}{{end}}\"";
var containerEnv = await _dockerManager.DockerInspect(executionContext, container.ContainerId, configEnvFormat);
container.ContainerRuntimePath = DockerUtil.ParsePathFromConfigEnv(containerEnv);
if (string.IsNullOrEmpty(container.ContainerRuntimePath) && Constants.Runner.Platform == Constants.OSPlatform.Windows)
{
// Windows images usually don't declare PATH in .Config.Env, so read the container's
// real PATH; otherwise a GITHUB_PATH write clobbers it via `docker exec -e PATH=`.
var runtimePath = new List<string>();
await _dockerManager.DockerExec(executionContext, container.ContainerId, string.Empty, "cmd /c echo %PATH%", runtimePath);
container.ContainerRuntimePath = string.Join("", runtimePath).Trim();
}
executionContext.JobContext.Container["id"] = new StringContextData(container.ContainerId);
}
executionContext.Output("##[endgroup]");
Expand Down
2 changes: 1 addition & 1 deletion src/Runner.Worker/Handlers/StepHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ await containerHookManager.RunScriptStepAsync(context,
if (!string.IsNullOrEmpty(PrependPath))
{
// Prepend tool paths to container's PATH
var fullPath = !string.IsNullOrEmpty(Container.ContainerRuntimePath) ? $"{PrependPath}:{Container.ContainerRuntimePath}" : PrependPath;
var fullPath = !string.IsNullOrEmpty(Container.ContainerRuntimePath) ? $"{PrependPath}{System.IO.Path.PathSeparator}{Container.ContainerRuntimePath}" : PrependPath;
dockerCommandArgs.Add($"-e PATH=\"{fullPath}\"");
}

Expand Down