2019-12-03 17:50:15 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"os"
|
|
|
|
|
2020-01-02 17:04:52 +00:00
|
|
|
_ "github.com/joho/godotenv/autoload"
|
2020-01-14 18:32:20 +00:00
|
|
|
"github.com/pelotech/drone-helm3/internal/env"
|
2019-12-09 17:56:02 +00:00
|
|
|
"github.com/pelotech/drone-helm3/internal/helm"
|
2019-12-03 17:50:15 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
2020-01-14 18:32:20 +00:00
|
|
|
cfg, err := env.NewConfig(os.Stdout, os.Stderr)
|
2019-12-03 17:50:15 +00:00
|
|
|
|
2019-12-24 17:34:38 +00:00
|
|
|
if err != nil {
|
2019-12-03 17:50:15 +00:00
|
|
|
fmt.Fprintf(os.Stderr, "%s\n", err.Error())
|
2019-12-09 17:56:02 +00:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
// Make the plan
|
2019-12-24 17:34:38 +00:00
|
|
|
plan, err := helm.NewPlan(*cfg)
|
2019-12-09 17:56:02 +00:00
|
|
|
if err != nil {
|
2019-12-16 23:46:37 +00:00
|
|
|
fmt.Fprintf(os.Stderr, "%w\n", err)
|
|
|
|
os.Exit(1)
|
2019-12-03 17:50:15 +00:00
|
|
|
}
|
|
|
|
|
2019-12-09 17:56:02 +00:00
|
|
|
// Execute the plan
|
|
|
|
err = plan.Execute()
|
2019-12-05 22:35:25 +00:00
|
|
|
|
2019-12-09 17:56:02 +00:00
|
|
|
// Expect the plan to go off the rails
|
|
|
|
if err != nil {
|
2019-12-26 19:31:45 +00:00
|
|
|
fmt.Fprintf(os.Stderr, "%s\n", err.Error())
|
2019-12-09 17:56:02 +00:00
|
|
|
// Throw away the plan
|
|
|
|
os.Exit(1)
|
2019-12-05 22:35:25 +00:00
|
|
|
}
|
2019-12-03 17:50:15 +00:00
|
|
|
}
|