mirror of
				https://github.com/docker/login-action.git
				synced 2025-10-31 01:40:11 +08:00 
			
		
		
		
	Merge pull request #876 from crazy-max/aws-public-dual-stack
support dual-stack for aws public ecr
This commit is contained in:
		
						commit
						1a81202c4f
					
				| @ -11,7 +11,8 @@ describe('isECR', () => { | |||||||
|     ['876820548815.dkr.ecr.cn-north-1.amazonaws.com.cn', true], |     ['876820548815.dkr.ecr.cn-north-1.amazonaws.com.cn', true], | ||||||
|     ['390948362332.dkr.ecr.cn-northwest-1.amazonaws.com.cn', true], |     ['390948362332.dkr.ecr.cn-northwest-1.amazonaws.com.cn', true], | ||||||
|     ['012345678901.dkr-ecr.eu-north-1.on.aws', true], |     ['012345678901.dkr-ecr.eu-north-1.on.aws', true], | ||||||
|     ['public.ecr.aws', true] |     ['public.ecr.aws', true], | ||||||
|  |     ['ecr-public.aws.com', true] | ||||||
|   ])('given registry %p', async (registry, expected) => { |   ])('given registry %p', async (registry, expected) => { | ||||||
|     expect(aws.isECR(registry)).toEqual(expected); |     expect(aws.isECR(registry)).toEqual(expected); | ||||||
|   }); |   }); | ||||||
| @ -25,7 +26,8 @@ describe('isPubECR', () => { | |||||||
|     ['876820548815.dkr.ecr.cn-north-1.amazonaws.com.cn', false], |     ['876820548815.dkr.ecr.cn-north-1.amazonaws.com.cn', false], | ||||||
|     ['390948362332.dkr.ecr.cn-northwest-1.amazonaws.com.cn', false], |     ['390948362332.dkr.ecr.cn-northwest-1.amazonaws.com.cn', false], | ||||||
|     ['012345678901.dkr-ecr.eu-north-1.on.aws', false], |     ['012345678901.dkr-ecr.eu-north-1.on.aws', false], | ||||||
|     ['public.ecr.aws', true] |     ['public.ecr.aws', true], | ||||||
|  |     ['ecr-public.aws.com', true] | ||||||
|   ])('given registry %p', async (registry, expected) => { |   ])('given registry %p', async (registry, expected) => { | ||||||
|     expect(aws.isPubECR(registry)).toEqual(expected); |     expect(aws.isPubECR(registry)).toEqual(expected); | ||||||
|   }); |   }); | ||||||
|  | |||||||
							
								
								
									
										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
											
										
									
								
							| @ -6,13 +6,14 @@ import {HttpProxyAgent} from 'http-proxy-agent'; | |||||||
| import {HttpsProxyAgent} from 'https-proxy-agent'; | import {HttpsProxyAgent} from 'https-proxy-agent'; | ||||||
| 
 | 
 | ||||||
| const ecrRegistryRegex = /^(([0-9]{12})\.(dkr\.ecr|dkr-ecr)\.(.+)\.(on\.aws|amazonaws\.com(.cn)?))(\/([^:]+)(:.+)?)?$/; | const ecrRegistryRegex = /^(([0-9]{12})\.(dkr\.ecr|dkr-ecr)\.(.+)\.(on\.aws|amazonaws\.com(.cn)?))(\/([^:]+)(:.+)?)?$/; | ||||||
|  | const ecrPublicRegistryRegex = /public\.ecr\.aws|ecr-public\.aws\.com/; | ||||||
| 
 | 
 | ||||||
| export const isECR = (registry: string): boolean => { | export const isECR = (registry: string): boolean => { | ||||||
|   return ecrRegistryRegex.test(registry) || isPubECR(registry); |   return ecrRegistryRegex.test(registry) || isPubECR(registry); | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| export const isPubECR = (registry: string): boolean => { | export const isPubECR = (registry: string): boolean => { | ||||||
|   return registry === 'public.ecr.aws'; |   return ecrPublicRegistryRegex.test(registry); | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| export const getRegion = (registry: string): string => { | export const getRegion = (registry: string): string => { | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 CrazyMax
						CrazyMax