Merge pull request #188 from crazy-max/fix-buildargs-labels-type
Labels and build args should not be handled as CSV type
This commit is contained in:
		
						commit
						24a0b9628d
					
				
							
								
								
									
										58
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										58
									
								
								README.md
									
									
									
									
									
								
							@ -592,46 +592,38 @@ with this action:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
Following inputs can be used as `step.with` keys
 | 
					Following inputs can be used as `step.with` keys
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| Name                | Type    | Description                        |
 | 
					| Name                | Type     | Description                        |
 | 
				
			||||||
|---------------------|---------|------------------------------------|
 | 
					|---------------------|----------|------------------------------------|
 | 
				
			||||||
| `builder`           | String  | Builder instance (see [setup-buildx](https://github.com/docker/setup-buildx-action) action) |
 | 
					| `builder`           | String   | Builder instance (see [setup-buildx](https://github.com/docker/setup-buildx-action) action) |
 | 
				
			||||||
| `context`           | String  | Build's context is the set of files located in the specified [`PATH` or `URL`](https://docs.docker.com/engine/reference/commandline/build/) (default [Git context](#git-context)) |
 | 
					| `context`           | String   | Build's context is the set of files located in the specified [`PATH` or `URL`](https://docs.docker.com/engine/reference/commandline/build/) (default [Git context](#git-context)) |
 | 
				
			||||||
| `file`              | String  | Path to the Dockerfile (default `Dockerfile`) |
 | 
					| `file`              | String   | Path to the Dockerfile (default `Dockerfile`) |
 | 
				
			||||||
| `build-args`        | List    | List of build-time variables |
 | 
					| `build-args`        | List     | List of build-time variables |
 | 
				
			||||||
| `labels`            | List    | List of metadata for an image |
 | 
					| `labels`            | List     | List of metadata for an image |
 | 
				
			||||||
| `tags`              | List    | List of tags |
 | 
					| `tags`              | List/CSV | List of tags |
 | 
				
			||||||
| `pull`              | Bool    | Always attempt to pull a newer version of the image (default `false`) |
 | 
					| `pull`              | Bool     | Always attempt to pull a newer version of the image (default `false`) |
 | 
				
			||||||
| `target`            | String  | Sets the target stage to build |
 | 
					| `target`            | String   | Sets the target stage to build |
 | 
				
			||||||
| `allow`             | List    | List of [extra privileged entitlement](https://github.com/docker/buildx#--allowentitlement) (eg. `network.host,security.insecure`) |
 | 
					| `allow`             | List/CSV | List of [extra privileged entitlement](https://github.com/docker/buildx#--allowentitlement) (eg. `network.host,security.insecure`) |
 | 
				
			||||||
| `no-cache`          | Bool    | Do not use cache when building the image (default `false`) |
 | 
					| `no-cache`          | Bool     | Do not use cache when building the image (default `false`) |
 | 
				
			||||||
| `platforms`         | List    | List of [target platforms](https://github.com/docker/buildx#---platformvaluevalue) for build |
 | 
					| `platforms`         | List/CSV | List of [target platforms](https://github.com/docker/buildx#---platformvaluevalue) for build |
 | 
				
			||||||
| `load`              | Bool    | [Load](https://github.com/docker/buildx#--load) is a shorthand for `--output=type=docker` (default `false`) |
 | 
					| `load`              | Bool     | [Load](https://github.com/docker/buildx#--load) is a shorthand for `--output=type=docker` (default `false`) |
 | 
				
			||||||
| `push`              | Bool    | [Push](https://github.com/docker/buildx#--push) is a shorthand for `--output=type=registry` (default `false`) |
 | 
					| `push`              | Bool     | [Push](https://github.com/docker/buildx#--push) is a shorthand for `--output=type=registry` (default `false`) |
 | 
				
			||||||
| `outputs`           | CSV     | List of [output destinations](https://github.com/docker/buildx#-o---outputpath-typetypekeyvalue) (format: `type=local,dest=path`) |
 | 
					| `outputs`           | List     | List of [output destinations](https://github.com/docker/buildx#-o---outputpath-typetypekeyvalue) (format: `type=local,dest=path`) |
 | 
				
			||||||
| `cache-from`        | CSV     | List of [external cache sources](https://github.com/docker/buildx#--cache-fromnametypetypekeyvalue) (eg. `type=local,src=path/to/dir`) |
 | 
					| `cache-from`        | List     | List of [external cache sources](https://github.com/docker/buildx#--cache-fromnametypetypekeyvalue) (eg. `type=local,src=path/to/dir`) |
 | 
				
			||||||
| `cache-to`          | CSV     | List of [cache export destinations](https://github.com/docker/buildx#--cache-tonametypetypekeyvalue) (eg. `type=local,dest=path/to/dir`) |
 | 
					| `cache-to`          | List     | List of [cache export destinations](https://github.com/docker/buildx#--cache-tonametypetypekeyvalue) (eg. `type=local,dest=path/to/dir`) |
 | 
				
			||||||
| `secrets`           | CSV     | List of secrets to expose to the build (eg. `key=value`, `GIT_AUTH_TOKEN=mytoken`) |
 | 
					| `secrets`           | List     | List of secrets to expose to the build (eg. `key=value`, `GIT_AUTH_TOKEN=mytoken`) |
 | 
				
			||||||
 | 
					
 | 
				
			||||||
> `List` type can be a comma or newline-delimited string
 | 
					> `List` type is a newline-delimited string
 | 
				
			||||||
> ```yaml
 | 
					 | 
				
			||||||
> tags: name/app:latest,name/app:1.0.0
 | 
					 | 
				
			||||||
> ```
 | 
					 | 
				
			||||||
> ```yaml
 | 
					 | 
				
			||||||
> tags: |
 | 
					 | 
				
			||||||
>   name/app:latest
 | 
					 | 
				
			||||||
>   name/app:1.0.0
 | 
					 | 
				
			||||||
> ```
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
> `CSV` type must be a newline-delimited string
 | 
					 | 
				
			||||||
> ```yaml
 | 
					 | 
				
			||||||
> cache-from: user/app:cache
 | 
					 | 
				
			||||||
> ```
 | 
					 | 
				
			||||||
> ```yaml
 | 
					> ```yaml
 | 
				
			||||||
> cache-from: |
 | 
					> cache-from: |
 | 
				
			||||||
>   user/app:cache
 | 
					>   user/app:cache
 | 
				
			||||||
>   type=local,src=path/to/dir
 | 
					>   type=local,src=path/to/dir
 | 
				
			||||||
> ```
 | 
					> ```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					> `CSV` type is a comma-delimited string
 | 
				
			||||||
 | 
					> ```yaml
 | 
				
			||||||
 | 
					> tags: name/app:latest,name/app:1.0.0
 | 
				
			||||||
 | 
					> ```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### outputs
 | 
					### outputs
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Following outputs are available
 | 
					Following outputs are available
 | 
				
			||||||
 | 
				
			|||||||
@ -34,11 +34,13 @@ describe('getArgs', () => {
 | 
				
			|||||||
    [
 | 
					    [
 | 
				
			||||||
      '0.4.2',
 | 
					      '0.4.2',
 | 
				
			||||||
      new Map<string, string>([
 | 
					      new Map<string, string>([
 | 
				
			||||||
        // noop
 | 
					        ['build-args', 'MY_ARG=val1,val2,val3\nARG=val'],
 | 
				
			||||||
      ]),
 | 
					      ]),
 | 
				
			||||||
      [
 | 
					      [
 | 
				
			||||||
        'buildx',
 | 
					        'buildx',
 | 
				
			||||||
        'build',
 | 
					        'build',
 | 
				
			||||||
 | 
					        '--build-arg', 'MY_ARG=val1,val2,val3',
 | 
				
			||||||
 | 
					        '--build-arg', 'ARG=val',
 | 
				
			||||||
        '--iidfile', '/tmp/.docker-build-push-jest/iidfile',
 | 
					        '--iidfile', '/tmp/.docker-build-push-jest/iidfile',
 | 
				
			||||||
        '--file', 'Dockerfile',
 | 
					        '--file', 'Dockerfile',
 | 
				
			||||||
        'https://github.com/docker/build-push-action.git#test-jest'
 | 
					        'https://github.com/docker/build-push-action.git#test-jest'
 | 
				
			||||||
@ -48,11 +50,14 @@ describe('getArgs', () => {
 | 
				
			|||||||
      '0.4.2',
 | 
					      '0.4.2',
 | 
				
			||||||
      new Map<string, string>([
 | 
					      new Map<string, string>([
 | 
				
			||||||
        ['context', '.'],
 | 
					        ['context', '.'],
 | 
				
			||||||
 | 
					        ['labels', 'org.opencontainers.image.title=buildkit\norg.opencontainers.image.description=concurrent, cache-efficient, and Dockerfile-agnostic builder toolkit'],
 | 
				
			||||||
        ['outputs', 'type=local,dest=./release-out']
 | 
					        ['outputs', 'type=local,dest=./release-out']
 | 
				
			||||||
      ]),
 | 
					      ]),
 | 
				
			||||||
      [
 | 
					      [
 | 
				
			||||||
        'buildx',
 | 
					        'buildx',
 | 
				
			||||||
        'build',
 | 
					        'build',
 | 
				
			||||||
 | 
					        '--label', 'org.opencontainers.image.title=buildkit',
 | 
				
			||||||
 | 
					        '--label', 'org.opencontainers.image.description=concurrent, cache-efficient, and Dockerfile-agnostic builder toolkit',
 | 
				
			||||||
        '--output', 'type=local,dest=./release-out',
 | 
					        '--output', 'type=local,dest=./release-out',
 | 
				
			||||||
        '--file', 'Dockerfile',
 | 
					        '--file', 'Dockerfile',
 | 
				
			||||||
        '.'
 | 
					        '.'
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										4
									
								
								dist/index.js
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								dist/index.js
									
									
									
										generated
									
									
										vendored
									
									
								
							@ -14867,8 +14867,8 @@ function getInputs(defaultContext) {
 | 
				
			|||||||
        return {
 | 
					        return {
 | 
				
			||||||
            context: core.getInput('context') || defaultContext,
 | 
					            context: core.getInput('context') || defaultContext,
 | 
				
			||||||
            file: core.getInput('file') || 'Dockerfile',
 | 
					            file: core.getInput('file') || 'Dockerfile',
 | 
				
			||||||
            buildArgs: yield getInputList('build-args'),
 | 
					            buildArgs: yield getInputList('build-args', true),
 | 
				
			||||||
            labels: yield getInputList('labels'),
 | 
					            labels: yield getInputList('labels', true),
 | 
				
			||||||
            tags: yield getInputList('tags'),
 | 
					            tags: yield getInputList('tags'),
 | 
				
			||||||
            pull: /true/i.test(core.getInput('pull')),
 | 
					            pull: /true/i.test(core.getInput('pull')),
 | 
				
			||||||
            target: core.getInput('target'),
 | 
					            target: core.getInput('target'),
 | 
				
			||||||
 | 
				
			|||||||
@ -46,8 +46,8 @@ export async function getInputs(defaultContext: string): Promise<Inputs> {
 | 
				
			|||||||
  return {
 | 
					  return {
 | 
				
			||||||
    context: core.getInput('context') || defaultContext,
 | 
					    context: core.getInput('context') || defaultContext,
 | 
				
			||||||
    file: core.getInput('file') || 'Dockerfile',
 | 
					    file: core.getInput('file') || 'Dockerfile',
 | 
				
			||||||
    buildArgs: await getInputList('build-args'),
 | 
					    buildArgs: await getInputList('build-args', true),
 | 
				
			||||||
    labels: await getInputList('labels'),
 | 
					    labels: await getInputList('labels', true),
 | 
				
			||||||
    tags: await getInputList('tags'),
 | 
					    tags: await getInputList('tags'),
 | 
				
			||||||
    pull: /true/i.test(core.getInput('pull')),
 | 
					    pull: /true/i.test(core.getInput('pull')),
 | 
				
			||||||
    target: core.getInput('target'),
 | 
					    target: core.getInput('target'),
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user