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

36 lines
581 B
Go
Raw Normal View History

package main
import (
"fmt"
2019-12-09 17:56:02 +00:00
"github.com/kelseyhightower/envconfig"
"os"
2019-12-09 17:56:02 +00:00
"github.com/pelotech/drone-helm3/internal/helm"
)
func main() {
2019-12-09 17:56:02 +00:00
var c helm.Config
2019-12-09 17:56:02 +00:00
if err := envconfig.Process("plugin", &c); 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(c)
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, err.Error())
// Throw away the plan
os.Exit(1)
2019-12-05 22:35:25 +00:00
}
}