A big progress

A big progress
This commit is contained in:
2023-12-20 22:19:08 +01:00
parent 398ffeb963
commit 8e7a8998d3
10 changed files with 243 additions and 22 deletions

View File

@ -35,7 +35,6 @@ type Release struct {
// Private fields that should be pupulated during the run-time
RepositoryObj *repository.Repository `yaml:"-"`
ChartObj *chart.Chart `yaml:"-"`
MirrorObj *mirror.Mirror `yaml:"-"`
DestValues ValuesHolders `yaml:"-"`
DestSecrets ValuesHolders `yaml:"-"`
}
@ -98,7 +97,7 @@ func (r *Release) MirrorObjFromName(mirrors mirror.Mirrors) error {
}
}
if r.RepositoryObj == nil {
return fmt.Errorf("couldn't gather the RepositoryObj for %s", r.Repository)
return fmt.Errorf("couldn't gather the RepositoryObj from mirror for %s", r.Repository)
}
return nil
}
@ -249,11 +248,17 @@ func (src Releases) Diff(dest Releases) Diff {
return diff
}
func (rs *Releases) PopulateRepositories(repos repository.Repositories) error {
func (rs *Releases) PopulateRepositories(repos repository.Repositories, mirrors mirror.Mirrors) error {
for _, r := range *rs {
if len(r.Mirror) > 0 {
if err := r.MirrorObjFromName(mirrors); err != nil {
return err
}
} else {
if err := r.RepositoryObjFromName(repos); err != nil {
return err
}
}
}
return nil
}