kaniko icon indicating copy to clipboard operation
kaniko copied to clipboard

`kaniko` doesn't fail when context path does not exist

Open abitrolly opened this issue 1 year ago • 1 comments

Actual behavior

Passing invalid context dir doesn't make kaniko fail.

> gcr.io/kaniko-project/executor --no-push --context something -v debug
DEBU[0000] Copying file /workdir/Dockerfile to /kaniko/Dockerfile 
DEBU[0000] Skip resolving path /kaniko/Dockerfile       
DEBU[0000] Resolved relative path something to /workdir/something 
DEBU[0000] Skip resolving path /cache                   
DEBU[0000] Skip resolving path                          
DEBU[0000] Skip resolving path                          
DEBU[0000] Skip resolving path                          
DEBU[0000] Skip resolving path                          
DEBU[0000] Built stage name to index map: map[]         
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] Building stage 'scratch' [idx: '0', base-idx: '-1'] 
INFO[0000] Skipping unpacking as no commands require it. 
INFO[0000] ENV amg="root"                               
DEBU[0000] Build: skipping snapshot for [ENV amg="root"] 
DEBU[0000] Mapping stage idx 0 to digest sha256:f7fe2f771f2ed6847e71975dc037e9f5dcad1efcbb3257a4ef97030919e803a5 
DEBU[0000] Mapping digest sha256:f7fe2f771f2ed6847e71975dc037e9f5dcad1efcbb3257a4ef97030919e803a5 to cachekey  
INFO[0000] Skipping push to container registry due to --no-push flag

The /workdir/something does not exist.

$ ls -la
total 4
drwxr-xr-x.  4 anatoli anatoli 100 Jun 13 12:53 .
drwxrwxrwt. 25 root    root    700 Jun 13 13:04 ..
drwxr-xr-x.  2 anatoli anatoli  60 Jun 13 12:34 child
-rw-r--r--.  1 anatoli anatoli  29 Jun 13 12:34 Dockerfile
drwxr-xr-x.  2 anatoli anatoli  40 Jun 13 12:53 nothing    

Expected behavior A clear and concise description of what you expected to happen.

To Reproduce Steps to reproduce the behavior:

  1. ...
  2. ...

Additional Information

  • Dockerfile
FROM scratch

ENV amg="root"
  • Build Context
  • Kaniko Image (fully qualified with digest)
gcr.io/kaniko-project/executor                   latest        8e981b24e935  7 days ago    71.9 MB

Triage Notes for the Maintainers

Description Yes/No
Please check if this a new feature you are proposing
  • - [ ]
Please check if the build works in docker but not in kaniko
  • - [x]
Please check if this error is seen when you use --cache flag
  • - [-]
Please check if your dockerfile is a multistage dockerfile
  • - [-]

abitrolly avatar Jun 13 '24 10:06 abitrolly

@aaron-prindle hi. I saw you've added roadmap with GitLab CI support https://github.com/GoogleContainerTools/kaniko/blob/main/ROADMAP.md#q1--q2-2024

Who is the DRI for this feature to add some gitlab-ci-support label to this issue? Because it is harder to debug missing context in CI jobs than in.. well, I use with GitLab CI and expected kaniko to fail much earlier in this case.

abitrolly avatar Jun 15 '24 07:06 abitrolly