diff --git a/main.go b/main.go index f20bae4..b34c1f5 100644 --- a/main.go +++ b/main.go @@ -598,7 +598,7 @@ func process(ctx any, data []byte) error { host, _ := os.Hostname() if repslack != "" { - notifyRunStarted("start tests", host, dist, repslack) + notifyRunStarted("Start tests", host, dist, c.Metadata["trigger_type"].(string), repslack, c.Tags) } case "start_all": log.Printf("received start_all command with tags: %v", c.Tags) @@ -620,7 +620,7 @@ func process(ctx any, data []byte) error { host, _ := os.Hostname() if repslack != "" { - notifyRunStarted("start all tests", host, dist, repslack) + notifyRunStarted("Start all tests", host, dist, c.Metadata["trigger_type"].(string), repslack, c.Tags) } case "rerun_started": mode, _ := c.Metadata["rerun_mode"].(string) diff --git a/notify.go b/notify.go index 0ecb76a..0d607a4 100644 --- a/notify.go +++ b/notify.go @@ -30,12 +30,21 @@ type ScenarioProgressMessage struct { Reviewers string `json:"reviewers,omitempty"` } -func notifyRunStarted(title, host, dist, webhook string) { +func notifyRunStarted(title, host, dist, trigger, webhook string, tags []string) { + var text strings.Builder + fmt.Fprintf(&text, "from %v through %v\n", host, dist) + if trigger != "" { + fmt.Fprintf(&text, "*Trigger type:* %v\n", trigger) + } + if len(tags) > 0 { + fmt.Fprintf(&text, "*Applied tags:* %v\n", strings.Join(tags, ", ")) + } + payload := SlackMessage{ Attachments: []SlackAttachment{{ Color: "good", Title: title, - Text: fmt.Sprintf("from %v through %v", host, dist), + Text: text.String(), Footer: "oops", Timestamp: time.Now().Unix(), }},