Is there anyone here who can share experiences related to pushing images to Google Artifact Registry with Jenkins Pipeline?
Previously I have successfully pushed images to Google Container Registry through Jenkins pipeline as below:
Have you tried modifying just slightly your script to push to Google Container Registry?
I think most of your instructions are still valid, right?
You have to find your region, but something like docker push us-central1-docker.pkg.dev/PROJECT/quickstart-docker-repo/quickstart-image:tag1 should work.
withDockerRegistry([credentialsId: "gcr:${PROJECT}", url: "https://LOCATION-docker.pkg.dev/${PROJECT}/${REPOSITORY}"]) {
sh 'docker tag ${IMAGE_NAME}:${IMAGE_TAG} LOCATION-docker.pkg.dev/${PROJECT}/${REPOSITORY}/${IMAGE_NAME}:${IMAGE_TAG}'
sh 'docker push LOCATION-docker.pkg.dev/${PROJECT}/${REPOSITORY}/${IMAGE_NAME}:${IMAGE_TAG}'
}
LOCATION : The location of your Artifact Registry repository (e.g., asia , europe , us , etc.).
I actually thought of that approach but I was a bit hesitant to do it, because I read in one of the articles that it uses the Google Container Registry Auth plugin. The Article
I’m not sure if Google Container Registry Auth plugin can also be used for Artifact Registry in the future because there is no complete documentation related to the plugin on github. Github Documentation
Thank you very much for the suggestion really appreciate it. I will try it first to see the result.
I tried using the Google Container Registry Auth plugin to push images to the Artifact Registry, and it didn’t work.
Fortunately, I found another way to use Docker Login Authentication and it worked.
I created Service Account for Artifact Registry and grant it Artifact Registry Writer IAM Roles. And then i created Service Account JSON Key. I upload the JSON Key into Jenkins Manage Credentials as Secret File. And then i use it as Credential for connect to My Artifact Registry