woodpecker-helm3/cmd/drone-helm/main.go
Erin Call 16117eea2f
Put the Config in a new env package [#67]
I'd like to be able to make calls like NewUpgrade(cfg) rather than
Upgrade{...}.Prepare, but I wouldn't be able to define a NewUpgrade
function while Config is in the helm package; there would be a circular
import when Plan tried to import run.
2020-01-14 10:32:20 -08:00

37 lines
629 B
Go

package main
import (
"fmt"
"os"
_ "github.com/joho/godotenv/autoload"
"github.com/pelotech/drone-helm3/internal/env"
"github.com/pelotech/drone-helm3/internal/helm"
)
func main() {
cfg, err := env.NewConfig(os.Stdout, os.Stderr)
if err != nil {
fmt.Fprintf(os.Stderr, "%s\n", err.Error())
return
}
// Make the plan
plan, err := helm.NewPlan(*cfg)
if err != nil {
fmt.Fprintf(os.Stderr, "%w\n", err)
os.Exit(1)
}
// Execute the plan
err = plan.Execute()
// Expect the plan to go off the rails
if err != nil {
fmt.Fprintf(os.Stderr, "%s\n", err.Error())
// Throw away the plan
os.Exit(1)
}
}