2019-12-03 17:50:15 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"os"
|
|
|
|
|
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() {
|
2019-12-24 17:34:38 +00:00
|
|
|
cfg, err := helm.NewConfig()
|
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 {
|
|
|
|
fmt.Fprintf(os.Stderr, err.Error())
|
|
|
|
// Throw away the plan
|
|
|
|
os.Exit(1)
|
2019-12-05 22:35:25 +00:00
|
|
|
}
|
2019-12-03 17:50:15 +00:00
|
|
|
}
|