WIP: Trying to implement diff
This commit is contained in:
@ -47,7 +47,7 @@ func (c *Cluster) BootstrapRepo(gh githelper.Githelper, workdir string, dry bool
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := gh.AddAllAndCommit(workdir, "Bootstrap the shoebill repo"); err != nil {
|
||||
if _, err := gh.AddAllAndCommit(workdir, "Bootstrap the shoebill repo"); err != nil {
|
||||
return err
|
||||
}
|
||||
if !dry {
|
||||
@ -67,7 +67,7 @@ func (c *Cluster) BootstrapRepo(gh githelper.Githelper, workdir string, dry bool
|
||||
if _, err := file.WriteString(c.DotSops); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := gh.AddAllAndCommit(workdir, "Create a sops config file"); err != nil {
|
||||
if _, err := gh.AddAllAndCommit(workdir, "Create a sops config file"); err != nil {
|
||||
return err
|
||||
}
|
||||
if !dry {
|
||||
|
@ -18,10 +18,18 @@ type LockEntry struct {
|
||||
Namespace string
|
||||
RepoUrl string
|
||||
RepoName string
|
||||
GitCommit string
|
||||
Values []string
|
||||
Secrets []string
|
||||
}
|
||||
|
||||
type HashPerRelease struct {
|
||||
Release string
|
||||
Namespace string
|
||||
CommitHash string
|
||||
}
|
||||
type HashesPerReleases []*HashPerRelease
|
||||
|
||||
type LockRepository struct {
|
||||
URL string
|
||||
Name string
|
||||
@ -77,6 +85,16 @@ func (lockfile LockFile) ReposFromLockfile() (repository.Repositories, error) {
|
||||
return dedupedRepositories, nil
|
||||
}
|
||||
|
||||
func (lf LockFile) AddHashes(hashes HashesPerReleases) {
|
||||
for _, lockEntry := range lf {
|
||||
for _, hash := range hashes {
|
||||
if lockEntry.Namespace == hash.Namespace && lockEntry.Release == hash.Release {
|
||||
lockEntry.GitCommit = hash.CommitHash
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (lf LockFile) WriteToFile(dir string) error {
|
||||
lockfilePath := fmt.Sprintf("%s/%s", dir, LOCKFILE_NAME)
|
||||
lockfileContent, err := yaml.Marshal(lf)
|
||||
|
@ -35,6 +35,22 @@ type Release struct {
|
||||
DestSecrets ValuesHolders `yaml:"-"`
|
||||
}
|
||||
|
||||
func (r *Release) ToHelmReleaseData() *helmhelper.ReleaseData {
|
||||
// valuesData =
|
||||
// for _, data := range r.DestValues {
|
||||
|
||||
// }
|
||||
return &helmhelper.ReleaseData{
|
||||
Name: r.Release,
|
||||
Chart: r.Chart,
|
||||
Version: r.Version,
|
||||
Namespace: r.Namespace,
|
||||
RepositoryName: r.RepositoryObj.Name,
|
||||
RepositoryURL: r.RepositoryObj.URL,
|
||||
RepositoryKind: r.RepositoryObj.Kind,
|
||||
}
|
||||
}
|
||||
|
||||
type ValuesHolder struct {
|
||||
SrcPath string
|
||||
DestPath string
|
||||
@ -78,7 +94,7 @@ func (r *Release) VersionHandler(dir string, hh helmhelper.Helmhelper) error {
|
||||
}
|
||||
switch r.Version {
|
||||
case VERSION_LATEST:
|
||||
version, err := hh.FindLatestVersion(dir, r.Chart, *r.RepositoryObj)
|
||||
version, err := hh.FindLatestVersion(dir, r.ToHelmReleaseData())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
Reference in New Issue
Block a user