Skip to content

Commit 198a18f

Browse files
authored
feat: add link to the stage (#68)
Co-authored-by: rick <[email protected]>
1 parent 6d7a11f commit 198a18f

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

cmd/argoworkflow/template/comment.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@ package template
33
// CommentTemplate is the default comment template
44
const CommentTemplate = `
55
<!-- Generated by https://github.com/LinuxSuRen/gogit -->
6-
[{{.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"}}).
6+
{{ $link := (get .Annotations "workflow.link") }}
7+
[{{.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}}).
78
89
| Stage | Status | Duration |
910
|---|---|---|
1011
{{- range $_, $status := .Status.Nodes}}
11-
| {{$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}} |
12+
| [{{$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}} |
1213
{{- end}}
1314
`
1415

cmd/argoworkflow/template/comment_test.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,14 @@ func TestCommentTemplate(t *testing.T) {
4949
assert.Nil(t, err)
5050
assert.Equal(t, `
5151
<!-- Generated by https://github.com/LinuxSuRen/gogit -->
52+
5253
[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).
5354
5455
| Stage | Status | Duration |
5556
|---|---|---|
56-
| node-1 | :white_check_mark: Succeeded | 5s |
57-
| node-2 | :broken_heart: Failed | 5s |
58-
| node-3 | :hourglass_flowing_sand: Running | 5s |
57+
| [node-1](https://github.com/linxusuren/gogit) | :white_check_mark: Succeeded | 5s |
58+
| [node-2](https://github.com/linxusuren/gogit) | :broken_heart: Failed | 5s |
59+
| [node-3](https://github.com/linxusuren/gogit) | :hourglass_flowing_sand: Running | 5s |
5960
`, result)
6061

6162
result, err = template.RenderTemplate(`

0 commit comments

Comments
 (0)