首页 > 解决方案 > 带有裸本地存储库的 Spring-Cloud-Config

问题描述

我需要在无法访问配置 git-repo 的环境中使用 spring-cloud-config-server。

我们设置了一个 Jenkins 作业,它将git clone --mirror存储库镜像 () 到 cloud-config-server (/opt/foo.git),现在我想将其用作源。

我的第一个想法是使用

uri: file://opt/foo.git

但这失败了

"java.lang.IllegalStateException: No .git at file://opt/foo.git

将裸仓库移动到子文件夹 .git 也不起作用。所以我做了一些研究,spring-cloud-config 服务器似乎对所有带file:前缀的 url 进行了特殊处理,这可以防止克隆这个存储库。

我目前的解决方法是创建一个新的本地存储库/opt/foo2,它具有/opt/foo.git远程。

来自 spring-cloud-config-server 的任何调用现在都可以访问/opt/foo2,如果存在任何更新,则会更新/opt/foo.git本地存储库。好用,但感觉有点脏……

您是否看到此用例的任何其他选项不涉及让本地 Web 服务器为 git 镜像提供服务?;)

标签: spring-cloud-config

解决方案


推荐阅读