This is intended for runners that are only available on request.
This commit is contained in:
parent
92fd2db1c1
commit
bd13053773
25
acid.go
25
acid.go
@ -67,6 +67,7 @@ type Config struct {
|
|||||||
|
|
||||||
type ConfigRunner struct {
|
type ConfigRunner struct {
|
||||||
Name string `yaml:"name"` // descriptive name
|
Name string `yaml:"name"` // descriptive name
|
||||||
|
Manual bool `yaml:"manual"` // only run on request
|
||||||
Run string `yaml:"run"` // runner executable
|
Run string `yaml:"run"` // runner executable
|
||||||
Setup string `yaml:"setup"` // runner setup script (SSH)
|
Setup string `yaml:"setup"` // runner setup script (SSH)
|
||||||
SSH struct {
|
SSH struct {
|
||||||
@ -80,6 +81,18 @@ type ConfigProject struct {
|
|||||||
Runners map[string]ConfigProjectRunner `yaml:"runners"`
|
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 {
|
type ConfigProjectRunner struct {
|
||||||
Setup string `yaml:"setup"` // project setup script (SSH)
|
Setup string `yaml:"setup"` // project setup script (SSH)
|
||||||
Build string `yaml:"build"` // project build script (SSH)
|
Build string `yaml:"build"` // project build script (SSH)
|
||||||
@ -379,12 +392,7 @@ func handlePush(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
runners := []string{}
|
runners := project.AutomaticRunners()
|
||||||
for name := range project.Runners {
|
|
||||||
runners = append(runners, name)
|
|
||||||
}
|
|
||||||
sort.Strings(runners)
|
|
||||||
|
|
||||||
if err := createTasks(r.Context(),
|
if err := createTasks(r.Context(),
|
||||||
event.Repository.Owner.Username, event.Repository.Name,
|
event.Repository.Owner.Username, event.Repository.Name,
|
||||||
event.HeadCommit.ID, runners); err != nil {
|
event.HeadCommit.ID, runners); err != nil {
|
||||||
@ -493,11 +501,8 @@ func rpcEnqueue(ctx context.Context,
|
|||||||
|
|
||||||
runners := fs.Args()[3:]
|
runners := fs.Args()[3:]
|
||||||
if len(runners) == 0 {
|
if len(runners) == 0 {
|
||||||
for runner := range project.Runners {
|
runners = project.AutomaticRunners()
|
||||||
runners = append(runners, runner)
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
sort.Strings(runners)
|
|
||||||
|
|
||||||
for _, runner := range runners {
|
for _, runner := range runners {
|
||||||
if _, ok := project.Runners[runner]; !ok {
|
if _, ok := project.Runners[runner]; !ok {
|
||||||
|
Loading…
Reference in New Issue
Block a user