无法推送到 Gitlab 注册表 | Quarkus - 悬臂构建
Can’t push to Gitlab registry | Quarkus - Jib build
我目前正在开发 Quarkus 应用程序,因此需要 CI 管道 + 容器注册表。
由于通过 docker 进行的容器化无法正常工作(docker 守护进程 - 特权模式)我想使用 Quarkus 已经支持的 Jib。
管道中的命令:
- 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)
- 用户名=部署令牌用户名
- 密码=部署令牌
部署令牌拥有所有权限,所以这应该不是问题。
我还尝试了在注册表中添加令牌的命令的不同变体 url:
- https://用户名:token@registry.gitlab.com(组)/(项目)
- https://name:token@registry.gitlab.com(组)/(项目)
但在没有这些参数的情况下很明显:
- Dquarkus.container-image.username=$用户名
- Dquarkus.container-image.password=$deployToken
但我每次都得到相同的回复:
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
我真的希望有人知道这里出了什么问题。
在另一个项目中,我还使用 Jib 将 spring 引导应用程序容器化并将其推送到 Google 容器注册表,当我在中使用 Google SDK 时,它正在工作提前。
- gcloud auth activate-service-account (account-name) --key-file=$gsdk_token
- gcloud auth configure-docker
Gitlab Registry 是否有类似的方法?
错误由 this code based on this check 抛出。 “注册表”字符串的形式应该是
some.registry.host.example.com[:optional_port]
因此,您的情况应该是
-Dquarkus.container-image.registry=registry.gitlab.com
而且我还注意到 Quarkus 曾经强制执行 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 以查看如何正确格式化最终图像参考。
另请参阅这些其他 Quarkus 问题:
Jib 用户的奖励:
Quarkus 内部利用直接容器化 Quarkus 应用程序的 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) 很棒。
我目前正在开发 Quarkus 应用程序,因此需要 CI 管道 + 容器注册表。
由于通过 docker 进行的容器化无法正常工作(docker 守护进程 - 特权模式)我想使用 Quarkus 已经支持的 Jib。
管道中的命令:
- 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)
- 用户名=部署令牌用户名
- 密码=部署令牌
部署令牌拥有所有权限,所以这应该不是问题。
我还尝试了在注册表中添加令牌的命令的不同变体 url:
- https://用户名:token@registry.gitlab.com(组)/(项目)
- https://name:token@registry.gitlab.com(组)/(项目)
但在没有这些参数的情况下很明显:
- Dquarkus.container-image.username=$用户名
- Dquarkus.container-image.password=$deployToken
但我每次都得到相同的回复:
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
我真的希望有人知道这里出了什么问题。
在另一个项目中,我还使用 Jib 将 spring 引导应用程序容器化并将其推送到 Google 容器注册表,当我在中使用 Google SDK 时,它正在工作提前。
- gcloud auth activate-service-account (account-name) --key-file=$gsdk_token
- gcloud auth configure-docker
Gitlab Registry 是否有类似的方法?
错误由 this code based on this check 抛出。 “注册表”字符串的形式应该是
some.registry.host.example.com[:optional_port]
因此,您的情况应该是
-Dquarkus.container-image.registry=registry.gitlab.com
而且我还注意到 Quarkus 曾经强制执行 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 以查看如何正确格式化最终图像参考。
另请参阅这些其他 Quarkus 问题:
Jib 用户的奖励:
Quarkus 内部利用直接容器化 Quarkus 应用程序的 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) 很棒。