mirror of
				https://github.com/docker/login-action.git
				synced 2025-10-31 18:20:10 +08:00 
			
		
		
		
	formatting
Signed-off-by: Fedor Dikarev <fedor.dikarev@gmail.com>
This commit is contained in:
		
							parent
							
								
									bdcef6ee7a
								
							
						
					
					
						commit
						27c8a02c91
					
				
							
								
								
									
										2
									
								
								dist/index.js
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								dist/index.js
									
									
									
										generated
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										2
									
								
								dist/index.js.map
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								dist/index.js.map
									
									
									
										generated
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| @ -5,15 +5,16 @@ import {Docker} from '@docker/actions-toolkit/lib/docker/docker'; | |||||||
| 
 | 
 | ||||||
| export async function login(registry: string, username: string, password: string, ecr: string, http_errors_to_retry: string[], max_attempts: number, retry_timeout: number): Promise<void> { | export async function login(registry: string, username: string, password: string, ecr: string, http_errors_to_retry: string[], max_attempts: number, retry_timeout: number): Promise<void> { | ||||||
|   let succeeded: boolean = false; |   let succeeded: boolean = false; | ||||||
|   for (let attempt = 1; (attempt <= max_attempts) && (!succeeded); attempt++) { |   for (let attempt = 1; attempt <= max_attempts && !succeeded; attempt++) { | ||||||
|     try { |     try { | ||||||
|       if (/true/i.test(ecr) || (ecr == 'auto' && aws.isECR(registry))) { |       if (/true/i.test(ecr) || (ecr == 'auto' && aws.isECR(registry))) { | ||||||
|         await loginECR(registry, username, password); |         await loginECR(registry, username, password); | ||||||
|       } else { |       } else { | ||||||
|         await loginStandard(registry, username, password); |         await loginStandard(registry, username, password); | ||||||
|       } |       } | ||||||
|  |       succeeded = true; | ||||||
|     } catch (error) { |     } catch (error) { | ||||||
|       if ((attempt < max_attempts) && (isRetriableError(error, http_errors_to_retry))) { |       if (attempt < max_attempts && isRetriableError(error, http_errors_to_retry)) { | ||||||
|         core.info(`Attempt ${attempt} out of ${max_attempts} failed, retrying after ${retry_timeout} seconds`); |         core.info(`Attempt ${attempt} out of ${max_attempts} failed, retrying after ${retry_timeout} seconds`); | ||||||
|         await new Promise(r => setTimeout(r, retry_timeout * 1000)); |         await new Promise(r => setTimeout(r, retry_timeout * 1000)); | ||||||
|       } else { |       } else { | ||||||
| @ -33,10 +34,9 @@ export async function logout(registry: string): Promise<void> { | |||||||
|   }); |   }); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| function isRetriableError(stderr: string, http_errors_to_retry: string[]): boolean { | function isRetriableError(error_message: string, http_errors_to_retry: string[]): boolean { | ||||||
|   const trimmedError = stderr.trim(); |  | ||||||
|   for (const err_code in http_errors_to_retry) { |   for (const err_code in http_errors_to_retry) { | ||||||
|     if (trimmedError.includes("failed with status: " + err_code)) { |     if (error_message.includes('failed with status: ' + err_code)) { | ||||||
|       return true; |       return true; | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Fedor Dikarev
						Fedor Dikarev