Compare commits
	
		
			3 Commits
		
	
	
		
			d632111c45
			...
			bd13053773
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						
						
							
						
						bd13053773
	
				 | 
					
					
						|||
| 
						
						
							
						
						92fd2db1c1
	
				 | 
					
					
						|||
| 
						
						
							
						
						0db2ff3409
	
				 | 
					
					
						
							
								
								
									
										8
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										8
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@@ -1,2 +1,10 @@
 | 
			
		||||
/acid
 | 
			
		||||
/acid.1
 | 
			
		||||
 | 
			
		||||
/acid.cflags
 | 
			
		||||
/acid.config
 | 
			
		||||
/acid.creator
 | 
			
		||||
/acid.creator.user
 | 
			
		||||
/acid.cxxflags
 | 
			
		||||
/acid.files
 | 
			
		||||
/acid.includes
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										37
									
								
								acid.go
									
									
									
									
									
								
							
							
						
						
									
										37
									
								
								acid.go
									
									
									
									
									
								
							@@ -67,6 +67,7 @@ type Config struct {
 | 
			
		||||
 | 
			
		||||
type ConfigRunner 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 {
 | 
			
		||||
@@ -80,9 +81,22 @@ 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)
 | 
			
		||||
	Timeout string `yaml:"timeout"` // timeout duration
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func parseConfig(path string) error {
 | 
			
		||||
@@ -378,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 {
 | 
			
		||||
@@ -492,11 +501,8 @@ 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)
 | 
			
		||||
 | 
			
		||||
	for _, runner := range runners {
 | 
			
		||||
		if _, ok := project.Runners[runner]; !ok {
 | 
			
		||||
@@ -937,6 +943,17 @@ func executorRunTask(ctx context.Context, task Task) error {
 | 
			
		||||
		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)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return fmt.Errorf(
 | 
			
		||||
 
 | 
			
		||||
@@ -62,3 +62,7 @@ projects:
 | 
			
		||||
        build: |
 | 
			
		||||
          echo Computing line count...
 | 
			
		||||
          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
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user