diff --git a/handler/template/files/stage.tmpl b/handler/template/files/stage.tmpl index 484980c..34a3873 100644 --- a/handler/template/files/stage.tmpl +++ b/handler/template/files/stage.tmpl @@ -55,6 +55,10 @@ {{ .Build.Author }} created reference {{ tag .Build.Ref }} {{ else if eq .Build.Event "promote"}} {{ .Build.Author }} promoted build #{{ .Build.Parent }} to {{ .Build.Deploy }} + {{ else if eq .Build.Event "rollback"}} + {{ .Build.Author }} reverted {{ .Build.Deploy }} to #{{ .Build.Parent }} + {{ else if eq .Build.Event "cron"}} + Executed {{ .Build.Cron }} for branch {{ .Build.Target }} {{ else }} {{ .Build.Author }} pushed {{ sha .Build.After }} to {{ .Build.Target }} {{ end }} diff --git a/handler/template/template_gen.go b/handler/template/template_gen.go index 3fb9a42..b263d41 100644 --- a/handler/template/template_gen.go +++ b/handler/template/template_gen.go @@ -217,6 +217,10 @@ var stage = ` {{ .Build.Author }} created reference {{ tag .Build.Ref }} {{ else if eq .Build.Event "promote"}} {{ .Build.Author }} promoted build #{{ .Build.Parent }} to {{ .Build.Deploy }} + {{ else if eq .Build.Event "rollback"}} + {{ .Build.Author }} reverted {{ .Build.Deploy }} to #{{ .Build.Parent }} + {{ else if eq .Build.Event "cron"}} + Executed {{ .Build.Cron }} for branch {{ .Build.Target }} {{ else }} {{ .Build.Author }} pushed {{ sha .Build.After }} to {{ .Build.Target }} {{ end }} diff --git a/handler/template/testdata/stage_cron.json b/handler/template/testdata/stage_cron.json new file mode 100644 index 0000000..736cf5f --- /dev/null +++ b/handler/template/testdata/stage_cron.json @@ -0,0 +1,31 @@ +{ + "Repo": { + "Slug": "octocat/hello-world", + "Name": "hello-world" + }, + "Build": { + "After": "7fd1a60b01f91b314f59955a4e4d4e80d8edf11d", + "Event": "cron", + "Cron": "nightly", + "Source": "master", + "Target": "master", + "Deploy": "production", + "Message": "Merge pull request #6 from Spaceghost/patch-1", + "Author": "octocat", + "AuthorAvatar": "https://avatars0.githubusercontent.com/u/583231?s=460&v=4", + "Parent": 41, + "Number": 42 + }, + "Stage": { + "Name": "test", + "Status": "success", + "Started": 1563059000, + "Created": 1563059000, + "Steps": [ + { "Name": "clone", "Status": "success" }, + { "Name": "build", "Status": "success" }, + { "Name": "test", "Status": "success" }, + { "Name": "deploy", "Status": "success" } + ] + } +} diff --git a/handler/template/testdata/stage_rollback.json b/handler/template/testdata/stage_rollback.json new file mode 100644 index 0000000..cebce55 --- /dev/null +++ b/handler/template/testdata/stage_rollback.json @@ -0,0 +1,30 @@ +{ + "Repo": { + "Slug": "octocat/hello-world", + "Name": "hello-world" + }, + "Build": { + "After": "7fd1a60b01f91b314f59955a4e4d4e80d8edf11d", + "Event": "rollback", + "Source": "master", + "Target": "master", + "Deploy": "production", + "Message": "Merge pull request #6 from Spaceghost/patch-1", + "Author": "octocat", + "AuthorAvatar": "https://avatars0.githubusercontent.com/u/583231?s=460&v=4", + "Parent": 41, + "Number": 42 + }, + "Stage": { + "Name": "test", + "Status": "success", + "Started": 1563059000, + "Created": 1563059000, + "Steps": [ + { "Name": "clone", "Status": "success" }, + { "Name": "build", "Status": "success" }, + { "Name": "test", "Status": "success" }, + { "Name": "deploy", "Status": "success" } + ] + } +}