GoogleContainerTools / kaniko

Build Container Images In Kubernetes
Apache License 2.0
14.23k stars 1.4k forks source link

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

Open abitrolly opened 2 weeks ago

abitrolly commented 2 weeks ago

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

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**
 <!-- 🎉🎉🎉 Thank you for an opening an issue !!! 🎉🎉🎉
We are doing our best to get to this. Please help us by helping us prioritize your issue by filling the section below -->

 | **Description** | **Yes/No** |
 |----------------|---------------|
 | Please check if this a new feature you are proposing        | <ul><li>- [ ] </li></ul>|
 | Please check if the build works in docker but not in kaniko | <ul><li>- [x] </li></ul>| 
 | Please check if this error is seen when you use `--cache` flag | <ul><li>- [-] </li></ul>|
 | Please check if your dockerfile is a multistage dockerfile | <ul><li>- [-] </li></ul>| 
abitrolly commented 2 weeks ago

@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.