pipeline: Using Kaniko catalog with ECR does not seem to work

So, I am trying to upload docker images to AWS ECR, I’ve added the IAM bindings to the EKS policy.

The problem is, with a PipelineRun I see no way to tell the Kaniko task how to set the environment variable as mentioned by the Kaniko developers for their container:

You can use instance roles when pushing to ECR from a EC2 instance or from EKS, by configuring the instance role permissions (the AWS managed policy EC2InstanceProfileForImageBuilderECRContainerBuilds provides broad permissions to upload ECR images and may be used as configuration baseline). Additionally, set AWS_SDK_LOAD_CONFIG=true as environment variable within the kaniko pod

So.

Given this command line as an example to test my Pipeline:

tkn pipeline start clone-build-pipeline --param image=XXXXXXXXX.dkr.ecr.us-west-2.amazonaws.com/myapp-dev00/test/app --param url=https://github.com/MyCompany/myApp --param revision=develop --param verbose=true --param imageTag=0.0.0 --workspace name=shared-workspace,claimName=tekton-build-pvc --workspace name=git-config,secret=github-access-token --workspace name=ecr-config,config=docker-config,item=config.json=1 --showlog

Error:

[build-push-image : build-and-push] error checking push permissions – make sure you entered the correct tag name, and that you are authenticated correctly, and try again: checking push permission for “XXXXXXXXX.dkr.ecr.us-west-2.amazonaws.com/myapp-dev00/test/app:0.0.0”: Post “https://XXXXXXXXX.dkr.ecr.us-west-2.amazonaws.com/v2/myapp-dev00/test/app/blobs/uploads/”: EOF

So how do I set AWS_SDK_LOAD_CONFIG=true to the task from the pipeline/run?

Thanks!

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 16 (1 by maintainers)

Most upvoted comments

@spstarr The bad news is that today you can’t using the stock kaniko task today. The good news are:

  • you can create your own copy of the kaniko task which sets AWS_SDK_LOAD_CONFIG (based on the an input parameter if you wish)
  • we have folks working on addressing this, see TEP-101 Env in Pod Template

Feel free to chime in the discussion on the TEP if you’d like, yours is definitely a good use case for adding the ability of passing env variables through in some way, since I would not want to change the catalog kaniko task to support every possible cloud vendor specific environment variable, but still I would like everyone to be able to use the stock kaniko task without having to create their own version of it.