From e97b1e968bb9f729db995d1103bb593b01a2295b Mon Sep 17 00:00:00 2001 From: Brad Rydzewski Date: Tue, 3 Sep 2019 19:25:18 -0700 Subject: [PATCH] support for cron event type --- CHANGELOG.md | 1 + core/event.go | 1 + service/status/status.go | 2 +- trigger/cron/cron.go | 2 +- trigger/cron/cron_test.go | 4 ++-- 5 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fba387fc..58b51b4a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - support for validation plugins, by [@bradrydzewski](https://github.com/bradrydzewski). [#2266](https://github.com/drone/drone/issues/2266). - support for conversion plugins, by [@bradrydzewski](https://github.com/bradrydzewski). +- support for cron event type, by [@bradrydzewski](https://github.com/bradrydzewski). [#2705](https://github.com/drone/drone/issues/2705). ### Removed - Support for basic auth as an option for Gitea, by [@techknowlogick](https://giteahub.com/techknowlogick). [#2721](https://github.com/drone/drone/issues/2721) diff --git a/core/event.go b/core/event.go index 3616d23a..10d7a4de 100644 --- a/core/event.go +++ b/core/event.go @@ -16,6 +16,7 @@ package core // Hook event constants. const ( + EventCron = "cron" EventPush = "push" EventPullRequest = "pull_request" EventTag = "tag" diff --git a/service/status/status.go b/service/status/status.go index f28fcfd0..47c8dbb9 100644 --- a/service/status/status.go +++ b/service/status/status.go @@ -50,7 +50,7 @@ type service struct { } func (s *service) Send(ctx context.Context, user *core.User, req *core.StatusInput) error { - if s.disabled || req.Build.Trigger == core.TriggerCron { + if s.disabled || req.Build.Event == core.EventCron { return nil } diff --git a/trigger/cron/cron.go b/trigger/cron/cron.go index 696d7b0b..50098622 100644 --- a/trigger/cron/cron.go +++ b/trigger/cron/cron.go @@ -144,7 +144,7 @@ func (s *Scheduler) run(ctx context.Context) error { hook := &core.Hook{ Trigger: core.TriggerCron, - Event: core.EventPush, + Event: core.EventCron, Link: commit.Link, Timestamp: commit.Author.Date, Message: commit.Message, diff --git a/trigger/cron/cron_test.go b/trigger/cron/cron_test.go index dc32c691..ec70319f 100644 --- a/trigger/cron/cron_test.go +++ b/trigger/cron/cron_test.go @@ -377,7 +377,7 @@ var ( Number: dummyRepo.Counter, RepoID: dummyRepo.ID, Status: core.StatusPending, - Event: core.EventPush, + Event: core.EventCron, Link: "https://github.com/octocat/Hello-World/commit/7fd1a60b01f91b314f59955a4e4d4e80d8edf11d", Timestamp: 1299283200, Message: "first commit", @@ -446,7 +446,7 @@ var ( } dummyHook = &core.Hook{ - Event: core.EventPush, + Event: core.EventCron, Link: "https://github.com/octocat/Hello-World/commit/7fd1a60b01f91b314f59955a4e4d4e80d8edf11d", Timestamp: 1299283200, Message: "first commit",