kaniko icon indicating copy to clipboard operation
kaniko copied to clipboard

Copy with wildcard fails

Open yossicohn opened this issue 1 year ago • 10 comments

Actual behavior Does not COPY or fails Tested with KANIKO 1.22 still a bug both will fail: COPY ./* ./ or COPY ./*.json ./

Expected behavior Copy all Files as defined by the wildcard btw, COPY ./ ./ used to work once

To Reproduce Steps to reproduce the behavior:

  1. Docker file with COPY ./* ./ or COPY ./*.json ./
  2. content of files in the context

Additional Information This is painful bug

yossicohn avatar Mar 28 '24 14:03 yossicohn

Thanks for filing the bug @yossicohn ; could you specify the version of kaniko you're using and which release is the workable one?

JeromeJu avatar Mar 28 '24 18:03 JeromeJu

@JeromeJu the latest I know of working is v1.12.0, in the process of upgrade to the latest I got all the issues of the COPY I mentioned above

yossicohn avatar Mar 28 '24 18:03 yossicohn

Hi @yossicohn could you provide whats is the error or the behavior in your case? is it file not found, is it error or something else?

prima101112 avatar Apr 02 '24 08:04 prima101112

@prima101112 Examples and most painful COPY . . I get no error, but it does not copy anything vs. the original behavior of copying all the context files.

if I do COPY ./ssh/* ./ssh I get an error {"level":"info","msg":"Resolving srcs [.ssh/*]...","time":"2024-04-02T08:40:22Z"} error building image: error building stage: failed to get files used from context: copy failed: no source files specified

Same for other wildcards usages like *.json etc. btw, the following does work COPY ./ssh ./ssh

yossicohn avatar Apr 02 '24 08:04 yossicohn

tested master branch with

COPY ./* ./

its copy all files. but dunno with COPY ./ ./ is the docker behavior will copy all files?

cc : @JeromeJu

prima101112 avatar Apr 23 '24 03:04 prima101112

@prima101112 as far as I can see the copied content via COPY ./* ./ is not really working, as it is not available. I tried it and the Folders are not available, cd into the folders fails

drwxrwxrwx    1 root     root            31 Apr 24 06:52 .
drwxr-xr-x    1 root     root            40 Apr 24 06:53 ..
lrwxrwxrwx    1 root     root            51 Apr 24 06:52 myfolder -> .worktrees/e15ba753ddeafecc38225a329b90f69a9ef70545
# cd myfolder
/bin/sh: cd: can't cd to myfolder: No such file or directory

Regarding COPY ./ ./ or COPY ./ssh/* ./ssh or COPY ./*.json ./ all these are not working as for v1.22 and are very needed behavior and feature

Can you recheck this?

yossicohn avatar Apr 24 '24 06:04 yossicohn

@prima101112 hi, FYI I've just tested the version v1.23.0 and the issues describes still persist

yossicohn avatar May 15 '24 10:05 yossicohn

@yossicohn will check it

prima101112 avatar May 17 '24 04:05 prima101112

Hi @yossicohn just try and test using latest 1.23 and its work fine

INFO[0004] Initializing snapshotter ...                 
INFO[0004] Taking snapshot of full filesystem...        
INFO[0004] Cmd: /bin/sh                                 
INFO[0004] Args: [-c mkdir -p /etc/ssh/testfolder]      
INFO[0004] Running: [/bin/sh -c mkdir -p /etc/ssh/testfolder] 
INFO[0004] Taking snapshot of full filesystem...        
INFO[0004] WORKDIR /app                                 
INFO[0004] Cmd: workdir                                 
INFO[0004] Changed working directory to /app            
INFO[0004] Creating directory /app with uid -1 and gid -1 
INFO[0004] Taking snapshot of files...                  
INFO[0004] COPY . .                                     
INFO[0004] Taking snapshot of files...                  
INFO[0004] RUN ls /app                                  
INFO[0004] Cmd: /bin/sh                                 
INFO[0004] Args: [-c ls /app]                           
INFO[0004] Running: [/bin/sh -c ls /app]                
Dockerfile
config.json
howtorun.txt
known
INFO[0004] Taking snapshot of full filesystem...        
INFO[0004] No files were changed, appending empty layer to config. No layer added to image. 
INFO[0004] Skipping push to container registry due to --no-push flag 

prima101112 avatar May 21 '24 15:05 prima101112

I got similar error but related to --from. Issue seems that kaniko does not support fully qualified image names including registry. adding FROM as bla and then use COPY --from=bla enabled me to use wildcards.

gmuth avatar May 23 '24 11:05 gmuth

Wildcard in copy still seems to fail, even in the latest version

INFO[0008] COPY ../package.json ./                                            
INFO[0008] Taking snapshot of files...                  
INFO[0008] Resolving srcs [../*-lock.json]...           
WARN[0008] No files to copy                             
INFO[0008] COPY ../*-lock.json ./                       
INFO[0008] Resolving srcs [../*-lock.json]...                                    
INFO[0008] Taking snapshot of full filesystem...        
INFO[0009] No files were changed, appending empty layer to config. No layer added to image. 
INFO[0009] RUN ls -la                                   
INFO[0009] Cmd: /bin/sh                                 
INFO[0009] Args: [-c ls -la]                            
INFO[0009] Running: [/bin/sh -c ls -la]                 
total 12
drwxr-xr-x    2 root     root          4096 Nov  1 17:17 .
drwxr-xr-x    1 root     root          4096 Nov  1 17:17 ..
-rw-r--r--    1 root     root          1042 Nov  1 17:17 package.json

SamuZad avatar Nov 01 '24 17:11 SamuZad