From ebde5995ffd954bdbb747ca2a353f966788aa990 Mon Sep 17 00:00:00 2001 From: sillyguodong Date: Tue, 4 Jul 2023 14:32:41 +0800 Subject: [PATCH] fix --- go.mod | 3 ++- internal/app/run/runner.go | 2 +- internal/pkg/config/config.go | 20 ++++++++++---------- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/go.mod b/go.mod index 04d5e54..3d8340d 100644 --- a/go.mod +++ b/go.mod @@ -89,4 +89,5 @@ require ( gopkg.in/yaml.v2 v2.4.0 // indirect ) -replace github.com/nektos/act => gitea.com/gitea/act v0.246.2-0.20230703034344-3813f40cba18 +// replace github.com/nektos/act => gitea.com/gitea/act v0.246.2-0.20230703034344-3813f40cba18 +replace github.com/nektos/act => ../act diff --git a/internal/app/run/runner.go b/internal/app/run/runner.go index 224492e..abdb081 100644 --- a/internal/app/run/runner.go +++ b/internal/app/run/runner.go @@ -201,7 +201,7 @@ func (r *Runner) run(ctx context.Context, task *runnerv1.Task, reporter *report. PlatformPicker: r.labels.PickPlatform, Vars: task.Vars, ValidVolumes: r.cfg.Container.ValidVolumes, - InheritDiverOpts: r.cfg.Container.InheritDiverOpts, + InheritDriverOpts: r.cfg.Container.InheritDriverOpts, } rr, err := runner.New(runnerConfig) diff --git a/internal/pkg/config/config.go b/internal/pkg/config/config.go index bc2b13d..225a45c 100644 --- a/internal/pkg/config/config.go +++ b/internal/pkg/config/config.go @@ -42,14 +42,14 @@ type Cache struct { // Container represents the configuration for the container. type Container struct { - Network string `yaml:"network"` // Network specifies the network for the container. - InheritDiverOpts []string `yaml:"inherit_driver_opts"` // InheritDiverOpts indicates the network created by act_runner whether inherit the dirver options of the default bridge network. - NetworkMode string `yaml:"network_mode"` // Deprecated: use Network instead. Could be removed after Gitea 1.20 - Privileged bool `yaml:"privileged"` // Privileged indicates whether the container runs in privileged mode. - Options string `yaml:"options"` // Options specifies additional options for the container. - WorkdirParent string `yaml:"workdir_parent"` // WorkdirParent specifies the parent directory for the container's working directory. - ValidVolumes []string `yaml:"valid_volumes"` // ValidVolumes specifies the volumes (including bind mounts) can be mounted to containers. - DockerHost string `yaml:"docker_host"` // DockerHost specifies the Docker host. It overrides the value specified in environment variable DOCKER_HOST. + Network string `yaml:"network"` // Network specifies the network for the container. + InheritDriverOpts []string `yaml:"inherit_driver_opts"` // InheritDiverOpts indicates the network created by act_runner whether inherit the dirver options of the default bridge network. + NetworkMode string `yaml:"network_mode"` // Deprecated: use Network instead. Could be removed after Gitea 1.20 + Privileged bool `yaml:"privileged"` // Privileged indicates whether the container runs in privileged mode. + Options string `yaml:"options"` // Options specifies additional options for the container. + WorkdirParent string `yaml:"workdir_parent"` // WorkdirParent specifies the parent directory for the container's working directory. + ValidVolumes []string `yaml:"valid_volumes"` // ValidVolumes specifies the volumes (including bind mounts) can be mounted to containers. + DockerHost string `yaml:"docker_host"` // DockerHost specifies the Docker host. It overrides the value specified in environment variable DOCKER_HOST. } // Host represents the configuration for the host. @@ -143,12 +143,12 @@ func LoadDefault(file string) (*Config, error) { } var cleanDriverOptKeys []string - for _, key := range cfg.Container.InheritDiverOpts { + for _, key := range cfg.Container.InheritDriverOpts { if _, ok := validDriverOptKeysMap[key]; ok { cleanDriverOptKeys = append(cleanDriverOptKeys, key) } } - cfg.Container.InheritDiverOpts = cleanDriverOptKeys + cfg.Container.InheritDriverOpts = cleanDriverOptKeys return cfg, nil }