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