In the case jib-maven-plugin is used in a CI environment, it can be useful to pass the authentication credentials directly via the command line or via environment variable.
For example with Gitlab CI, it is the case that CIÂ jobs have environment variables with temporary tokens to push images to the Gitlab Registry.
Currently, it seems to me that the only way to take advantage of these is either via docker login (which means I need docker installed now) or via some hack by generating a custom settings.xml.
It would be great either to have jib-maven-plugin accept credentials via command line or to document what is the preferred way to achieve the requirement.
I guess this is similar to #116.
Just FYI, copying a working .docker/config into your CI env will also work. Jib doesn't use docker but just reads the file to get credentials. However, I think that is no different from generating a custom settings.xml, so it doesn't help in your case.
Just FYI, copying a working .docker/config into your CI env will also work. Jib doesn't use docker but just reads the file to get credentials.
That's what I had understood, maybe as a workaround there are "simpler" ways to generate the content of this file without using docker… but I suppose the information is not there in its raw form.
Could you write a simple docker credential helper script that returns the appropriate environment values? You'd configure that helper with your <to><credHelper> / to.credHelper.
@briandealwis yes, that makes total sense, thanks for the idea!
We could also consider adding auth to the image configurations for jib-maven-plugin as well (like we have in jib-gradle-plugin), so people could do:
<configuration>
<to>
<image>imagename</image>
<auth>
<username>${env.REGISTRY_USERNAME}</username>
<password>${env.REGISTRY_PASSWORD}</password>
</auth>
</to>
</configuration>
and be able to use REGISTRY_USERNAME and REGISTRY_PASSWORD environment variables as the credentials.
@coollog I had something like that in mind when I opened the issue yes. Also there should be an expression (in maven lingo) associated to each of those so that one can pass it via -Djib.to.auth.username=XXX (or something like that) too.
Thanks @TadCordle :)
No problem! Will be available when 0.9.8 releases.
@victornoel version 0.9.8 is released with these features :)
@coollog @TadCordle thanks, it works well, I just tested it.
For the record, the README wasn't updated with the new options.
Just updated it. Thanks again for your suggestions!
Most helpful comment
We could also consider adding
authto the image configurations forjib-maven-pluginas well (like we have injib-gradle-plugin), so people could do:and be able to use
REGISTRY_USERNAMEandREGISTRY_PASSWORDenvironment variables as the credentials.