Add UseGitignore config

This commit is contained in:
zcube 2023-06-05 13:48:11 +09:00
parent b0bd503b11
commit 547a718f22
No known key found for this signature in database
GPG key ID: F251D1BA7EF71701
3 changed files with 8 additions and 0 deletions
internal

View file

@ -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)

View file

@ -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.

View file

@ -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 == "" {