Skip to content

Commit

Permalink
Merge pull request #13 from franciscojuniorharness/main
Browse files Browse the repository at this point in the history
Fixed the correct field for file paths and values yaml when updating …
  • Loading branch information
aleksa11010 authored Dec 31, 2024
2 parents 404408f + d37e939 commit e4e0fc5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
9 changes: 5 additions & 4 deletions harness/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,11 @@ type ServiceYaml struct {
} `yaml:"spec"`
ValuesPaths []string `yaml:"valuesPaths"`
} `yaml:"store"`
ChartName string `yaml:"chartName"`
ChartVersion string `yaml:"chartVersion"`
HelmVersion string `yaml:"helmVersion"`
SkipResourceVersioning bool `yaml:"skipResourceVersioning"`
ValuesPaths []string `yaml:"valuesPaths"`
ChartName string `yaml:"chartName"`
ChartVersion string `yaml:"chartVersion"`
HelmVersion string `yaml:"helmVersion"`
SkipResourceVersioning bool `yaml:"skipResourceVersioning"`
} `yaml:"spec"`
} `yaml:"manifest"`
} `yaml:"manifests"`
Expand Down
12 changes: 7 additions & 5 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -731,21 +731,23 @@ func main() {
files = append(files, fmt.Sprintf("filestore/%s/%s%s", service.Org, service.Project, file))
}
var valueFiles []string
if len(m.Manifest.Spec.Store.ValuesPaths) > 0 {
for _, v := range m.Manifest.Spec.Store.ValuesPaths {
if len(m.Manifest.Spec.ValuesPaths) > 0 {
log.Infof("Setting values file paths")
for _, v := range m.Manifest.Spec.ValuesPaths {
valueFiles = append(valueFiles, fmt.Sprintf("filestore/%s/%s%s", service.Org, service.Project, v))
}
log.Infof("Setting following value file paths : %+v", valueFiles)
}
log.Infof("Setting following file paths : %+v", files)
if m.Manifest.Spec.Store.Type == "GitLab" {
if m.Manifest.Spec.Store.Type == "GitLab" || m.Manifest.Spec.Store.Type == "Github" {
m.Manifest.Spec.Store.Spec.Paths = files
} else {
m.Manifest.Spec.Store.Spec.Files = files
}
m.Manifest.Spec.Store.Spec.Branch = accountConfig.GitDetails.BranchName
m.Manifest.Spec.Store.Spec.ConnectorRef = accountConfig.GitDetails.ConnectorRef
m.Manifest.Spec.Store.Spec.GitFetchType = "Branch"
m.Manifest.Spec.Store.ValuesPaths = valueFiles
m.Manifest.Spec.ValuesPaths = valueFiles

update = true
} else if scope.ForceUpdateManifests {
Expand All @@ -765,7 +767,7 @@ func main() {
m.Manifest.Spec.Store.Spec.Branch = accountConfig.GitDetails.BranchName
m.Manifest.Spec.Store.Spec.ConnectorRef = accountConfig.GitDetails.ConnectorRef
m.Manifest.Spec.Store.Spec.GitFetchType = "Branch"
m.Manifest.Spec.Store.ValuesPaths = valueFiles
m.Manifest.Spec.ValuesPaths = valueFiles

update = true
} else {
Expand Down

0 comments on commit e4e0fc5

Please sign in to comment.