Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copy with wildcard fails #3092

Open
yossicohn opened this issue Mar 28, 2024 · 10 comments
Open

Copy with wildcard fails #3092

yossicohn opened this issue Mar 28, 2024 · 10 comments
Labels
cmd/copy differs-from-docker priority/p1 Basic need feature compatibility with docker build. we should be working on this next.

Comments

@yossicohn
Copy link

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

@JeromeJu
Copy link
Collaborator

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

@JeromeJu JeromeJu added cmd/copy priority/p1 Basic need feature compatibility with docker build. we should be working on this next. differs-from-docker labels Mar 28, 2024
@yossicohn
Copy link
Author

@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

@prima101112
Copy link
Contributor

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?

@yossicohn
Copy link
Author

@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

@prima101112
Copy link
Contributor

prima101112 commented Apr 23, 2024

tested master branch with

COPY ./* ./

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

cc : @JeromeJu

@yossicohn
Copy link
Author

yossicohn commented Apr 24, 2024

@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
Copy link
Author

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

@prima101112
Copy link
Contributor

@yossicohn will check it

@prima101112
Copy link
Contributor

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 

@gmuth
Copy link

gmuth commented May 23, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cmd/copy differs-from-docker priority/p1 Basic need feature compatibility with docker build. we should be working on this next.
Projects
None yet
Development

No branches or pull requests

4 participants