问题
I'm currently developing Quarkus applications and need therefore a CI Pipeline + Container Registry.
As containerization through docker isn't working (docker daemon - priviliged mode) I want to use Jib, which is already supported by Quarkus.
Command in Pipeline:
- mvn clean package
-Dquarkus.container-image.push=true
-Dquarkus.container-image.registry="https://$registry"
-Dquarkus.container-image.username=$username
-Dquarkus.container-image.password=$deployToken
-Dquarkus.container-image.name=(group)/(project)
- username = deploy token username
- password = deploy token
The deploy token has all permissions there are, so that should not be the problem.
I also tried different variants of the command where I added the token in the registry url:
- https://username:token@registry.gitlab.com(group)/(project)
- https://name:token@registry.gitlab.com(group)/(project)
but in those cases obvious without these params:
- Dquarkus.container-image.username=$username
- Dquarkus.container-image.password=$deployToken
But I got everytime the same respone:
Failed to execute goal io.quarkus:quarkus-maven-plugin:1.7.2.Final:build (default) on project (project):
Failed to build quarkus application: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[ERROR] [error]: Build step io.quarkus.container.image.jib.deployment.JibProcessor#buildFromJar threw an exception: java.lang.IllegalArgumentException:
The supplied container-image registry 'https://registry.gitlab.com/(group)/(project)' is invalid
I really hope that somebody has an idea, what is going wrong here.
In an other project I also used Jib to containerize a spring boot application and push it to the Google Container Registry, which is working when I use the Google SDK in advance.
- gcloud auth activate-service-account (account-name) --key-file=$gsdk_token
- gcloud auth configure-docker
Is there maybe a similar approach possible for the Gitlab Registry?
回答1:
The error is thrown by this code based on this check. The "registry" string should in the form of, say,
some.registry.host.example.com[:optional_port]
Therefore, in your case, it should be
-Dquarkus.container-image.registry=registry.gitlab.com
And I also noticed that Quarkus once enforced a very rigid format for an image reference (which I don't know is resolved as of now); you'll need to consult the Quarkus plugin doc to see how you can properly format the final image reference.
Also see these other Quarkus issues:
- https://github.com/quarkusio/quarkus/issues/8588
- https://github.com/quarkusio/quarkus/issues/8117
Bonus for Jib users:
It is great that Quarkus internally utilizes the Jib Core library (the same library that powers the Jib Maven/Gradle build plugins) to build a container image. But for those interested, the Jib build plugins also have Jib Quarkus extensions (Maven/Gradle) that directly containerize Quarkus apps.
来源:https://stackoverflow.com/questions/63813368/can-t-push-to-gitlab-registry-quarkus-jib-build