Skip to content

Commit

Permalink
slack error message display string fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
razzkumar committed Sep 25, 2019
1 parent 4a7c5bd commit 8c70bdb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
9 changes: 4 additions & 5 deletions deployment/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"strings"

"github.com/leapfrogtechnology/shift/deployment/domain/project"
"github.com/leapfrogtechnology/shift/deployment/internals/frontend"
"github.com/leapfrogtechnology/shift/deployment/internals/backend"
"github.com/leapfrogtechnology/shift/deployment/internals/frontend"
"github.com/leapfrogtechnology/shift/deployment/services/aws/s3"
"github.com/leapfrogtechnology/shift/deployment/services/mq/deployment"
"github.com/leapfrogtechnology/shift/deployment/services/mq/trigger"
Expand All @@ -34,7 +34,7 @@ func deployFrontend(projectResponse project.Response) {
"Error: Deployment of *%s* *%s* failed. \n %s",
projectResponse.ProjectName,
projectResponse.Deployment.Name,
error.Error()),
"```"+error.Error()+"```"),
"#FF6871")

return
Expand All @@ -60,22 +60,21 @@ func deployFrontend(projectResponse project.Response) {
"#04EBB8")
}


func deploy(msg []byte) {
projectResponse := project.Response{}
json.Unmarshal(msg, &projectResponse)
if strings.EqualFold(projectResponse.Deployment.Type, "frontend") {
deployFrontend(projectResponse)
} else if strings.EqualFold(projectResponse.Deployment.Type, "backend") {
out ,err := backend.Deploy(msg)
out, err := backend.Deploy(msg)
if err != nil {
slack.Notify(
projectResponse.Deployment.SlackURL,
fmt.Sprintf(
"Error: Deployment of *%s* *%s* failed. \n %s",
projectResponse.ProjectName,
projectResponse.Deployment.Name,
err.Error()),
"```"+err.Error()+"```"),
"#FF6871")

return
Expand Down
2 changes: 1 addition & 1 deletion deployment/utils/slack/slack.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ func Notify(url string, text string, color string) {

message := strings.Replace(text, "\"", "'", -1)

content := fmt.Sprintf(`{"attachments": [{"text": %q, "color": "%s"}]}`, "```"+message+"```", color)
content := fmt.Sprintf(`{"attachments": [{"text": %q, "color": "%s"}]}`, message, color)

http.Client.R().
SetHeader("Content-Type", "application/json").
Expand Down

0 comments on commit 8c70bdb

Please sign in to comment.