mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-31 07:21:36 +01:00 
			
		
		
		
	Fix job status aggregation logic (#34823)
This commit is contained in:
		
							parent
							
								
									229235f99d
								
							
						
					
					
						commit
						a789a8cc7a
					
				| @ -185,10 +185,10 @@ func AggregateJobStatus(jobs []*ActionRunJob) Status { | ||||
| 		return StatusSuccess | ||||
| 	case hasCancelled: | ||||
| 		return StatusCancelled | ||||
| 	case hasFailure: | ||||
| 		return StatusFailure | ||||
| 	case hasRunning: | ||||
| 		return StatusRunning | ||||
| 	case hasFailure: | ||||
| 		return StatusFailure | ||||
| 	case hasWaiting: | ||||
| 		return StatusWaiting | ||||
| 	case hasBlocked: | ||||
|  | ||||
| @ -58,14 +58,14 @@ func TestAggregateJobStatus(t *testing.T) { | ||||
| 		{[]Status{StatusCancelled, StatusRunning}, StatusCancelled}, | ||||
| 		{[]Status{StatusCancelled, StatusBlocked}, StatusCancelled}, | ||||
| 
 | ||||
| 		// failure with other status, fail fast | ||||
| 		// Should "running" win? Maybe no: old code does make "running" win, but GitHub does fail fast. | ||||
| 		// failure with other status, usually fail fast, but "running" wins to match GitHub's behavior | ||||
| 		// another reason that we can't make "failure" wins over "running": it would cause a weird behavior that user cannot cancel a workflow or get current running workflows correctly by filter after a job fail. | ||||
| 		{[]Status{StatusFailure}, StatusFailure}, | ||||
| 		{[]Status{StatusFailure, StatusSuccess}, StatusFailure}, | ||||
| 		{[]Status{StatusFailure, StatusSkipped}, StatusFailure}, | ||||
| 		{[]Status{StatusFailure, StatusCancelled}, StatusCancelled}, | ||||
| 		{[]Status{StatusFailure, StatusWaiting}, StatusFailure}, | ||||
| 		{[]Status{StatusFailure, StatusRunning}, StatusFailure}, | ||||
| 		{[]Status{StatusFailure, StatusRunning}, StatusRunning}, | ||||
| 		{[]Status{StatusFailure, StatusBlocked}, StatusFailure}, | ||||
| 
 | ||||
| 		// skipped with other status | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user