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:
Jose Diaz-Gonzalez
2026-05-27 03:23:14 -04:00
parent fd9e06d56b
commit bc5acce55e
5 changed files with 186 additions and 16 deletions

View File

@@ -63,7 +63,10 @@ func GetDockerConfigArgs(appName string) []string {
}
func getImageRepoFromTemplate(appName string) (string, error) {
imageRepoTemplate := common.PropertyGet("registry", "--global", "image-repo-template")
imageRepoTemplate := strings.TrimSpace(reportImageRepoTemplate(appName))
if imageRepoTemplate == "" {
imageRepoTemplate = reportGlobalImageRepoTemplate(appName)
}
if imageRepoTemplate == "" {
return "", nil
}
@@ -131,11 +134,7 @@ func incrementTagVersion(appName string) (int, error) {
}
func getRegistryPushExtraTagsForApp(appName string) string {
value := common.PropertyGet("registry", appName, "push-extra-tags")
if value == "" {
value = common.PropertyGet("registry", "--global", "push-extra-tags")
}
return value
return reportComputedPushExtraTags(appName)
}
func pushToRegistry(appName string, tag int, imageID string, imageRepo string) error {

View File

@@ -3,10 +3,11 @@ package registry
var (
// DefaultProperties is a map of all valid registry properties with corresponding default property values
DefaultProperties = map[string]string{
"image-repo": "",
"push-on-release": "false",
"server": "",
"push-extra-tags": "",
"image-repo": "",
"image-repo-template": "",
"push-on-release": "false",
"server": "",
"push-extra-tags": "",
}
// GlobalProperties is a map of all valid global registry properties

View File

@@ -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
}