GoogleContainerTools / kaniko

Build Container Images In Kubernetes
Apache License 2.0
14.74k stars 1.43k forks source link

Dockerfile in AWS Codecommit #2282

Open rikirolly opened 2 years ago

rikirolly commented 2 years ago

Does someone successfully configured kaniko with AWS Codecommit?

I failed trying in this way:

apiVersion: v1
kind: Pod
metadata:
  name: kaniko
spec:
  containers:
  - name: kaniko
    image: gcr.io/kaniko-project/executor:debug
    args: ["--verbosity=trace",
            "--dockerfile=K8sDockerfile",
            "--context=git://git-codecommit.eu-central-1.amazonaws.com/v1/repos/myrepo",
            "--destination=myregistryid.dkr.ecr.eu-central-1.amazonaws.com/myimage:latest"]
    env:
    - name: GIT_USERNAME
      value: 'myuser'
    - name: GIT_PASSWORD
      value: 'mypassword'
    - name: GIT_PULL_METHOD
      value: https
    volumeMounts:
      - name: kaniko-secret
        mountPath: /kaniko/.docker
  restartPolicy: Never
  volumes:
    - name: kaniko-secret
      secret:
        secretName: regcred
        items:
          - key: .dockerconfigjson
            path: config.json

This is the error:

DEBU[0000] Getting source context from git://git-codecommit.eu-central-1.amazonaws.com/v1/repos/myrepo 
DEBU[0000] Getting source from reference                

Counting objects: 0
Counting objects: 964
Counting objects: 964
Counting objects: 964, done.
Error: error resolving source context: reference delta not found
rikirolly commented 2 years ago

I discovered the problem is not related to git pull but probably to the information contained in my repository. Still don't know where the problem reside.

rikirolly commented 2 years ago

Probably e problem in go-git module: https://github.com/go-git/go-git/pull/111

aaron-prindle commented 1 year ago

It seems the issue you referenced was fixed in the go-git PR here: https://github.com/go-git/go-git/pull/392

kaniko adopted go-git w/ the fix PR in it in the PR here - https://github.com/GoogleContainerTools/kaniko/pull/1885 (Jan 2022)

which should have been in the v1.8.0 release in March 2022. As such I think the kaniko version you used already had the go-git fix for the issue you referenced

Perhaps there is some other issue? Are you still encountering this issue?

maragunde93 commented 1 year ago

I am facing the same issue with kaniko executor 1.9.1. Still not finding any solution

markrin commented 1 year ago

Was not able to find a way to handle this, so used a workaround: archive and push source code to s3 bucket, use s3 as context. Stupid, but works smoothly.