mirror of
				https://github.com/docker/setup-buildx-action.git
				synced 2025-11-04 06:34:19 +08:00 
			
		
		
		
	Merge pull request #175 from crazy-max/input-list-quotes
escape surrounding quotes for platforms input
This commit is contained in:
		
						commit
						8c0edbc76e
					
				@ -124,6 +124,21 @@ describe('getCreateArgs', () => {
 | 
				
			|||||||
        '--buildkitd-flags', '--allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host'
 | 
					        '--buildkitd-flags', '--allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host'
 | 
				
			||||||
      ]
 | 
					      ]
 | 
				
			||||||
    ],
 | 
					    ],
 | 
				
			||||||
 | 
					    [
 | 
				
			||||||
 | 
					      6,
 | 
				
			||||||
 | 
					      new Map<string, string>([
 | 
				
			||||||
 | 
					        ['install', 'false'],
 | 
				
			||||||
 | 
					        ['use', 'false'],
 | 
				
			||||||
 | 
					        ['platforms', 'linux/amd64\n"linux/arm64,linux/arm/v7"'],
 | 
				
			||||||
 | 
					      ]),
 | 
				
			||||||
 | 
					      [
 | 
				
			||||||
 | 
					        'create',
 | 
				
			||||||
 | 
					        '--name', 'builder-9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d',
 | 
				
			||||||
 | 
					        '--driver', 'docker-container',
 | 
				
			||||||
 | 
					        '--buildkitd-flags', '--allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host',
 | 
				
			||||||
 | 
					        '--platform', 'linux/amd64,linux/arm64,linux/arm/v7'
 | 
				
			||||||
 | 
					      ]
 | 
				
			||||||
 | 
					    ],
 | 
				
			||||||
  ])(
 | 
					  ])(
 | 
				
			||||||
    '[%d] given %p as inputs, returns %p',
 | 
					    '[%d] given %p as inputs, returns %p',
 | 
				
			||||||
    async (num: number, inputs: Map<string, string>, expected: Array<string>) => {
 | 
					    async (num: number, inputs: Map<string, string>, expected: Array<string>) => {
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										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
											
										
									
								
							@ -45,7 +45,7 @@ export async function getInputs(): Promise<Inputs> {
 | 
				
			|||||||
    driver: core.getInput('driver') || 'docker-container',
 | 
					    driver: core.getInput('driver') || 'docker-container',
 | 
				
			||||||
    driverOpts: await getInputList('driver-opts', true),
 | 
					    driverOpts: await getInputList('driver-opts', true),
 | 
				
			||||||
    buildkitdFlags: core.getInput('buildkitd-flags') || '--allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host',
 | 
					    buildkitdFlags: core.getInput('buildkitd-flags') || '--allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host',
 | 
				
			||||||
    platforms: await getInputList('platforms'),
 | 
					    platforms: await getInputList('platforms', false, true),
 | 
				
			||||||
    install: core.getBooleanInput('install'),
 | 
					    install: core.getBooleanInput('install'),
 | 
				
			||||||
    use: core.getBooleanInput('use'),
 | 
					    use: core.getBooleanInput('use'),
 | 
				
			||||||
    endpoint: core.getInput('endpoint'),
 | 
					    endpoint: core.getInput('endpoint'),
 | 
				
			||||||
@ -118,7 +118,7 @@ export async function getInspectArgs(inputs: Inputs, buildxVersion: string): Pro
 | 
				
			|||||||
  return args;
 | 
					  return args;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export async function getInputList(name: string, ignoreComma?: boolean): Promise<string[]> {
 | 
					export async function getInputList(name: string, ignoreComma?: boolean, escapeQuotes?: boolean): Promise<string[]> {
 | 
				
			||||||
  const res: Array<string> = [];
 | 
					  const res: Array<string> = [];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const items = core.getInput(name);
 | 
					  const items = core.getInput(name);
 | 
				
			||||||
@ -132,7 +132,7 @@ export async function getInputList(name: string, ignoreComma?: boolean): Promise
 | 
				
			|||||||
    comment: '#',
 | 
					    comment: '#',
 | 
				
			||||||
    relaxColumnCount: true,
 | 
					    relaxColumnCount: true,
 | 
				
			||||||
    skipEmptyLines: true,
 | 
					    skipEmptyLines: true,
 | 
				
			||||||
    quote: false
 | 
					    quote: escapeQuotes ? `"` : false
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  for (const record of records as Array<string[]>) {
 | 
					  for (const record of records as Array<string[]>) {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user