mirror of
https://github.com/weaveworks/scope.git
synced 2026-02-15 02:20:19 +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"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/user"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -71,9 +72,15 @@ func deploy(c Client, args []string) {
|
||||
usage()
|
||||
return
|
||||
}
|
||||
user, err := user.Current()
|
||||
if err != nil {
|
||||
fmt.Println(err.Error())
|
||||
os.Exit(1)
|
||||
}
|
||||
deployment := Deployment{
|
||||
ImageName: parts[0],
|
||||
Version: parts[1],
|
||||
ImageName: parts[0],
|
||||
Version: parts[1],
|
||||
TriggeringUser: user.Username,
|
||||
}
|
||||
if err := c.Deploy(deployment); err != nil {
|
||||
fmt.Println(err.Error())
|
||||
|
||||
@@ -12,7 +12,8 @@ type Deployment struct {
|
||||
Version string `json:"version"`
|
||||
Priority int `json:"priority"`
|
||||
State string `json:"status"`
|
||||
LogKey string `json:"-"`
|
||||
|
||||
TriggeringUser string `json:"triggering_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
|
||||
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
|
||||
type NotificationConfig struct {
|
||||
SlackWebhookURL string `json:"slack_webhook_url" yaml:"slack_webhook_url"`
|
||||
SlackUsername string `json:"slack_username" yaml:"slack_username"`
|
||||
MessageTemplate string `json:"message_template" yaml:"message_template"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user