Compare commits
No commits in common. "bd130537736d74d8d77080d9876767981df759d9" and "d632111c45683060e02fac828ad08f924e654d2d" have entirely different histories.
bd13053773
...
d632111c45
8
.gitignore
vendored
8
.gitignore
vendored
@ -1,10 +1,2 @@
|
|||||||
/acid
|
/acid
|
||||||
/acid.1
|
/acid.1
|
||||||
|
|
||||||
/acid.cflags
|
|
||||||
/acid.config
|
|
||||||
/acid.creator
|
|
||||||
/acid.creator.user
|
|
||||||
/acid.cxxflags
|
|
||||||
/acid.files
|
|
||||||
/acid.includes
|
|
||||||
|
49
acid.go
49
acid.go
@ -66,11 +66,10 @@ 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 {
|
|
||||||
User string `yaml:"user"` // remote username
|
User string `yaml:"user"` // remote username
|
||||||
Address string `yaml:"address"` // TCP host:port
|
Address string `yaml:"address"` // TCP host:port
|
||||||
Identity string `yaml:"identity"` // private key path
|
Identity string `yaml:"identity"` // private key path
|
||||||
@ -81,22 +80,9 @@ 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)
|
||||||
Timeout string `yaml:"timeout"` // timeout duration
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func parseConfig(path string) error {
|
func parseConfig(path string) error {
|
||||||
@ -392,7 +378,12 @@ func handlePush(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
runners := project.AutomaticRunners()
|
runners := []string{}
|
||||||
|
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 {
|
||||||
@ -501,8 +492,11 @@ func rpcEnqueue(ctx context.Context,
|
|||||||
|
|
||||||
runners := fs.Args()[3:]
|
runners := fs.Args()[3:]
|
||||||
if len(runners) == 0 {
|
if len(runners) == 0 {
|
||||||
runners = project.AutomaticRunners()
|
for runner := range project.Runners {
|
||||||
|
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 {
|
||||||
@ -943,17 +937,6 @@ func executorRunTask(ctx context.Context, task Task) error {
|
|||||||
return fmt.Errorf("script: %w", err)
|
return fmt.Errorf("script: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Lenient or not, some kind of a time limit is desirable.
|
|
||||||
timeout := time.Hour
|
|
||||||
if rt.ProjectRunner.Timeout != "" {
|
|
||||||
timeout, err = time.ParseDuration(rt.ProjectRunner.Timeout)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("timeout: %w", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ctx, cancelTimeout := context.WithTimeout(ctx, timeout)
|
|
||||||
defer cancelTimeout()
|
|
||||||
|
|
||||||
privateKey, err := os.ReadFile(rt.Runner.SSH.Identity)
|
privateKey, err := os.ReadFile(rt.Runner.SSH.Identity)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf(
|
return fmt.Errorf(
|
||||||
|
@ -62,7 +62,3 @@ projects:
|
|||||||
build: |
|
build: |
|
||||||
echo Computing line count...
|
echo Computing line count...
|
||||||
find . -not -path '*/.*' -type f -print0 | xargs -0 cat | wc -l
|
find . -not -path '*/.*' -type f -print0 | xargs -0 cat | wc -l
|
||||||
|
|
||||||
# Time limit in time.ParseDuration format.
|
|
||||||
# The default of one hour should suffice.
|
|
||||||
timeout: 1h
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user