Skip to content
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
4 changes: 2 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
13 changes: 11 additions & 2 deletions notify.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
}},
Expand Down