Allow configuration of default platform if no runs-on labels match

This commit is contained in:
Mike
2025-01-26 19:49:15 -08:00
parent 8dfb805c62
commit 0957d88d06
4 changed files with 14 additions and 3 deletions

View File

@@ -206,7 +206,7 @@ func (r *Runner) run(ctx context.Context, task *runnerv1.Task, reporter *report.
ContainerDaemonSocket: r.cfg.Container.DockerHost,
Privileged: r.cfg.Container.Privileged,
DefaultActionInstance: taskContext["gitea_default_actions_url"].GetStringValue(),
PlatformPicker: r.labels.PickPlatform,
PlatformPicker: r.pickPlatform,
Vars: task.Vars,
ValidVolumes: r.cfg.Container.ValidVolumes,
InsecureSkipTLS: r.cfg.Runner.Insecure,
@@ -238,3 +238,11 @@ func (r *Runner) Declare(ctx context.Context, labels []string) (*connect.Respons
Labels: labels,
}))
}
func (r *Runner) pickPlatform(labels []string) string {
platform := r.labels.PickPlatform(labels)
if platform == "" {
platform = r.cfg.Runner.DefaultPlatform
}
return platform
}