-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
在 Docker 镜像中添加获取上游地址的方式 #40
Comments
或者设置一个 exec command 也行,比 jinja 更灵活 |
最好有办法限制这个属性只能做纯计算,否则感觉会有点危险。 |
不会危险啊,命令都是在容器里执行的,主机不传入任何信息,只调 |
可以先看看 go 标准库里的 template https://pkg.go.dev/text/template 能不能满足? |
现有代码里面最复杂的应该就是 rclone 了: case "rclone":
remoteType := envs["RCLONE_CONFIG_REMOTE_TYPE"]
path := envs["RCLONE_PATH"]
domain := ""
if remoteType == "swift" {
domain = envs["RCLONE_SWIFT_STORAGE_URL"] + "/"
} else if remoteType == "http" {
domain = envs["RCLONE_CONFIG_REMOTE_URL"]
} else if remoteType == "s3" {
domain = envs["RCLONE_CONFIG_REMOTE_ENDPOINT"]
}
return fmt.Sprintf("%s%s", domain, path) 以及 yumsync 现在没有很好的办法显示「漂亮的」上游,例如 envs:
YUMSYNC_DISTS: 6-7|kubernetes,minikube|x86_64,aarch64,armhfp,ppc64le,s390x,i386|@{comp}-el@{os_ver}-@{arch}|/yum/repos/@{comp}-el@{os_ver}-@{arch}
YUMSYNC_URL: https://packages.cloud.google.com/yum/repos/@{comp}-el@{os_ver}-@{arch}
$UPSTREAM: https://packages.cloud.google.com/yum/ 如果直接取 |
这些需求应该都可以通过自定义的 funcMap https://pkg.go.dev/text/template#example-Template-Func 来实现 |
我觉得不如给容器定义一个标准,比如容器内提供一个 |
我重新想了下,我们的目标应该是把输出上游地址的逻辑维护在每个镜像里,而不需要改动 yukid,同时能让 yukid 比较方便地获取这个地址。 目前看下来有两种办法
我目前比较倾向于第二种,因为同步脚本本来也要知道上游地址,让它来输出上游地址我觉得是比较自然的。 |
经过 #43 重构后,现在 yukid 也支持读取环境变量里的 |
避免添加新镜像后再手动更新
pkg/core/meta.go
。八月份讨论的时候 @gaoyifan 提出的一个可能的实现方式:
The text was updated successfully, but these errors were encountered: