diff --git a/apply/apply.go b/apply/apply.go index 8e72b85..28b01ea 100644 --- a/apply/apply.go +++ b/apply/apply.go @@ -94,19 +94,20 @@ func ensureSecretsForRepo(client drone.Client, manifestSecret *mfst.SecretDef, r secret.Value = string(out) } - _, err = client.Secret(owner, name, secret.Name) - if err != nil { + _, serr := client.Secret(owner, name, secret.Name) + if serr == nil { _, uerr := client.SecretUpdate(owner, name, secret) - if uerr != nil { - fmt.Printf("%s %s\n", Green("✓"), Bold(secret.Name)) + if uerr == nil { + fmt.Printf("%s Updated %s\n", Green("✓"), Bold(secret.Name)) } else { fmt.Printf("%s %s.\n", Red("✕"), Bold(secret.Name)) return uerr } } else { + fmt.Printf("creating new secret %s\n", Bold(secret.Name)) _, uerr := client.SecretCreate(owner, name, secret) - if uerr != nil { - fmt.Printf("%s %s\n", Green("✓"), Bold(secret.Name)) + if uerr == nil { + fmt.Printf("%s Created: %s\n", Green("✓"), Bold(secret.Name)) } else { fmt.Printf("%s %s.\n", Red("✕"), Bold(secret.Name)) return uerr diff --git a/main.go b/main.go index 4da7819..1b6bd84 100644 --- a/main.go +++ b/main.go @@ -9,7 +9,7 @@ import ( "github.com/urfave/cli" ) -const version string = "0.0.4" +const version string = "0.0.5" func main() { app := cli.NewApp() @@ -52,6 +52,7 @@ func main() { } if err := app.Run(os.Args); err != nil { + log.Println("Fatal Error") log.Fatal(err) } }