kaniko icon indicating copy to clipboard operation
kaniko copied to clipboard

--label argument does not support strings with spaces

Open zanechua opened this issue 5 years ago • 8 comments

Actual behavior Use --label="test string" and builds fail

Expected behavior Build proceeds normally

To Reproduce Steps to reproduce the behavior:

  1. Add --label="test string" to as an argument

zanechua avatar May 05 '20 12:05 zanechua

Hey @zanechua label argument expects key=value format

--label key=value

Could you share your fail message it might be because of that

ffahri avatar May 18 '20 15:05 ffahri

/kaniko/executor --context /builds/app/backend --dockerfile /builds/app/backend/Dockerfile --label com.gitlab.ci.user='Zane J. Chua'
Error: unknown command "J." for "executor"

zanechua avatar May 19 '20 10:05 zanechua

I experience the same issue. @zanechua did you find a workaround?

nikilp avatar Aug 01 '20 13:08 nikilp

Hi! Any updates ? I'm having the same issue.

ishfx avatar May 26 '21 15:05 ishfx

I fail to reproduce this:

$ echo 'FROM scratch' > Dockerfile
$ docker run -it --rm \
>   -v $(pwd):/app \
>   -v /var/run/docker.sock:/var/run/docker.sock \
>   --workdir /app \
>   gcr.io/kaniko-project/executor \
>     --tarPath /app/image.tar \
>     --destination=test \
>     --no-push \
>     --label com.gitlab.ci.user="Zane J. Chua"
INFO[0000] No base image, nothing to extract            
INFO[0000] Built cross stage deps: map[]                
INFO[0000] No base image, nothing to extract            
INFO[0000] Executing 0 build triggers                   
INFO[0000] Skipping unpacking as no commands require it. 
INFO[0000] Skipping push to container registry due to --no-push flag 

$ tar xvf image.tar "sha256:*"
x sha256:d0e7ffca64af8ab82c7bd367e65ffd2096872f12fa2c869dd1a601ba71938251

$ cat sha256:d0e7ffca64af8ab82c7bd367e65ffd2096872f12fa2c869dd1a601ba71938251 |jq -r '.config.Labels."com.gitlab.ci.user"'
Zane J. Chua

Any idea how this test differs from the issue the users issue ?

smaftoul avatar Nov 25 '21 22:11 smaftoul

Maybe someone faced similar issue like this:

Error: unknown command " --label 'key'='value'" for "executor"

I solved this issue by passing --label flag right after --context flag:

/kaniko/executor --cache=${IMAGE_CACHE} --context ${CONTEXT} ${LABELS} ${BUILD_ARGS}...

Gainutdinov avatar Jan 31 '23 10:01 Gainutdinov

Any idea how this test differs from the issue the users issue ?

On my end it also works with the --no-push option, but only when pushing to somewhere the error occurs.

Malonsow avatar Apr 26 '23 08:04 Malonsow

I experience the same issue.

It is related to https://github.com/GoogleContainerTools/kaniko/issues/1803 but there's a twist: spaces are not a problem, also . characters are not a problem in my case. However, an odd number of ' (single quote) characters in the label value results in an error:

unexpected end of statement while looking for matching single-quote

Just as in https://github.com/GoogleContainerTools/kaniko/issues/1803, the error only appears when --cache is enabled.

tverbeiren avatar Sep 24 '24 13:09 tverbeiren