-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
68 lines (58 loc) · 1.27 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package main
import (
"fmt"
"github.com/niranjan94/rancher-deployer/cmd"
"github.com/urfave/cli"
"log"
"os"
)
var version = "snapshot"
var revision = "head"
func main() {
cli.VersionPrinter = func(c *cli.Context) {
fmt.Printf("%s\nversion=%s revision=%s\n",c.App.Name, c.App.Version, revision)
}
app := cli.NewApp()
app.Name = "rancher-deployer"
app.Usage = "Deploy/upgrade your deployments on Rancher 2.0 Clusters"
app.Version = version
app.Flags = []cli.Flag {
cli.StringFlag{
Name: "config,c",
Value: "",
Usage: "`PATH` to a yaml config file",
},
cli.StringFlag{
Name: "token,t",
Value: "",
Usage: "Override `TOKEN` for deployment",
},
cli.StringFlag{
Name: "tag,T",
Value: "",
Usage: "Override the `TAG` for the docker image to use",
},
cli.StringFlag{
Name: "image,i",
Value: "",
Usage: "Override the Docker `IMAGE-URL`",
},
cli.StringFlag{
Name: "environments,e",
Value: "",
Usage: "`ENVIRONMENTS` to deploy to (comma-separated)",
},
}
app.Action = func(c *cli.Context) error {
if c.String("token") != "" {
_ = os.Setenv("DEPLOYER_TOKEN", c.String("token"))
}
cmd.LoadConfig(c.String("config"))
cmd.Deploy(c)
return nil
}
err := app.Run(os.Args)
if err != nil {
log.Fatal(err)
}
}