fix: promote registry image-repo-template to app + global
The registry plugin accepted `registry:set <app> image-repo-template <value>` and persisted the per-app file, but only ever read the global value when rendering the image repository, so per-app overrides were silently dropped. The property now follows the same per-app to global to default fallback chain used by `push-on-release` and `server`, and `registry:report` exposes the raw per-app value alongside the existing global and computed flags. The `push-extra-tags` report flags were extended for the same reason: the runtime already honored per-app and global values, but the report only surfaced the raw per-app entry.
This commit is contained in:
@@ -23,6 +23,8 @@ func ReportSingleApp(appName string, format string, infoFlag string) error {
|
||||
"--registry-global-server": reportGlobalServer,
|
||||
"--registry-computed-image-repo-template": reportComputedImageRepoTemplate,
|
||||
"--registry-global-image-repo-template": reportGlobalImageRepoTemplate,
|
||||
"--registry-computed-push-extra-tags": reportComputedPushExtraTags,
|
||||
"--registry-global-push-extra-tags": reportGlobalPushExtraTags,
|
||||
}
|
||||
} else {
|
||||
flags = map[string]common.ReportFunc{
|
||||
@@ -35,9 +37,12 @@ func ReportSingleApp(appName string, format string, infoFlag string) error {
|
||||
"--registry-global-server": reportGlobalServer,
|
||||
"--registry-computed-image-repo-template": reportComputedImageRepoTemplate,
|
||||
"--registry-global-image-repo-template": reportGlobalImageRepoTemplate,
|
||||
"--registry-image-repo-template": reportImageRepoTemplate,
|
||||
"--registry-server": reportServer,
|
||||
"--registry-tag-version": reportTagVersion,
|
||||
"--registry-push-extra-tags": reportPushExtraTags,
|
||||
"--registry-global-push-extra-tags": reportGlobalPushExtraTags,
|
||||
"--registry-computed-push-extra-tags": reportComputedPushExtraTags,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,12 +101,20 @@ func reportComputedServer(appName string) string {
|
||||
return strings.TrimSpace(server)
|
||||
}
|
||||
|
||||
func reportImageRepoTemplate(appName string) string {
|
||||
return common.PropertyGet("registry", appName, "image-repo-template")
|
||||
}
|
||||
|
||||
func reportGlobalImageRepoTemplate(appName string) string {
|
||||
return common.PropertyGet("registry", "--global", "image-repo-template")
|
||||
}
|
||||
|
||||
func reportComputedImageRepoTemplate(appName string) string {
|
||||
return reportGlobalImageRepoTemplate(appName)
|
||||
value := strings.TrimSpace(reportImageRepoTemplate(appName))
|
||||
if value == "" {
|
||||
value = reportGlobalImageRepoTemplate(appName)
|
||||
}
|
||||
return value
|
||||
}
|
||||
|
||||
func reportGlobalServer(appName string) string {
|
||||
@@ -120,3 +133,18 @@ func reportTagVersion(appName string) string {
|
||||
func reportPushExtraTags(appName string) string {
|
||||
return common.PropertyGet("registry", appName, "push-extra-tags")
|
||||
}
|
||||
|
||||
func reportGlobalPushExtraTags(appName string) string {
|
||||
return common.PropertyGet("registry", "--global", "push-extra-tags")
|
||||
}
|
||||
|
||||
func reportComputedPushExtraTags(appName string) string {
|
||||
value := strings.TrimSpace(reportPushExtraTags(appName))
|
||||
if value == "" {
|
||||
value = reportGlobalPushExtraTags(appName)
|
||||
}
|
||||
if value == "" {
|
||||
value = DefaultProperties["push-extra-tags"]
|
||||
}
|
||||
return value
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user