From 547a718f22b273f712f550ce77ead209042968aa Mon Sep 17 00:00:00 2001 From: zcube Date: Mon, 5 Jun 2023 13:48:11 +0900 Subject: [PATCH] Add UseGitignore config --- internal/app/run/runner.go | 1 + internal/pkg/config/config.example.yaml | 2 ++ internal/pkg/config/config.go | 5 +++++ 3 files changed, 8 insertions(+) diff --git a/internal/app/run/runner.go b/internal/app/run/runner.go index b4b0487..8fbeffa 100644 --- a/internal/app/run/runner.go +++ b/internal/app/run/runner.go @@ -200,6 +200,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, + UseGitIgnore: r.cfg.Runner.UseGitIgnore == nil || *r.cfg.Runner.UseGitIgnore, } rr, err := runner.New(runnerConfig) diff --git a/internal/pkg/config/config.example.yaml b/internal/pkg/config/config.example.yaml index e71184b..26c112c 100644 --- a/internal/pkg/config/config.example.yaml +++ b/internal/pkg/config/config.example.yaml @@ -31,6 +31,8 @@ runner: # If it's empty when registering, it will ask for inputting labels. # If it's empty when execute `deamon`, will use labels in `.runner` file. labels: [] + # When this is set to true, the .gitignore will be used for actions + use_gitignore: true cache: # Enable cache server to use actions/cache. diff --git a/internal/pkg/config/config.go b/internal/pkg/config/config.go index 8f81cc8..180aeb8 100644 --- a/internal/pkg/config/config.go +++ b/internal/pkg/config/config.go @@ -30,6 +30,7 @@ type Runner struct { FetchTimeout time.Duration `yaml:"fetch_timeout"` // FetchTimeout specifies the timeout duration for fetching resources. FetchInterval time.Duration `yaml:"fetch_interval"` // FetchInterval specifies the interval duration for fetching resources. Labels []string `yaml:"labels"` // Labels specifies the labels of the runner. Labels are declared on each startup + UseGitIgnore *bool `yaml:"use_gitignore"` // UseGitIgnore specifies the UseGitIgnore option. It is a pointer to distinguish between false and not set. If not set, it will be true. } // Cache represents the configuration for caching. @@ -127,6 +128,10 @@ func LoadDefault(file string) (*Config, error) { if cfg.Runner.FetchInterval <= 0 { cfg.Runner.FetchInterval = 2 * time.Second } + if cfg.Runner.UseGitIgnore == nil { + b := true + cfg.Runner.UseGitIgnore = &b + } // although `container.network_mode` will be deprecated, but we have to be compatible with it for now. if cfg.Container.NetworkMode != "" && cfg.Container.Network == "" {