mirror of
https://github.com/weaveworks/scope.git
synced 2026-07-18 12:59:31 +00:00
Merge pull request #33 from weaveworks/wcloud-templates
Support templates for commit messages and notifications in wcloud
This commit is contained in:
@@ -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())
|
||||||
|
|||||||
@@ -12,7 +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"`
|
||||||
LogKey string `json:"-"`
|
|
||||||
|
TriggeringUser string `json:"triggering_user"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Config for the deployment system for a user.
|
// Config for the deployment system for a user.
|
||||||
@@ -26,10 +27,13 @@ type Config struct {
|
|||||||
|
|
||||||
// Globs of files not to change, relative to the route of the repo
|
// Globs of files not to change, relative to the route of the repo
|
||||||
ConfigFileBlackList []string `json:"config_file_black_list" yaml:"config_file_black_list"`
|
ConfigFileBlackList []string `json:"config_file_black_list" yaml:"config_file_black_list"`
|
||||||
|
|
||||||
|
CommitMessageTemplate string `json:"commit_message_template" yaml:"commit_message_template"` // See https://golang.org/pkg/text/template/
|
||||||
}
|
}
|
||||||
|
|
||||||
// NotificationConfig describes how to send notifications
|
// NotificationConfig describes how to send notifications
|
||||||
type NotificationConfig struct {
|
type NotificationConfig struct {
|
||||||
SlackWebhookURL string `json:"slack_webhook_url" yaml:"slack_webhook_url"`
|
SlackWebhookURL string `json:"slack_webhook_url" yaml:"slack_webhook_url"`
|
||||||
SlackUsername string `json:"slack_username" yaml:"slack_username"`
|
SlackUsername string `json:"slack_username" yaml:"slack_username"`
|
||||||
|
MessageTemplate string `json:"message_template" yaml:"message_template"`
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user