mirror of
				https://github.com/docker/setup-buildx-action.git
				synced 2025-10-23 08:56:05 +08:00 
			
		
		
		
	check if driver compatible with keep-state
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
		| @@ -42,17 +42,14 @@ export async function getInputs(): Promise<Inputs> { | ||||
|     buildkitdConfig: core.getInput('buildkitd-config') || core.getInput('config'), | ||||
|     buildkitdConfigInline: core.getInput('buildkitd-config-inline') || core.getInput('config-inline'), | ||||
|     append: core.getInput('append'), | ||||
|     keepState: core.getBooleanInput('keep-state'), | ||||
|     cacheBinary: core.getBooleanInput('cache-binary'), | ||||
|     cleanup: core.getBooleanInput('cleanup'), | ||||
|     keepState: core.getBooleanInput('keep-state') | ||||
|     cleanup: core.getBooleanInput('cleanup') | ||||
|   }; | ||||
| } | ||||
|  | ||||
| export async function getBuilderName(name: string, driver: string): Promise<string> { | ||||
|   if (driver == 'docker') { | ||||
|     return await Docker.context(); | ||||
|   } | ||||
|   return name || `builder-${crypto.randomUUID()}`; | ||||
|   return driver == 'docker' ? await Docker.context() : name || `builder-${crypto.randomUUID()}`; | ||||
| } | ||||
|  | ||||
| export async function getCreateArgs(inputs: Inputs, toolkit: Toolkit): Promise<Array<string>> { | ||||
|   | ||||
| @@ -28,6 +28,12 @@ actionsToolkit.run( | ||||
|     const standalone = await toolkit.buildx.isStandalone(); | ||||
|     stateHelper.setStandalone(standalone); | ||||
|  | ||||
|     if (inputs.keepState && inputs.driver !== 'docker-container') { | ||||
|       // https://docs.docker.com/reference/cli/docker/buildx/rm/#keep-state | ||||
|       throw new Error(`Cannot use keep-state with ${inputs.driver} driver`); | ||||
|     } | ||||
|     stateHelper.setKeepState(inputs.keepState); | ||||
|  | ||||
|     await core.group(`Docker info`, async () => { | ||||
|       try { | ||||
|         await Docker.printVersion(); | ||||
| @@ -115,7 +121,6 @@ actionsToolkit.run( | ||||
|         }); | ||||
|       } | ||||
|     } | ||||
|     stateHelper.setKeepState(inputs.keepState); | ||||
|  | ||||
|     if (inputs.driver !== 'docker') { | ||||
|       await core.group(`Creating a new builder instance`, async () => { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user