WIP: Trying to diff

This commit is contained in:
Nikolai Rodionov
2023-10-13 18:02:11 +02:00
parent eb7abefc89
commit 93ad3389b2
7 changed files with 109 additions and 20 deletions

View File

@ -19,7 +19,8 @@ func init() {
sync.Flags().StringP("config", "c", "config.yaml", "A path to the configuration file")
sync.Flags().String("workdir", "", "A path to the workdir. On the moment of running, it should be an empty dir")
sync.Flags().String("ssh-key", "", "A path to the pricate ssh key")
sync.Flags().Bool("dry-run", false, "If set to false, will no push changes to git")
sync.Flags().Bool("dry-run", false, "If set to false, will not push changes to git")
sync.Flags().Bool("diff", false, "If set to false, will show helm diffs for not preserved charts")
sync.Flags().String("sops-bin", "/usr/bin/sops", "A path to the sops binary in your system")
rootCmd.AddCommand(sync)
@ -31,6 +32,7 @@ func syncCmd(cmd *cobra.Command, args []string) {
sshKey := cmd.Flag("ssh-key").Value.String()
sopsBin := cmd.Flag("sops-bin").Value.String()
dryRun, err := cmd.Flags().GetBool("dry-run")
diff, err := cmd.Flags().GetBool("diff")
if err != nil {
logrus.Fatal(err)
}
@ -41,7 +43,7 @@ func syncCmd(cmd *cobra.Command, args []string) {
}
configObj.SopsBin = sopsBin
err = controller.Reconcile(workdir, sshKey, configObj, dryRun)
err = controller.Sync(workdir, sshKey, configObj, dryRun, diff)
if err != nil {
logrus.Fatal(err)
}