diff options
author | Přemysl Eric Janouch <p@janouch.name> | 2024-12-21 14:38:11 +0100 |
---|---|---|
committer | Přemysl Eric Janouch <p@janouch.name> | 2024-12-21 14:38:21 +0100 |
commit | 5fd64b3420c9f90463e7c93e20cd9dca599321d5 (patch) | |
tree | 5548bc24e6ac6eda925746dde2d59f35585f4680 | |
parent | 92fd2db1c17a2ec3f7bd19f0e8543ad1ef7cf92b (diff) | |
download | acid-5fd64b3420c9f90463e7c93e20cd9dca599321d5.tar.gz acid-5fd64b3420c9f90463e7c93e20cd9dca599321d5.tar.xz acid-5fd64b3420c9f90463e7c93e20cd9dca599321d5.zip |
This is intended for runners that are only available on request.
-rw-r--r-- | acid.go | 32 |
1 files changed, 19 insertions, 13 deletions
@@ -66,10 +66,11 @@ type Config struct { } type ConfigRunner struct { - Name string `yaml:"name"` // descriptive name - Run string `yaml:"run"` // runner executable - Setup string `yaml:"setup"` // runner setup script (SSH) - SSH struct { + Name string `yaml:"name"` // descriptive name + Manual bool `yaml:"manual"` // only run on request + Run string `yaml:"run"` // runner executable + Setup string `yaml:"setup"` // runner setup script (SSH) + SSH struct { User string `yaml:"user"` // remote username Address string `yaml:"address"` // TCP host:port Identity string `yaml:"identity"` // private key path @@ -80,6 +81,18 @@ type ConfigProject struct { Runners map[string]ConfigProjectRunner `yaml:"runners"` } +func (cf *ConfigProject) AutomaticRunners() (runners []string) { + // We pass through unknown runner names, + // so that they can cause reference errors later. + for runner := range cf.Runners { + if r, _ := gConfig.Runners[runner]; !r.Manual { + runners = append(runners, runner) + } + } + sort.Strings(runners) + return +} + type ConfigProjectRunner struct { Setup string `yaml:"setup"` // project setup script (SSH) Build string `yaml:"build"` // project build script (SSH) @@ -379,12 +392,7 @@ func handlePush(w http.ResponseWriter, r *http.Request) { return } - runners := []string{} - for name := range project.Runners { - runners = append(runners, name) - } - sort.Strings(runners) - + runners := project.AutomaticRunners() if err := createTasks(r.Context(), event.Repository.Owner.Username, event.Repository.Name, event.HeadCommit.ID, runners); err != nil { @@ -493,9 +501,7 @@ func rpcEnqueue(ctx context.Context, runners := fs.Args()[3:] if len(runners) == 0 { - for runner := range project.Runners { - runners = append(runners, runner) - } + runners = project.AutomaticRunners() } sort.Strings(runners) |