codilime / floodgate

Floodgate - Pipelines as Code solution for Spinnaker
Apache License 2.0
16 stars 9 forks source link

if resource does not exists on remote, floodgate does not create it. … #126

Open mertsaygi opened 4 years ago

mertsaygi commented 4 years ago

Describe the bug When we synth our resources, Floodgate makes changes to our existing resources but it never creates our new resources. When we investigate, we should make change on spinnaker resource directory as like that:

if api != nil { if err := a.LoadRemoteState(api); err != nil { err := a.SaveLocalState(api) return err } }

If loadRemoteState has an error (does not exist error) local state should be saved on remote. This is quick solution. If you want to resolve this issue on me. I can do clean solution.

kacpersaw commented 4 years ago

Init function is created to initalize resource. When you run sync command, it runs https://github.com/codilime/floodgate/blob/69718a85b49e94e48353ab8038947bf37460bd76/resourcemanager/resourcemanager.go#L111 and then it starts to save resources in remote https://github.com/codilime/floodgate/blob/69718a85b49e94e48353ab8038947bf37460bd76/resourcemanager/resourcemanager.go#L124

kacpersaw commented 4 years ago

To sum up, I don't think it's necessary to save resources in remote inside the init function.