Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dind-network-host-patch' into di…
Browse files Browse the repository at this point in the history
…nd-network-host-patch-v2.320.0
  • Loading branch information
basvandijk committed Nov 12, 2024
2 parents 78f2167 + ac9c335 commit 46b793a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion images/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ RUN apt update -y && apt install curl unzip -y
WORKDIR /actions-runner
RUN export RUNNER_ARCH=${TARGETARCH} \
&& if [ "$RUNNER_ARCH" = "amd64" ]; then export RUNNER_ARCH=x64 ; fi \
&& curl -f -L -o runner.tar.gz https://github.com/actions/runner/releases/download/v${RUNNER_VERSION}/actions-runner-${TARGETOS}-${RUNNER_ARCH}-${RUNNER_VERSION}.tar.gz \
&& curl -f -L -o runner.tar.gz https://github.com/dfinity/runner/releases/download/v${RUNNER_VERSION}/actions-runner-${TARGETOS}-${RUNNER_ARCH}-${RUNNER_VERSION}.tar.gz \
&& tar xzf ./runner.tar.gz \
&& rm runner.tar.gz

Expand Down
9 changes: 7 additions & 2 deletions src/Runner.Worker/ContainerOperationProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,16 @@ public async Task StartContainersAsync(IExecutionContext executionContext, objec

// Create local docker network for this job to avoid port conflict when multiple runners run on same machine.
// All containers within a job join the same network
/*
XXX: don't add network as we'll use --network host
executionContext.Output("##[group]Create local container network");
var containerNetwork = $"github_network_{Guid.NewGuid().ToString("N")}";
await CreateContainerNetworkAsync(executionContext, containerNetwork);
executionContext.JobContext.Container["network"] = new StringContextData(containerNetwork);
executionContext.Output("##[endgroup]");

*/
var containerNetwork = "host";
executionContext.JobContext.Container["network"] = new StringContextData(containerNetwork);
foreach (var container in containers)
{
container.ContainerNetwork = containerNetwork;
Expand Down Expand Up @@ -160,7 +164,8 @@ public async Task StopContainersAsync(IExecutionContext executionContext, object
await StopContainerAsync(executionContext, container);
}
// Remove the container network
await RemoveContainerNetworkAsync(executionContext, containers.First().ContainerNetwork);
// XXX: we're using --network host
//await RemoveContainerNetworkAsync(executionContext, containers.First().ContainerNetwork);
}

private async Task StartContainerAsync(IExecutionContext executionContext, ContainerInfo container)
Expand Down

0 comments on commit 46b793a

Please sign in to comment.