webhook: use runRefType instead of webhook Event

This commit is contained in:
Simone Gotti 2019-06-10 16:52:51 +02:00
parent 28ddfb1781
commit 1938c2daaf
1 changed files with 5 additions and 5 deletions

View File

@ -45,8 +45,8 @@ const (
agolaDefaultYamlConfigFile = "config.yml" agolaDefaultYamlConfigFile = "config.yml"
// List of runs annotations // List of runs annotations
AnnotationEventType = "event_type" AnnotationRunType = "run_type"
AnnotationRunType = "runtype" AnnotationRefType = "ref_type"
AnnotationProjectID = "projectid" AnnotationProjectID = "projectid"
AnnotationUserID = "userid" AnnotationUserID = "userid"
@ -259,9 +259,11 @@ func (h *webhooksHandler) handleWebhook(r *http.Request) (int, string, error) {
env["AGOLA_SKIPSSHHOSTKEYCHECK"] = "1" env["AGOLA_SKIPSSHHOSTKEYCHECK"] = "1"
} }
refType := common.WebHookEventToRunRefType(webhookData.Event)
annotations := map[string]string{ annotations := map[string]string{
AnnotationRunType: string(runType), AnnotationRunType: string(runType),
AnnotationEventType: string(webhookData.Event), AnnotationRefType: string(refType),
AnnotationCommitSHA: webhookData.CommitSHA, AnnotationCommitSHA: webhookData.CommitSHA,
AnnotationRef: webhookData.Ref, AnnotationRef: webhookData.Ref,
AnnotationSender: webhookData.Sender, AnnotationSender: webhookData.Sender,
@ -294,8 +296,6 @@ func (h *webhooksHandler) handleWebhook(r *http.Request) (int, string, error) {
var groupType common.GroupType var groupType common.GroupType
var group string var group string
refType := common.WebHookEventToRunRefType(webhookData.Event)
if runType == types.RunTypeProject { if runType == types.RunTypeProject {
baseGroupType = common.GroupTypeProject baseGroupType = common.GroupTypeProject
baseGroupID = project.ID baseGroupID = project.ID