Skip to content

Commit

Permalink
Merge pull request #111 from mario-campos/main
Browse files Browse the repository at this point in the history
Use host's network stack, not container's.
  • Loading branch information
j-dunham committed May 4, 2023
2 parents b0f1635 + b758e76 commit 19083bc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/ActionsImporter.UnitTests/Services/DockerServiceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public async Task ExecuteCommandAsync_InvokesDocker_ReturnsTrue()
_processService.Setup(handler =>
handler.RunAsync(
"docker",
$"run --rm -t -v \"{Directory.GetCurrentDirectory()}\":/data {server}/{image}:{version} {string.Join(' ', arguments)}",
$"run --rm -t --network=host -v \"{Directory.GetCurrentDirectory()}\":/data {server}/{image}:{version} {string.Join(' ', arguments)}",
Directory.GetCurrentDirectory(),
new[] { new ValueTuple<string, string>("MSYS_NO_PATHCONV", "1") },
true
Expand Down Expand Up @@ -136,7 +136,7 @@ public async Task ExecuteCommandAsync_InvokesDocker_WithEnvironmentVariables_Ret
_processService.Setup(handler =>
handler.RunAsync(
"docker",
$"run --rm -t --env \"GITHUB_ACCESS_TOKEN=foo\" --env \"GITHUB_INSTANCE_URL=https://github.fabrikam.com\" --env \"JENKINS_ACCESS_TOKEN=bar\" -v \"{Directory.GetCurrentDirectory()}\":/data {server}/{image}:{version} {string.Join(' ', arguments)}",
$"run --rm -t --network=host --env \"GITHUB_ACCESS_TOKEN=foo\" --env \"GITHUB_INSTANCE_URL=https://github.fabrikam.com\" --env \"JENKINS_ACCESS_TOKEN=bar\" -v \"{Directory.GetCurrentDirectory()}\":/data {server}/{image}:{version} {string.Join(' ', arguments)}",
Directory.GetCurrentDirectory(),
new[] { new ValueTuple<string, string>("MSYS_NO_PATHCONV", "1") },
true
Expand Down Expand Up @@ -164,7 +164,7 @@ public async Task ExecuteCommandAsync_InvokesDocker_WithAdditionalDockerArgument
_processService.Setup(handler =>
handler.RunAsync(
"docker",
$"run --rm -t --network=host -v \"{Directory.GetCurrentDirectory()}\":/data {server}/{image}:{version} {string.Join(' ', arguments)}",
$"run --rm -t --network=host --network=host -v \"{Directory.GetCurrentDirectory()}\":/data {server}/{image}:{version} {string.Join(' ', arguments)}",
Directory.GetCurrentDirectory(),
new[] { new ValueTuple<string, string>("MSYS_NO_PATHCONV", "1") },
true
Expand Down Expand Up @@ -200,7 +200,7 @@ public async Task ExecuteCommandAsync_InvokesDocker_OnLinuxOS_ReturnsTrue()
_processService.Setup(handler =>
handler.RunAsync(
"docker",
$"run --rm -t -e USER_ID=50 -e GROUP_ID=100 -v \"{Directory.GetCurrentDirectory()}\":/data {server}/{image}:{version} {string.Join(' ', arguments)}",
$"run --rm -t --network=host -e USER_ID=50 -e GROUP_ID=100 -v \"{Directory.GetCurrentDirectory()}\":/data {server}/{image}:{version} {string.Join(' ', arguments)}",
Directory.GetCurrentDirectory(),
new[] { new ValueTuple<string, string>("MSYS_NO_PATHCONV", "1") },
true
Expand Down
2 changes: 1 addition & 1 deletion src/ActionsImporter/Services/DockerService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public async Task ExecuteCommandAsync(string image, string server, string versio
{
var actionsImporterArguments = new List<string>
{
"run --rm -t"
"run --rm -t --network=host"
};
actionsImporterArguments.AddRange(GetEnvironmentVariableArguments());

Expand Down

0 comments on commit 19083bc

Please sign in to comment.