I am using Jx and Kaniko executor in the pipeline. I need dynamically create repository in the ECR if it does not exists, is it possible to do that with kaniko executor. The issue is not related to jenkinsx, I am wondering if I can just somehow tell executor to use instance role permissions and create the repository dynamically.
pipelineConfig:
pipelines:
pullRequest:
pipeline:
agent:
image: gcr.io/kaniko-project/executor
stages:
- name: build-and-push
options:
volumes:
- name: docker-config
secret:
secretName: jenkins-docker-cfg
containerOptions:
volumeMounts:
- name: docker-config
mountPath: /kaniko/.docker/
parallel:
- name: batch-2
steps:
- name: container-build
command: /kaniko/executor
args:
- --dockerfile=/workspace/source/microservices/microservice1/Dockerfile
- --destination=xxxx.dkr.ecr.xxx.amazonaws.com/repo/microservices/microservice1:${inputs.params.version}
- --context=/workspace/source
Getting error:
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 "XXX.dkr.ecr.xxxx.amazonaws.com/repo/microservices/microservice1:0.0.0-SNAPSHOT-PR-5-56": NAME_UNKNOWN: The repository with name 'repo/microservices/microservice1' does not exist in the registry with id 'XXXX'
@valdestron The current team does not expertise for ECR. Would love to see any contributions!
@ryan-gerstenkorn-sp any plans to continue #1314?
One possible work around would be to use an init container to check if the repo exists and then create it if not.
Would love to see this implemented!
I would like to contribute to this, as it affects JenkinsX v3 (in v2, we had some custom code to create the repository if it does not exist). While we could add custom logic to the jx v3 codebase, it seems like a duplication if it's fixed here.
@ryan-gerstenkorn-sp are u still working on this?
Most helpful comment
I would like to contribute to this, as it affects JenkinsX v3 (in v2, we had some custom code to create the repository if it does not exist). While we could add custom logic to the jx v3 codebase, it seems like a duplication if it's fixed here.
@ryan-gerstenkorn-sp are u still working on this?