webhook: remove annotation virtual branch
This commit is contained in:
parent
863277af2d
commit
38b54b092c
|
@ -49,8 +49,6 @@ const (
|
||||||
AnnotationRunType = "runtype"
|
AnnotationRunType = "runtype"
|
||||||
AnnotationProjectID = "projectid"
|
AnnotationProjectID = "projectid"
|
||||||
AnnotationUserID = "userid"
|
AnnotationUserID = "userid"
|
||||||
// AnnotationVirtualBranch represent a "virtual branch": i.e a normal branch, a pr (with name pr-$prid), a tag (with name tag-tagname)
|
|
||||||
AnnotationVirtualBranch = "virtual_branch"
|
|
||||||
|
|
||||||
AnnotationCommitSHA = "commit_sha"
|
AnnotationCommitSHA = "commit_sha"
|
||||||
AnnotationRef = "ref"
|
AnnotationRef = "ref"
|
||||||
|
@ -67,19 +65,6 @@ const (
|
||||||
AnnotationPullRequestLink = "pull_request_link"
|
AnnotationPullRequestLink = "pull_request_link"
|
||||||
)
|
)
|
||||||
|
|
||||||
func genAnnotationVirtualBranch(webhookData *types.WebhookData) string {
|
|
||||||
switch webhookData.Event {
|
|
||||||
case types.WebhookEventPush:
|
|
||||||
return "branch-" + webhookData.Branch
|
|
||||||
case types.WebhookEventTag:
|
|
||||||
return "tag-" + webhookData.Tag
|
|
||||||
case types.WebhookEventPullRequest:
|
|
||||||
return "pr-" + webhookData.PullRequestID
|
|
||||||
}
|
|
||||||
|
|
||||||
panic(fmt.Errorf("invalid webhook event type: %q", webhookData.Event))
|
|
||||||
}
|
|
||||||
|
|
||||||
type webhooksHandler struct {
|
type webhooksHandler struct {
|
||||||
log *zap.SugaredLogger
|
log *zap.SugaredLogger
|
||||||
ah *action.ActionHandler
|
ah *action.ActionHandler
|
||||||
|
@ -276,7 +261,6 @@ func (h *webhooksHandler) handleWebhook(r *http.Request) (int, string, error) {
|
||||||
annotations := map[string]string{
|
annotations := map[string]string{
|
||||||
AnnotationRunType: string(runType),
|
AnnotationRunType: string(runType),
|
||||||
AnnotationEventType: string(webhookData.Event),
|
AnnotationEventType: string(webhookData.Event),
|
||||||
AnnotationVirtualBranch: genAnnotationVirtualBranch(webhookData),
|
|
||||||
AnnotationCommitSHA: webhookData.CommitSHA,
|
AnnotationCommitSHA: webhookData.CommitSHA,
|
||||||
AnnotationRef: webhookData.Ref,
|
AnnotationRef: webhookData.Ref,
|
||||||
AnnotationSender: webhookData.Sender,
|
AnnotationSender: webhookData.Sender,
|
||||||
|
|
Loading…
Reference in New Issue