revert: 27a2aac537
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				continuous-integration/drone/push Build is passing
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	continuous-integration/drone/push Build is passing
				
			revert feat: return 1 on force quit
This commit is contained in:
		
							parent
							
								
									27a2aac537
								
							
						
					
					
						commit
						f81581b928
					
				|  | @ -71,26 +71,17 @@ func outputResult(conf Conf, results []stage.StageResult) error { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func main() { | func main() { | ||||||
| 	retCode := 0 |  | ||||||
| 	defer func() { |  | ||||||
| 		os.Exit(retCode) |  | ||||||
| 	}() |  | ||||||
| 	conf, err := commitMsgToConf() | 	conf, err := commitMsgToConf() | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		slog.Error("no conf found", "error", err) | 		slog.Error("no conf found", "error", err) | ||||||
| 		retCode = 1 | 		os.Exit(1) | ||||||
| 		return |  | ||||||
| 	} | 	} | ||||||
| 	setupSlog(conf) | 	setupSlog(conf) | ||||||
| 	executors.InitWithConf(conf.SandboxExecServer, conf.SandboxToken) | 	executors.InitWithConf(conf.SandboxExecServer, conf.SandboxToken) | ||||||
| 	stages := generateStages(conf) | 	stages := generateStages(conf) | ||||||
| 	defer stage.Cleanup() | 	defer stage.Cleanup() | ||||||
| 	results, stageErr := stage.Run(stages) | 	results := stage.Run(stages) | ||||||
| 	if err := outputResult(conf, results); err != nil { | 	if err := outputResult(conf, results); err != nil { | ||||||
| 		slog.Error("output result", "error", err) | 		slog.Error("output result", "error", err) | ||||||
| 	} | 	} | ||||||
| 	if stageErr != nil { |  | ||||||
| 		retCode = 1 |  | ||||||
| 		return |  | ||||||
| 	} |  | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -1,11 +1,11 @@ | ||||||
| package stage | package stage | ||||||
| 
 | 
 | ||||||
| import ( | import ( | ||||||
| 	"errors" |  | ||||||
| 	"log/slog" | 	"log/slog" | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| func Run(stages []Stage) (stageResults []StageResult, stageErr error) { | func Run(stages []Stage) []StageResult { | ||||||
|  | 	stageResults := []StageResult{} | ||||||
| 	for _, stage := range stages { | 	for _, stage := range stages { | ||||||
| 		slog.Debug("stage start", "name", stage.Name) | 		slog.Debug("stage start", "name", stage.Name) | ||||||
| 		slog.Debug("executor run start", "cmds", stage.ExecutorCmds) | 		slog.Debug("executor run start", "cmds", stage.ExecutorCmds) | ||||||
|  | @ -38,11 +38,10 @@ func Run(stages []Stage) (stageResults []StageResult, stageErr error) { | ||||||
| 			ForceQuit: forceQuit, | 			ForceQuit: forceQuit, | ||||||
| 		}) | 		}) | ||||||
| 		if forceQuit { | 		if forceQuit { | ||||||
| 			stageErr = errors.New("parser force quit") |  | ||||||
| 			break | 			break | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 	return | 	return stageResults | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func Cleanup() { | func Cleanup() { | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user