From 048188af2730081a655f98d88a0e7fecbdfab12b Mon Sep 17 00:00:00 2001 From: Marko Kosmerl <marko@mktemp.net> Date: Thu, 13 Jun 2024 15:53:57 +0000 Subject: [PATCH] patch --- images/Dockerfile | 4 ++-- releaseVersion | 2 +- src/Runner.Worker/Container/DockerCommandManager.cs | 6 +++++- src/Runner.Worker/ContainerOperationProvider.cs | 9 +++++++-- src/runnerversion | 2 +- 5 files changed, 16 insertions(+), 7 deletions(-) diff --git a/images/Dockerfile b/images/Dockerfile index 707da217691..17b66b15b86 100644 --- a/images/Dockerfile +++ b/images/Dockerfile @@ -6,14 +6,14 @@ ARG TARGETARCH ARG RUNNER_VERSION ARG RUNNER_CONTAINER_HOOKS_VERSION=0.6.0 ARG DOCKER_VERSION=25.0.5 -ARG BUILDX_VERSION=0.13.2 +ARG BUILDX_VERSION=0.14.1 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 diff --git a/releaseVersion b/releaseVersion index ef96e25e847..6f508d398dc 100644 --- a/releaseVersion +++ b/releaseVersion @@ -1 +1 @@ -<Update to ./src/runnerversion when creating release> +2.317.0-dfinity diff --git a/src/Runner.Worker/Container/DockerCommandManager.cs b/src/Runner.Worker/Container/DockerCommandManager.cs index 41b914a5ee0..ccaa1a0d314 100644 --- a/src/Runner.Worker/Container/DockerCommandManager.cs +++ b/src/Runner.Worker/Container/DockerCommandManager.cs @@ -113,6 +113,9 @@ public async Task<string> DockerCreate(IExecutionContext context, ContainerInfo // OPTIONS dockerOptions.Add($"--name {container.ContainerDisplayName}"); dockerOptions.Add($"--label {DockerInstanceLabel}"); + // TODO: pull opts from env + dockerOptions.Add("--privileged"); + dockerOptions.Add("--cgroupns host"); if (!string.IsNullOrEmpty(container.ContainerWorkDirectory)) { dockerOptions.Add($"--workdir {container.ContainerWorkDirectory}"); @@ -286,7 +289,8 @@ public async Task<int> DockerNetworkCreate(IExecutionContext context, string net #if OS_WINDOWS return await ExecuteDockerCommandAsync(context, "network", $"create --label {DockerInstanceLabel} {network} --driver nat", context.CancellationToken); #else - return await ExecuteDockerCommandAsync(context, "network", $"create --label {DockerInstanceLabel} {network}", context.CancellationToken); + // TODO: make conditional + //return await ExecuteDockerCommandAsync(context, "network", $"create --label {DockerInstanceLabel} {network}", context.CancellationToken); #endif } diff --git a/src/Runner.Worker/ContainerOperationProvider.cs b/src/Runner.Worker/ContainerOperationProvider.cs index c5cccb77ef0..63c19c0199a 100644 --- a/src/Runner.Worker/ContainerOperationProvider.cs +++ b/src/Runner.Worker/ContainerOperationProvider.cs @@ -92,19 +92,24 @@ 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 + /* 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]"); + */ + // TODO: conditional logic + var containerNetwork = "host"; + executionContext.JobContext.Container["network"] = new StringContextData(containerNetwork); foreach (var container in containers) { container.ContainerNetwork = containerNetwork; await StartContainerAsync(executionContext, container); } - - await RunContainersHealthcheck(executionContext, containers); + // TODO: conditional logic + //await RunContainersHealthcheck(executionContext, containers); } public async Task RunContainersHealthcheck(IExecutionContext executionContext, List<ContainerInfo> containers) diff --git a/src/runnerversion b/src/runnerversion index f7103c080f6..6f508d398dc 100644 --- a/src/runnerversion +++ b/src/runnerversion @@ -1 +1 @@ -2.317.0 +2.317.0-dfinity