A bunch of broken stuff
This commit is contained in:
@ -25,30 +25,24 @@ func ReadTheConfig(path string) (*config.Config, error) {
|
||||
return conf, nil
|
||||
}
|
||||
|
||||
// func cloneSnapshoot(gh githelper.Githelper, snapshotDir, snapshotBranch string) error {
|
||||
// if err := gh.CloneRepo(snapshotBranch, snapshotUrl, false); err != nil {
|
||||
// return err
|
||||
// }
|
||||
// return nil
|
||||
// }
|
||||
|
||||
func Sync(definedWorkdirPath, sshKeyPath string, conf *config.Config, dry bool, diffArg string) error {
|
||||
// Start by creating a directory where everything should be happening
|
||||
configPath := filepath.Dir(conf.ConfigPath)
|
||||
|
||||
workdirPath, err := workdir.CreateWorkdir(definedWorkdirPath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Prepare helm repositories
|
||||
for _, repository := range conf.Repositories {
|
||||
if err := repository.KindFromUrl(); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if err := conf.Charts.PopulateRepositories(conf.Repositories); err != nil {
|
||||
return err
|
||||
}
|
||||
//for _, release := range conf.Releases {
|
||||
// // repo := release.PopulateRepository(Repo)
|
||||
// // release.Pull(repo)
|
||||
//
|
||||
//}
|
||||
|
||||
//if err := conf.Charts.PopulateRepositories(conf.Repositories); err != nil {
|
||||
// return err
|
||||
//}
|
||||
|
||||
if err := conf.Releases.PopulateCharts(conf.Charts); err != nil {
|
||||
return err
|
||||
@ -69,13 +63,11 @@ func Sync(definedWorkdirPath, sshKeyPath string, conf *config.Config, dry bool,
|
||||
logrus.Info("AFTER")
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Configure a git client
|
||||
gh := githelper.NewGit(sshKeyPath)
|
||||
// if len(diffArg) > 0 {
|
||||
// snapshotDir := fmt.Sprint("%s/.snapshot", workdirPath)
|
||||
// cloneSnapshoot(gh, snapshotDir, diffArg)
|
||||
// snapshotDir := fmt.Sprint("%s/.snapshot", workdirPath)
|
||||
// cloneSnapshoot(gh, snapshotDir, diffArg)
|
||||
// }
|
||||
|
||||
// The main logic starts here
|
||||
|
@ -8,17 +8,15 @@ func CreateWorkdir(path string) (workdir string, err error) {
|
||||
if err := os.Mkdir(path, 0777); err != nil {
|
||||
return path, err
|
||||
}
|
||||
// TODO(@allanger): I've got a feeling that it doesn't have to look that bad
|
||||
workdir = path
|
||||
return path, nil
|
||||
} else {
|
||||
// Create a temporary dir
|
||||
workdir, err = os.MkdirTemp("", "shoebill")
|
||||
if err != nil {
|
||||
return workdir, err
|
||||
return "", err
|
||||
}
|
||||
|
||||
return workdir, nil
|
||||
}
|
||||
return workdir, nil
|
||||
}
|
||||
|
||||
func RemoveWorkdir(path string) (err error) {
|
||||
|
Reference in New Issue
Block a user