🐛 Fix a bug.
This commit is contained in:
parent
01053b2df5
commit
14250ad7ae
54
main.go
54
main.go
@ -27,6 +27,11 @@ func main() {
|
|||||||
case "restart":
|
case "restart":
|
||||||
action = restart
|
action = restart
|
||||||
case "update":
|
case "update":
|
||||||
|
// 如果image和tag有空值,报错
|
||||||
|
if os.Getenv("PLUGIN_IMAGE") == "" || os.Getenv("PLUGIN_TAG") == "" {
|
||||||
|
panic("Configuration item image or tag must not be empty")
|
||||||
|
return
|
||||||
|
}
|
||||||
action = update
|
action = update
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -43,24 +48,28 @@ func main() {
|
|||||||
Action: action,
|
Action: action,
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "cluster",
|
Required: true,
|
||||||
Usage: "cluster name",
|
Name: "cluster",
|
||||||
EnvVars: []string{"PLUGIN_CLUSTER"},
|
Usage: "cluster name",
|
||||||
|
EnvVars: []string{"PLUGIN_CLUSTER"},
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "kind",
|
Required: true,
|
||||||
Usage: "workload type",
|
Name: "kind",
|
||||||
EnvVars: []string{"PLUGIN_KIND"},
|
Usage: "workload type",
|
||||||
|
EnvVars: []string{"PLUGIN_KIND"},
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "name",
|
Required: true,
|
||||||
Usage: "workload name",
|
Name: "name",
|
||||||
EnvVars: []string{"PLUGIN_NAME"},
|
Usage: "workload name",
|
||||||
|
EnvVars: []string{"PLUGIN_NAME"},
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "namespace",
|
Required: true,
|
||||||
Usage: "workload namespace",
|
Name: "namespace",
|
||||||
EnvVars: []string{"PLUGIN_NAMESPACE"},
|
Usage: "workload namespace",
|
||||||
|
EnvVars: []string{"PLUGIN_NAMESPACE"},
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "image",
|
Name: "image",
|
||||||
@ -73,19 +82,22 @@ func main() {
|
|||||||
EnvVars: []string{"PLUGIN_TAG"},
|
EnvVars: []string{"PLUGIN_TAG"},
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "kuboard_uri",
|
Required: true,
|
||||||
Usage: "kuboard uri",
|
Name: "kuboard_uri",
|
||||||
EnvVars: []string{"PLUGIN_KUBOARD_URI"},
|
Usage: "kuboard uri",
|
||||||
|
EnvVars: []string{"PLUGIN_KUBOARD_URI"},
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "kuboard_username",
|
Required: true,
|
||||||
Usage: "kuboard username",
|
Name: "kuboard_username",
|
||||||
EnvVars: []string{"PLUGIN_KUBOARD_USERNAME"},
|
Usage: "kuboard username",
|
||||||
|
EnvVars: []string{"PLUGIN_KUBOARD_USERNAME"},
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "kuboard_key",
|
Required: true,
|
||||||
Usage: "kuboard access key",
|
Name: "kuboard_key",
|
||||||
EnvVars: []string{"PLUGIN_KUBOARD_KEY"},
|
Usage: "kuboard access key",
|
||||||
|
EnvVars: []string{"PLUGIN_KUBOARD_KEY"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user