quarkusio / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
13.62k stars 2.64k forks source link

Jib extension: read docker credentials from Maven settings.xml #20480

Open rquinio1A opened 2 years ago

rquinio1A commented 2 years ago

Description

As a follow-up to #8282, and in the context of using a private docker registry that doesn't allow anonymous pulls, jib-maven-plugin also has the ability to read docker credentials from Maven settings.xml. It's a technique also used in fabric8-docker-plugin (https://dmp.fabric8.io/#authentication)

It seems a nice way to bridge Maven and Docker: you don't need to care that behind the scene Quarkus & Jib may use the docker CLI and requires in advance a "docker login" or credential store setup. Passing -Dquarkus.jib.base-registry-password -Dquarkus.jib.base-registry-username on any mvn execution is also possible but it's a bit cumbersome, whereas a centralized place to manage credentials used by the Maven builds is more convenient, both in local and in the CI pipelines.

Implementation ideas

Reuse or inspire from https://github.com/GoogleContainerTools/jib/blob/master/jib-maven-plugin/src/main/java/com/google/cloud/tools/jib/maven/MavenSettingsServerCredentials.java

Not exactly sure how quarkus-bootstrap-maven-resolver would pass the info to quarkus-container-image-jib extension (which shouldn't depend on Maven) - a new BootstrapCredentialBuildItem maybe ?

quarkus-bot[bot] commented 2 years ago

/cc @geoand, @quarkusio/devtools