Skip to content

Commit

Permalink
fix update image registry and repository
Browse files Browse the repository at this point in the history
  • Loading branch information
KubeKyrie committed Apr 26, 2024
1 parent 2b4af0c commit a6f2c15
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions internal/chart/chart.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,21 @@ import (

var (
repositoryRegex = regexp.MustCompile(`(?m)(repository:[[:blank:]])(.*)(/)`)
registryRegex = regexp.MustCompile(`(?m)(registry:[[:blank:]])(.*)(.*$)`)
registryRegex = regexp.MustCompile(`(?m)(registry|imageRegistry:[[:blank:]])(.*)(.*$)`)
)

// updateValuesFile performs some substitutions to a given values.yaml file.
func updateValuesFile(valuesFile string, targetRepo *api.Target) error {
if err := updateContainerImageRegistry(valuesFile, targetRepo); err != nil {
return errors.Annotatef(err, "error updating %s file", valuesFile)
if targetRepo.ContainerRegistry != "" {
if err := updateContainerImageRegistry(valuesFile, targetRepo); err != nil {
return errors.Annotatef(err, "error updating %s file", valuesFile)
}
}
if err := updateContainerImageRepository(valuesFile, targetRepo); err != nil {
return errors.Annotatef(err, "error updating %s file", valuesFile)

if targetRepo.ContainerRepository != "" {
if err := updateContainerImageRepository(valuesFile, targetRepo); err != nil {
return errors.Annotatef(err, "error updating %s file", valuesFile)
}
}
return nil
}
Expand Down

0 comments on commit a6f2c15

Please sign in to comment.