diff --git a/cmd/argoworkflow/template/comment.go b/cmd/argoworkflow/template/comment.go index 43f9afe..4d5158a 100644 --- a/cmd/argoworkflow/template/comment.go +++ b/cmd/argoworkflow/template/comment.go @@ -3,12 +3,13 @@ package template // CommentTemplate is the default comment template const CommentTemplate = ` -[{{.Spec.WorkflowTemplateRef.Name}}]({{get .Annotations "workflow.templatelink"}}) is {{.Status.Phase}}. It started from {{date "01-02 15:04" .Status.StartedAt.Time}}, and took {{duration .Status.FinishedAt .Status.StartedAt}}. Please check log output from [here]({{get .Annotations "workflow.link"}}). +{{ $link := (get .Annotations "workflow.link") }} +[{{.Spec.WorkflowTemplateRef.Name}}]({{get .Annotations "workflow.templatelink"}}) is {{.Status.Phase}}. It started from {{date "01-02 15:04" .Status.StartedAt.Time}}, and took {{duration .Status.FinishedAt .Status.StartedAt}}. Please check log output from [here]({{$link}}). | Stage | Status | Duration | |---|---|---| {{- range $_, $status := .Status.Nodes}} -| {{$status.DisplayName}} | {{if eq $status.Phase "Failed"}}:broken_heart:{{else if eq $status.Phase "Succeeded"}}:white_check_mark:{{else if eq $status.Phase "Running"}}:hourglass_flowing_sand:{{end}} {{$status.Phase}} | {{duration $status.FinishedAt $status.StartedAt}} | +| [{{$status.DisplayName}}]({{$link}}) | {{if eq $status.Phase "Failed"}}:broken_heart:{{else if eq $status.Phase "Succeeded"}}:white_check_mark:{{else if eq $status.Phase "Running"}}:hourglass_flowing_sand:{{end}} {{$status.Phase}} | {{duration $status.FinishedAt $status.StartedAt}} | {{- end}} ` diff --git a/cmd/argoworkflow/template/comment_test.go b/cmd/argoworkflow/template/comment_test.go index 9f8663e..bdfbb4f 100644 --- a/cmd/argoworkflow/template/comment_test.go +++ b/cmd/argoworkflow/template/comment_test.go @@ -49,13 +49,14 @@ func TestCommentTemplate(t *testing.T) { assert.Nil(t, err) assert.Equal(t, ` + [Sample](https://github.com/linxusuren/gogit.git) is Failed. It started from 12-12 15:22, and took 5s. Please check log output from [here](https://github.com/linxusuren/gogit). | Stage | Status | Duration | |---|---|---| -| node-1 | :white_check_mark: Succeeded | 5s | -| node-2 | :broken_heart: Failed | 5s | -| node-3 | :hourglass_flowing_sand: Running | 5s | +| [node-1](https://github.com/linxusuren/gogit) | :white_check_mark: Succeeded | 5s | +| [node-2](https://github.com/linxusuren/gogit) | :broken_heart: Failed | 5s | +| [node-3](https://github.com/linxusuren/gogit) | :hourglass_flowing_sand: Running | 5s | `, result) result, err = template.RenderTemplate(`