From 6ce5c93cc815ea3a669e1470d6e3d4ffee9ceb45 Mon Sep 17 00:00:00 2001 From: sillyguodong Date: Tue, 6 Jun 2023 00:21:31 +0000 Subject: [PATCH] Put the job container name into the env context (#62) Related: https://gitea.com/gitea/act_runner/issues/189#issuecomment-740636 Refer to [Docker Doc](https://docs.docker.com/engine/reference/commandline/run/#volumes-from), the `--volumes-from` flag is used when running or creating a new container and takes the name or ID of the container from which you want to share volumes. Here's the syntax: ``` docker run --volumes-from ``` So put the job container name into the `env` context in this PR. Co-authored-by: Jason Song Reviewed-on: https://gitea.com/gitea/act/pulls/62 Reviewed-by: Jason Song Co-authored-by: sillyguodong Co-committed-by: sillyguodong --- pkg/runner/run_context.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/runner/run_context.go b/pkg/runner/run_context.go index 550173c..4a7e11e 100644 --- a/pkg/runner/run_context.go +++ b/pkg/runner/run_context.go @@ -263,6 +263,9 @@ func (rc *RunContext) startJobContainer() common.Executor { logger.Infof("\U0001f680 Start image=%s", image) name := rc.jobContainerName() + // For gitea, to support --volumes-from in options. + // We need to set the container name to the environment variable. + rc.Env["JOB_CONTAINER_NAME"] = name envList := make([]string, 0)