Using Kaniko for building image in concourse CI

I am exploring the new option of building an image with Kaniko. I got success.

This was required because, we have private repos that we need to fetch in Dockerfile, and concourse vito/oci-build-image does not support.
I used:

  1. Custom image which had Kaniko, gcloud installed. Used this image and image_resource in task config.
  2. Developed shell script, which executes kaniko for generating image.tar file which was successful.

The issue is that if I have multiple jobs then only one task finishes successfully, Rest is failing because it uses the same volumes and other resources which does not allow me to execute the same command multiple times in different jobs.

Do we have the solution for this. Also, I noticed that we can not pass entrypoint parameter with image_resource so we can use kaniko provided image for the building an oci image.

The concourse team really needs to work on this. Like in GitLab, we can provide an entrypoint along with an image config.

Refer: Using Docker images | GitLab

Thanks,

Krunal Patel.

The issue is that if I have multiple jobs then only one task finishes successfully, Rest is failing because it uses the same volumes and other resources which does not allow me to execute the same command multiple times in different jobs.

I’m not entirely sure what you mean here? Do you have multiple jobs that you want to use the same volumes? Concourse only allows sharing of volumes between steps in a single job, if you really want to split these into separate jobs you will need to “externalise” the volumes into something like S3 or GCS.

Do we have the solution for this. Also, I noticed that we can not pass entrypoint parameter with image_resource so we can use kaniko provided image for the building an oci image.

Concourse does not use the entrypoint - the task.command completely overrides the entrypoint and command so just supply the path to the thing you want to run.

we have private repos that we need to fetch in Dockerfile, and concourse vito/oci-build-image does not support.

@vito actually just fixed this the other day so you could update to use oci-build-task if you wanted https://github.com/vito/oci-build-task/issues/14#issuecomment-757014837