Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for GitLab Push Event #11007

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions pkg/build/webhook/github/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
)

var (
ErrNoGitHubEvent = errors.New("missing X-GitHub-Event or X-Gogs-Event")
ErrNoGitHubEvent = errors.New("missing X-GitHub-Event or X-Gogs-Event or X-Gitlab-Event")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please change this text to:
"missing X-GitHub-Event, X-Gogs-Event, or X-Gitlab-Event"

)

// WebHook used for processing github webhook requests.
Expand Down Expand Up @@ -57,8 +57,8 @@ func (p *WebHook) Extract(buildCfg *api.BuildConfig, secret, path string, req *h
return revision, envvars, proceed, err
}
method := getEvent(req.Header)
if method != "ping" && method != "push" {
return revision, envvars, proceed, fmt.Errorf("Unknown X-GitHub-Event or X-Gogs-Event %s", method)
if method != "ping" && method != "push" && method != "Push Hook" {
return revision, envvars, proceed, fmt.Errorf("Unknown X-GitHub-Event or X-Gogs-Event or X-Gitlab-Event %s", method)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same message change here (comma separated list instead of multiple ors)

}
if method == "ping" {
return revision, envvars, proceed, err
Expand Down Expand Up @@ -110,5 +110,8 @@ func getEvent(header http.Header) string {
if len(event) == 0 {
event = header.Get("X-Gogs-Event")
}
if len(event) == 0 {
event = header.Get("X-Gitlab-Event")
}
return event
}