GoogleContainerTools / kaniko

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

Azure Blob Storage Context invalid path #3044

Open herveleclerc opened 4 months ago

herveleclerc commented 4 months ago

It seems that the path to get the context is wrong when using azure blob storage container

ex :

apiVersion: v1
kind: Pod
metadata:
  name: kaniko
spec:
  containers:
  - name: kaniko
    image: gcr.io/kaniko-project/executor:latest
    args: ["--dockerfile=./Dockerfile",
            "--context=https://kanikoi0skbb6wot.blob.core.windows.net/kaniko/context.tar.gz",
            "--destination=herveleclerc/kaniko-hello:0.0.1", "--verbosity=trace"]
    volumeMounts:
    - name: kaniko-secret
      mountPath: /kaniko/.docker
    env:
    - name: AZURE_STORAGE_ACCESS_KEY
      valueFrom:
        secretKeyRef:
          name: azure-storage-access-key
          key: azure-storage-access-key
  volumes:
  - name: azure-storage-access-key
    secret:
      secretName: azure-storage-access-key
  - name: kaniko-secret
    secret:
      secretName: dockerhub
      items:
      - key: .dockerconfigjson
        path: config.json

generate this error log

k logs kaniko
DEBU[0000] Getting source context from https://kanikoi0skbb6wot.blob.core.windows.net/kaniko/context.tar.gz
DEBU[0000] BaseDir /kaniko/buildcontext for file /kaniko/buildcontext/context.tar.gz does not exist. Creating.
Error: error resolving source context: HEAD https://kanikoi0skbb6wot.blob.core.windows.net/kaniko/context.tar.gz/kaniko/context.tar.gz
--------------------------------------------------------------------------------
RESPONSE 404: 404 The specified blob does not exist.
ERROR CODE: BlobNotFound
--------------------------------------------------------------------------------
Response contained no body
--------------------------------------------------------------------------------

the path name is in double

herveleclerc commented 4 months ago

Just tested with gcr.io/kaniko-project/executor:v1.19.2 - it works with this tag

dauqu commented 3 months ago

I also faced the same issue when I used Azure Blob storage before.

JeromeJu commented 3 months ago

Thanks @herveleclerc for the issue, would you mind providing the kaniko version you ran into the original issue filed?

herveleclerc commented 3 months ago

1.20.0 and 1.21.0 - I will re-test with 1.21.1

JeromeJu commented 3 months ago

1.20.0 and 1.21.0 - I will re-test with 1.21.1

Thanks for the replies - this indicates that we are having a regression; added to our regression backlogs.

herveleclerc commented 3 months ago

tested on 1.21.1 - I have the same error ❯ k logs kaniko Error: error resolving source context: HEAD https://xxxxxxx.blob.core.windows.net/kaniko-container/context.tar.gz/kaniko-container/context.tar.gz

RESPONSE 404: 404 The specified blob does not exist. ERROR CODE: BlobNotFound

Response contained no body