webhook: add run creation trigger type

This commit is contained in:
Simone Gotti 2019-06-10 17:04:50 +02:00
parent 1938c2daaf
commit 5b22ebc2d3
2 changed files with 17 additions and 8 deletions

View File

@ -50,6 +50,8 @@ const (
AnnotationProjectID = "projectid" AnnotationProjectID = "projectid"
AnnotationUserID = "userid" AnnotationUserID = "userid"
AnnotationRunCreationTrigger = "run_creation_trigger"
AnnotationCommitSHA = "commit_sha" AnnotationCommitSHA = "commit_sha"
AnnotationRef = "ref" AnnotationRef = "ref"
AnnotationSender = "sender" AnnotationSender = "sender"
@ -264,6 +266,7 @@ func (h *webhooksHandler) handleWebhook(r *http.Request) (int, string, error) {
annotations := map[string]string{ annotations := map[string]string{
AnnotationRunType: string(runType), AnnotationRunType: string(runType),
AnnotationRefType: string(refType), AnnotationRefType: string(refType),
AnnotationRunCreationTrigger: string(types.RunCreationTriggerTypeWebhook),
AnnotationCommitSHA: webhookData.CommitSHA, AnnotationCommitSHA: webhookData.CommitSHA,
AnnotationRef: webhookData.Ref, AnnotationRef: webhookData.Ref,
AnnotationSender: webhookData.Sender, AnnotationSender: webhookData.Sender,

View File

@ -28,3 +28,9 @@ const (
RunRefTypeTag RunRefType = "tag" RunRefTypeTag RunRefType = "tag"
RunRefTypePullRequest RunRefType = "pull_request" RunRefTypePullRequest RunRefType = "pull_request"
) )
type RunCreationTriggerType string
const (
RunCreationTriggerTypeWebhook RunCreationTriggerType = "webhook"
)