Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update tools subtree #1937

Merged
merged 2 commits into from
Oct 20, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tools/cmd/wcloud/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func deploy(c Client, args []string) {
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)")
flags.Var(&services, "service", "Service to update (can be repeated)")
if err := flags.Parse(args); err != nil {
usage()
return
Expand Down
9 changes: 6 additions & 3 deletions tools/cmd/wcloud/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@ type Deployment struct {
// Config for the deployment system for a user.
type Config struct {
RepoURL string `json:"repo_url" yaml:"repo_url"`
RepoBranch string `json:"repo_branch" yaml:"repo_branch"`
RepoPath string `json:"repo_path" yaml:"repo_path"`
RepoBranch string `json:"repo_branch" yaml:"repo_branch"`
RepoKey string `json:"repo_key" yaml:"repo_key"`
KubeconfigPath string `json:"kubeconfig_path" yaml:"kubeconfig_path"`
AutoApply bool `json:"auto_apply" yaml:"auto_apply"`

Notifications []NotificationConfig `json:"notifications" yaml:"notifications"`

Expand All @@ -35,7 +37,8 @@ type Config struct {

// 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"`
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"`
ApplyMessageTemplate string `json:"apply_message_template" yaml:"apply_message_template"`
}
13 changes: 13 additions & 0 deletions tools/rebuild-image
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,26 @@ commit_timestamp() {
git show -s --format=%ct "$rev"
}

# Is the SHA1 actually present in the repo?
# It could be it isn't, e.g. after a force push
is_valid_commit() {
local rev=$1
git rev-parse --quiet --verify "$rev^{commit}" > /dev/null
}

cached_revision=$(cached_image_rev)
if [ -z "$cached_revision" ]; then
echo ">>> No cached image found; rebuilding"
rebuild
exit 0
fi

if ! is_valid_commit "$cached_revision"; then
echo ">>> Git commit of cached image not found in repo; rebuilding"
rebuild
exit 0
fi

echo ">>> Found cached image rev $cached_revision"
if has_changes "$cached_revision" "$CIRCLE_SHA1" ; then
echo ">>> Found changes, rebuilding"
Expand Down
1 change: 0 additions & 1 deletion tools/shell-lint
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,3 @@
# - file >= 5.22

"$(dirname "${BASH_SOURCE[0]}")/files-with-type" text/x-shellscript "$@" | xargs --no-run-if-empty shellcheck