Skip to content
This repository has been archived by the owner on Apr 20, 2021. It is now read-only.

Commit

Permalink
Merge pull request weaveworks#33 from weaveworks/wcloud-templates
Browse files Browse the repository at this point in the history
Support templates for commit messages and notifications in wcloud
  • Loading branch information
tomwilkie authored Aug 17, 2016
2 parents f1bb537 + 7acfbd7 commit 38037f8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
11 changes: 9 additions & 2 deletions cmd/wcloud/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"fmt"
"io/ioutil"
"os"
"os/user"
"path/filepath"
"strings"
"time"
Expand Down Expand Up @@ -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())
Expand Down
6 changes: 5 additions & 1 deletion cmd/wcloud/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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"`
}

0 comments on commit 38037f8

Please sign in to comment.