mirror of
				https://github.com/docker/setup-buildx-action.git
				synced 2025-10-31 01:20:09 +08:00 
			
		
		
		
	Merge pull request #139 from hashhar/hashhar/cleanup-aliases
Remove aliases created by buildx when installing by default
This commit is contained in:
		
						commit
						3f1544eb9e
					
				
							
								
								
									
										20
									
								
								dist/index.js
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										20
									
								
								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
											
										
									
								
							
							
								
								
									
										13
									
								
								src/main.ts
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								src/main.ts
									
									
									
									
									
								
							| @ -179,6 +179,7 @@ actionsToolkit.run( | ||||
|         throw new Error(`Cannot set buildx as default builder without the Docker CLI`); | ||||
|       } | ||||
|       await core.group(`Setting buildx as default builder`, async () => { | ||||
|         stateHelper.setBuildxIsDefaultBuilder(true); | ||||
|         const installCmd = await toolkit.buildx.getCommand(['install']); | ||||
|         await Exec.getExecOutput(installCmd.command, installCmd.args, { | ||||
|           ignoreReturnCode: true | ||||
| @ -279,5 +280,17 @@ actionsToolkit.run( | ||||
|         fs.rmSync(stateHelper.certsDir, {recursive: true}); | ||||
|       }); | ||||
|     } | ||||
| 
 | ||||
|     if (stateHelper.buildxIsDefaultBuilder) { | ||||
|       await core.group(`Restoring default builder`, async () => { | ||||
|         await Exec.getExecOutput('docker', ['buildx', 'uninstall'], { | ||||
|           ignoreReturnCode: true | ||||
|         }).then(res => { | ||||
|           if (res.stderr.length > 0 && res.exitCode != 0) { | ||||
|             core.warning(`${res.stderr.match(/(.*)\s*$/)?.[0]?.trim() ?? 'unknown error'}`); | ||||
|           } | ||||
|         }); | ||||
|       }); | ||||
|     } | ||||
|   } | ||||
| ); | ||||
|  | ||||
| @ -8,6 +8,7 @@ export const containerName = process.env['STATE_containerName'] || ''; | ||||
| export const certsDir = process.env['STATE_certsDir'] || ''; | ||||
| export const tmpDockerContext = process.env['STATE_tmpDockerContext'] || ''; | ||||
| export const cleanup = /true/i.test(process.env['STATE_cleanup'] || ''); | ||||
| export const buildxIsDefaultBuilder = /true/i.test(process.env['STATE_buildxIsDefaultBuilder'] || ''); | ||||
| 
 | ||||
| export function setDebug(debug: string) { | ||||
|   core.saveState('isDebug', debug); | ||||
| @ -40,3 +41,7 @@ export function setTmpDockerContext(tmpDockerContext: string) { | ||||
| export function setCleanup(cleanup: boolean) { | ||||
|   core.saveState('cleanup', cleanup); | ||||
| } | ||||
| 
 | ||||
| export function setBuildxIsDefaultBuilder(buildxIsDefaultBuilder: boolean) { | ||||
|   core.saveState('buildxIsDefaultBuilder', buildxIsDefaultBuilder); | ||||
| } | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 CrazyMax
						CrazyMax