mirror of
https://github.com/weaveworks/scope.git
synced 2026-07-19 05:19:35 +00:00
Add wcloud deploy --service flag
This commit is contained in:
@@ -16,6 +16,19 @@ import (
|
|||||||
"gopkg.in/yaml.v2"
|
"gopkg.in/yaml.v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// ArrayFlags allows you to collect repeated flags
|
||||||
|
type ArrayFlags []string
|
||||||
|
|
||||||
|
func (a *ArrayFlags) String() string {
|
||||||
|
return strings.Join(*a, ",")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set implements flags.Value
|
||||||
|
func (a *ArrayFlags) Set(value string) error {
|
||||||
|
*a = append(*a, value)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func env(key, def string) string {
|
func env(key, def string) string {
|
||||||
if val, ok := os.LookupEnv(key); ok {
|
if val, ok := os.LookupEnv(key); ok {
|
||||||
return val
|
return val
|
||||||
@@ -66,7 +79,9 @@ func deploy(c Client, args []string) {
|
|||||||
var (
|
var (
|
||||||
flags = flag.NewFlagSet("", flag.ContinueOnError)
|
flags = flag.NewFlagSet("", flag.ContinueOnError)
|
||||||
username = flags.String("u", "", "Username to report to deploy service (default with be current user)")
|
username = flags.String("u", "", "Username to report to deploy service (default with be current user)")
|
||||||
|
services ArrayFlags
|
||||||
)
|
)
|
||||||
|
flag.Var(&services, "service", "Service to update (can be repeated)")
|
||||||
if err := flags.Parse(args); err != nil {
|
if err := flags.Parse(args); err != nil {
|
||||||
usage()
|
usage()
|
||||||
return
|
return
|
||||||
@@ -90,9 +105,10 @@ func deploy(c Client, args []string) {
|
|||||||
*username = user.Username
|
*username = user.Username
|
||||||
}
|
}
|
||||||
deployment := Deployment{
|
deployment := Deployment{
|
||||||
ImageName: parts[0],
|
ImageName: parts[0],
|
||||||
Version: parts[1],
|
Version: parts[1],
|
||||||
TriggeringUser: *username,
|
TriggeringUser: *username,
|
||||||
|
IntendedServices: service,
|
||||||
}
|
}
|
||||||
if err := c.Deploy(deployment); err != nil {
|
if err := c.Deploy(deployment); err != nil {
|
||||||
fmt.Println(err.Error())
|
fmt.Println(err.Error())
|
||||||
|
|||||||
@@ -13,7 +13,8 @@ type Deployment struct {
|
|||||||
Priority int `json:"priority"`
|
Priority int `json:"priority"`
|
||||||
State string `json:"status"`
|
State string `json:"status"`
|
||||||
|
|
||||||
TriggeringUser string `json:"triggering_user"`
|
TriggeringUser string `json:"triggering_user"`
|
||||||
|
IntendedServices []string `json:"intended_services"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Config for the deployment system for a user.
|
// Config for the deployment system for a user.
|
||||||
|
|||||||
Reference in New Issue
Block a user