mirror of
				https://github.com/docker/login-action.git
				synced 2025-10-31 10:10:09 +08:00 
			
		
		
		
	Merge pull request #41 from crazy-max/fix-public-ecr
Fix public ECR login with AWS CLI v1
This commit is contained in:
		
						commit
						7b79d7e834
					
				
							
								
								
									
										2
									
								
								dist/index.js
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								dist/index.js
									
									
									
										generated
									
									
										vendored
									
									
								
							| @ -4204,7 +4204,7 @@ exports.parseCLIVersion = (stdout) => __awaiter(void 0, void 0, void 0, function | |||||||
| }); | }); | ||||||
| exports.getDockerLoginCmd = (cliVersion, registry, region) => __awaiter(void 0, void 0, void 0, function* () { | exports.getDockerLoginCmd = (cliVersion, registry, region) => __awaiter(void 0, void 0, void 0, function* () { | ||||||
|     let ecrCmd = (yield exports.isPubECR(registry)) ? 'ecr-public' : 'ecr'; |     let ecrCmd = (yield exports.isPubECR(registry)) ? 'ecr-public' : 'ecr'; | ||||||
|     if (semver.satisfies(cliVersion, '>=2.0.0')) { |     if (semver.satisfies(cliVersion, '>=2.0.0') || (yield exports.isPubECR(registry))) { | ||||||
|         return exports.execCLI([ecrCmd, 'get-login-password', '--region', region]).then(pwd => { |         return exports.execCLI([ecrCmd, 'get-login-password', '--region', region]).then(pwd => { | ||||||
|             return `docker login --username AWS --password ${pwd} ${registry}`; |             return `docker login --username AWS --password ${pwd} ${registry}`; | ||||||
|         }); |         }); | ||||||
|  | |||||||
| @ -47,7 +47,7 @@ export const parseCLIVersion = async (stdout: string): Promise<string> => { | |||||||
| 
 | 
 | ||||||
| export const getDockerLoginCmd = async (cliVersion: string, registry: string, region: string): Promise<string> => { | export const getDockerLoginCmd = async (cliVersion: string, registry: string, region: string): Promise<string> => { | ||||||
|   let ecrCmd = (await isPubECR(registry)) ? 'ecr-public' : 'ecr'; |   let ecrCmd = (await isPubECR(registry)) ? 'ecr-public' : 'ecr'; | ||||||
|   if (semver.satisfies(cliVersion, '>=2.0.0')) { |   if (semver.satisfies(cliVersion, '>=2.0.0') || (await isPubECR(registry))) { | ||||||
|     return execCLI([ecrCmd, 'get-login-password', '--region', region]).then(pwd => { |     return execCLI([ecrCmd, 'get-login-password', '--region', region]).then(pwd => { | ||||||
|       return `docker login --username AWS --password ${pwd} ${registry}`; |       return `docker login --username AWS --password ${pwd} ${registry}`; | ||||||
|     }); |     }); | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 CrazyMax
						CrazyMax