woodpecker-helm3/cmd/drone-helm/main.go

37 lines
629 B
Go
Raw Normal View History

package main
import (
"fmt"
"os"
2020-01-02 17:04:52 +00:00
_ "github.com/joho/godotenv/autoload"
"github.com/pelotech/drone-helm3/internal/env"
2019-12-09 17:56:02 +00:00
"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())
2019-12-09 17:56:02 +00:00
return
}
// Make the plan
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-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 {
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
}
}