Propagate the local username

This commit is contained in:
Tom Wilkie
2016-08-17 15:11:04 +01:00
parent e6876d1cec
commit 7acfbd7034
2 changed files with 11 additions and 2 deletions

View File

@@ -7,6 +7,7 @@ import (
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"os" "os"
"os/user"
"path/filepath" "path/filepath"
"strings" "strings"
"time" "time"
@@ -71,9 +72,15 @@ func deploy(c Client, args []string) {
usage() usage()
return return
} }
user, err := user.Current()
if err != nil {
fmt.Println(err.Error())
os.Exit(1)
}
deployment := Deployment{ deployment := Deployment{
ImageName: parts[0], ImageName: parts[0],
Version: parts[1], Version: parts[1],
TriggeringUser: user.Username,
} }
if err := c.Deploy(deployment); err != nil { if err := c.Deploy(deployment); err != nil {
fmt.Println(err.Error()) fmt.Println(err.Error())

View File

@@ -12,6 +12,8 @@ type Deployment struct {
Version string `json:"version"` Version string `json:"version"`
Priority int `json:"priority"` Priority int `json:"priority"`
State string `json:"status"` State string `json:"status"`
TriggeringUser string `json:"triggering_user"`
} }
// Config for the deployment system for a user. // Config for the deployment system for a user.