WIP: Trying to implement diff

This commit is contained in:
Nikolai Rodionov
2023-10-20 13:31:30 +02:00
parent 93ad3389b2
commit ed3d45a7c4
15 changed files with 197 additions and 136 deletions

View File

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